[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
01/02: tests: Don't rely on temporary directories being permanent.
From: |
Leo Famulari |
Subject: |
01/02: tests: Don't rely on temporary directories being permanent. |
Date: |
Fri, 13 Jul 2018 17:34:15 -0400 (EDT) |
lfam pushed a commit to branch master
in repository guix.
commit 92bcccc51fd52571fb62166e787109a07185e329
Author: Leo Famulari <address@hidden>
Date: Fri Jul 13 15:53:25 2018 -0400
tests: Don't rely on temporary directories being permanent.
* tests/gexp.scm ("gexp->script #:module-path",
"program-file #:module-path"): Use run-with-store.
---
tests/gexp.scm | 56 +++++++++++++++++++++++++++++---------------------------
1 file changed, 29 insertions(+), 27 deletions(-)
diff --git a/tests/gexp.scm b/tests/gexp.scm
index 83fe811..391a0f8 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)