guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

04/04: marionette: Print a line when a test succeeds.


From: guix-commits
Subject: 04/04: marionette: Print a line when a test succeeds.
Date: Sun, 26 Sep 2021 17:37:44 -0400 (EDT)

civodul pushed a commit to branch core-updates-frozen
in repository guix.

commit 9980ac0f99f88972d023bf19ad4b0f536f6c29fa
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Sun Sep 26 23:35:58 2021 +0200

    marionette: Print a line when a test succeeds.
    
    * gnu/build/marionette.scm (system-test-runner): Add call to
    'test-runner-on-test-end!'.
---
 gnu/build/marionette.scm | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/gnu/build/marionette.scm b/gnu/build/marionette.scm
index e76ef16..0ebe535 100644
--- a/gnu/build/marionette.scm
+++ b/gnu/build/marionette.scm
@@ -385,6 +385,21 @@ LOG-DIRECTORY is specified, create log file within it."
                   (string-append log-directory "/" suite-name ".log")))
           (on-begin runner suite-name count))))
 
+    ;; The default behavior on 'test-end' is to only write a line if the test
+    ;; failed.  Arrange to also write a line on success.
+    (test-runner-on-test-end! runner
+      (let ((on-end (test-runner-on-test-end runner)))
+        (lambda (runner)
+          (let* ((kind      (test-result-ref runner 'result-kind))
+                 (results   (test-result-alist runner))
+                 (test-name (assq-ref results 'test-name)))
+            (unless (memq kind '(fail xpass))
+              (format (current-output-port) "~a: ~a~%"
+                      (string-upcase (symbol->string kind))
+                      test-name)))
+
+          (on-end runner))))
+
     ;; On 'test-end', display test results and exit with zero if and only if
     ;; there were no test failures.
     (test-runner-on-final! runner



reply via email to

[Prev in Thread] Current Thread [Next in Thread]