tests: Write a log file for each test.
authorJustus Winter <justus@g10code.com>
Mon, 7 Nov 2016 16:44:34 +0000 (17:44 +0100)
committerJustus Winter <justus@g10code.com>
Mon, 7 Nov 2016 16:44:34 +0000 (17:44 +0100)
* tests/openpgp/Makefile.am (CLEANFILES): Delete logs.
* tests/openpgp/run-tests.scm (test::run-sync): Write logs.

Signed-off-by: Justus Winter <justus@g10code.com>
tests/openpgp/Makefile.am
tests/openpgp/run-tests.scm

index cfdd58d..8f565b3 100644 (file)
@@ -197,7 +197,7 @@ EXTRA_DIST = defs.scm $(XTESTS) $(TEST_FILES) \
 
 CLEANFILES = prepared.stamp x y yy z out err  $(data_files) \
             plain-1 plain-2 plain-3 trustdb.gpg *.lock .\#lk* \
-            *.test.log gpg_dearmor gpg.conf gpg-agent.conf S.gpg-agent \
+            *.log gpg_dearmor gpg.conf gpg-agent.conf S.gpg-agent \
             pubring.gpg pubring.gpg~ pubring.kbx pubring.kbx~ \
             secring.gpg pubring.pkr secring.skr \
             gnupg-test.stop random_seed gpg-agent.log tofu.db \
index ce0217b..9e9bc3d 100644 (file)
       (define (set-pid x)
        (new name directory command x retcode))
       (define (run-sync . args)
-       (with-working-directory directory
-         (let* ((p (inbound-pipe))
-                (pid (spawn-process-fd (append command args) 0
-                                       (:write-end p) (:write-end p))))
-           (close (:write-end p))
-           (splice (:read-end p) STDERR_FILENO)
-           (close (:read-end p))
-           (let ((t' (set-retcode (wait-process name pid #t))))
-             (t'::report)
-             t'))))
+       (letfd ((log (open (string-append name ".log")
+                          (logior O_WRONLY O_BINARY O_CREAT) #o600)))
+         (with-working-directory directory
+           (let* ((p (inbound-pipe))
+                  (pid (spawn-process-fd (append command args) 0
+                                         (:write-end p) (:write-end p))))
+             (close (:write-end p))
+             (splice (:read-end p) STDERR_FILENO log)
+             (close (:read-end p))
+             (let ((t' (set-retcode (wait-process name pid #t))))
+               (t'::report)
+               t')))))
       (define (run-sync-quiet . args)
        (with-working-directory directory
          (set-retcode