tests: Write a log file for each test.

* 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>
This commit is contained in:
Justus Winter 2016-11-07 17:44:34 +01:00
parent abe0cc7a21
commit 26df829fa2
2 changed files with 13 additions and 11 deletions

View 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 \

View File

@ -83,16 +83,18 @@
(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