aboutsummaryrefslogtreecommitdiff
path: root/tests/gexp.scm
diff options
context:
space:
mode:
authorLeo Famulari <leo@famulari.name>2018-07-13 15:53:25 -0400
committerLeo Famulari <leo@famulari.name>2018-07-13 17:33:45 -0400
commit92bcccc51fd52571fb62166e787109a07185e329 (patch)
tree317cec19ed3d1a7e16fe542469b14c897bcbb462 /tests/gexp.scm
parent82da291abe3ce898d42abb199160d0a40c297a37 (diff)
downloadguix-92bcccc51fd52571fb62166e787109a07185e329.tar
guix-92bcccc51fd52571fb62166e787109a07185e329.tar.gz
tests: Don't rely on temporary directories being permanent.
* tests/gexp.scm ("gexp->script #:module-path", "program-file #:module-path"): Use run-with-store.
Diffstat (limited to 'tests/gexp.scm')
-rw-r--r--tests/gexp.scm56
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)