1
0
mirror of https://git.savannah.gnu.org/git/guix.git synced 2026-04-06 21:20:33 +02:00

build: test-driver.scm: Refine the global test result.

The :test-global-result: .trs metadata contained just either FAIL, SKIP or
PASS with a comment that further refinements are required for XPASS.  The
description of :test-global-result: is in the manual is as follows:

     This is used to declare the "global result" of the script.
     Currently, the value of this field is needed only to be reported
     (more or less verbatim) in the generated global log file
     ‘$(TEST_SUITE_LOG)’, so it’s quite free-form.  For example, a test
     script which runs 10 test cases, 6 of which pass and 4 of which are
     skipped, could reasonably have a ‘PASS/SKIP’ value for this field,
     while a test script which runs 19 successful tests and one failed
     test could have an ‘ALMOST PASSED’ value.

As we can see, the examples as `PASS/SKIP' and `ALMOST PASSED', so there is no
need to stick to strict model.  Hence this commit changes the resulting value
to be comma-separated list of PASS, FAIL, XPASS, XFAIL and SKIP.  The
respective elements are present only when the count of tests with such a
result is positive.

In practice, that should usually produce lines such as

    :test-global-result: PASS,FAIL

or

    :test-global-result: PASS

* build-aux/test-driver.scm (test-runner-gnu)[finalize]: Refine the output of
:test-global-result:.

Change-Id: I7178ac9703e1749adf6de2445f7ed0591983cef2
Signed-off-by: Maxim Cournoyer <maxim@guixotic.coop>
This commit is contained in:
Tomas Volf
2024-07-14 22:45:16 +02:00
committed by Maxim Cournoyer
parent 4b60e86f2e
commit ef4ba3191f

View File

@@ -3,7 +3,7 @@ exec guile --no-auto-compile -e main -s "$0" "$@"
!#
;;;; test-driver.scm - Guile test driver for Automake testsuite harness
(define script-version "2026-03-19.14") ;UTC
(define script-version "2026-03-20.08") ;UTC
;;; Copyright © 2015, 2016 Mathieu Lirzin <mthl@gnu.org>
;;; Copyright © 2021 Maxim Cournoyer <maxim@guixotic.coop>
@@ -191,9 +191,20 @@ called to do the final reporting."
(positive? (test-runner-xpass-count runner))))
(skip (or (positive? (test-runner-skip-count runner))
(positive? (test-runner-xfail-count runner)))))
;; XXX: The global results need some refinements for XPASS.
(format trs-port ":global-test-result: ~A~%"
(if fail "FAIL" (if skip "SKIP" "PASS")))
(format trs-port ":test-global-result: ~{~A~^,~}~%"
(filter-map (λ (proc str)
(let ((n (proc runner)))
(if (positive? n) str #f)))
(list test-runner-pass-count
test-runner-fail-count
test-runner-xpass-count
test-runner-xfail-count
test-runner-skip-count)
(list "PASS"
"FAIL"
"XPASS"
"XFAIL"
"SKIP")))
(format trs-port ":recheck: ~A~%"
(if fail "yes" "no"))
(format trs-port ":copy-in-global-log: ~A~%"