tests: Avoid auto-removal when test fails.

* tests/gpgscm/init.scm (*exit-status*): New.
(exit): Set *exit-status*.
* tests/gpgscm/tests.scm (mkdtemp-autoremove): Check
exit-status and only remove the directory if not zero.

--

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
NIIBE Yutaka 2022-04-26 17:20:08 +09:00
parent ba2f2085a9
commit f27a70ecc2
2 changed files with 4 additions and 1 deletions

View File

@ -654,8 +654,11 @@
;; resource management a chance to clean up.
(define *interpreter-exit* (gensym))
(define *exit-status* 0)
;; Terminate the process returning STATUS to the parent.
(define (exit status)
(set! *exit-status* status)
(throw "interpreter exit" *interpreter-exit* status))
;; A list of functions run at interpreter shutdown.

View File

@ -288,7 +288,7 @@
;; Otherwise this works like mkdtemp.
(define (mkdtemp-autoremove . components)
(let ((dir (apply mkdtemp components)))
(atexit (lambda () (unlink-recursively dir)))
(atexit (lambda () (if (= *exit-status* 0) (unlink-recursively dir))))
dir))
(define-macro (with-temporary-working-directory . expressions)