diff options
-rw-r--r-- | tests/gexp.scm | 56 |
1 files changed, 29 insertions, 27 deletions
diff --git a/tests/gexp.scm b/tests/gexp.scm index 83fe811546..391a0f8be5 100644 --- a/tests/gexp.scm +++ b/tests/gexp.scm @@ -948,7 +948,7 @@ (return (and (zero? (close-pipe pipe)) (= (expt n 2) (string->number str))))))) -(test-assertm "gexp->script #:module-path" +(test-assert "gexp->script #:module-path" (call-with-temporary-directory (lambda (directory) (define str @@ -961,23 +961,24 @@ (define-public %fake! ,str)) port))) - (mlet* %store-monad ((exp -> (with-imported-modules '((guix base32)) - (gexp (begin - (use-modules (guix base32)) - (write (list %load-path - %fake!)))))) - (drv (gexp->script "guile-thing" exp - #:guile %bootstrap-guile - #:module-path (list directory))) - (out -> (derivation->output-path drv)) - (done (built-derivations (list drv)))) - (let* ((pipe (open-input-pipe out)) - (data (read pipe))) - (return (and (zero? (close-pipe pipe)) - (match data - ((load-path str*) - (and (string=? str* str) - (not (member directory load-path)))))))))))) + (run-with-store %store + (mlet* %store-monad ((exp -> (with-imported-modules '((guix base32)) + (gexp (begin + (use-modules (guix base32)) + (write (list %load-path + %fake!)))))) + (drv (gexp->script "guile-thing" exp + #:guile %bootstrap-guile + #:module-path (list directory))) + (out -> (derivation->output-path drv)) + (done (built-derivations (list drv)))) + (let* ((pipe (open-input-pipe out)) + (data (read pipe))) + (return (and (zero? (close-pipe pipe)) + (match data + ((load-path str*) + (and (string=? str* str) + (not (member directory load-path))))))))))))) (test-assertm "program-file" (let* ((n (random (expt 2 50))) @@ -996,7 +997,7 @@ (return (and (zero? (close-pipe pipe)) (= n (string->number str))))))))) -(test-assertm "program-file #:module-path" +(test-assert "program-file #:module-path" (call-with-temporary-directory (lambda (directory) (define text (random-text)) @@ -1014,14 +1015,15 @@ (file (program-file "program" exp #:guile %bootstrap-guile #:module-path (list directory)))) - (mlet* %store-monad ((drv (lower-object file)) - (out -> (derivation->output-path drv))) - (mbegin %store-monad - (built-derivations (list drv)) - (let* ((pipe (open-input-pipe out)) - (str (get-string-all pipe))) - (return (and (zero? (close-pipe pipe)) - (string=? text str)))))))))) + (run-with-store %store + (mlet* %store-monad ((drv (lower-object file)) + (out -> (derivation->output-path drv))) + (mbegin %store-monad + (built-derivations (list drv)) + (let* ((pipe (open-input-pipe out)) + (str (get-string-all pipe))) + (return (and (zero? (close-pipe pipe)) + (string=? text str))))))))))) (test-assertm "program-file & with-extensions" (let* ((exp (with-extensions (list %extension-package) |