diff options
author | Ludovic Courtès <ludo@gnu.org> | 2021-09-26 23:09:23 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2021-09-26 23:09:23 +0200 |
commit | 9b9bfc7ac21ccbaf0757289abc5f821a274c86b1 (patch) | |
tree | f3c407040270e8ea13fdfec880a062a29ffa426b /gnu/build | |
parent | c6a8d6db77520097bd0b2df99bfab659bfcfd64c (diff) | |
download | guix-9b9bfc7ac21ccbaf0757289abc5f821a274c86b1.tar.gz guix-9b9bfc7ac21ccbaf0757289abc5f821a274c86b1.zip |
marionette: 'system-test-runner' dumps test log upon failure.
* gnu/build/marionette.scm (system-test-runner): In 'test-end' handler,
when SUCCESS? is false, dump log content to the current error port.
Diffstat (limited to 'gnu/build')
-rw-r--r-- | gnu/build/marionette.scm | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/gnu/build/marionette.scm b/gnu/build/marionette.scm index 941461a72c..08de7940e3 100644 --- a/gnu/build/marionette.scm +++ b/gnu/build/marionette.scm @@ -375,6 +375,23 @@ to actual keystrokes." (lambda (runner) (let ((success? (= (test-runner-fail-count runner) 0))) (test-on-final-simple runner) + + (when (not success?) + (let* ((log-port (test-runner-aux-value runner)) + (log-file (port-filename log-port))) + (format (current-error-port) + "\nTests failed, dumping log file '~a'.\n\n" + log-file) + + ;; At this point LOG-PORT is not closed yet; flush it. + (force-output log-port) + + ;; Brute force to avoid dependency on (guix build utils) for + ;; 'dump-port'. + (let ((content (call-with-input-file log-file + get-bytevector-all))) + (put-bytevector (current-error-port) content)))) + (exit success?)))) runner)) |