tests: Don't rely on temporary directories being permanent.
* tests/gexp.scm ("gexp->script #:module-path", "program-file #:module-path"): Use run-with-store.
This commit is contained in:
parent
82da291abe
commit
92bcccc51f
|
@ -948,7 +948,7 @@
|
||||||
(return (and (zero? (close-pipe pipe))
|
(return (and (zero? (close-pipe pipe))
|
||||||
(= (expt n 2) (string->number str)))))))
|
(= (expt n 2) (string->number str)))))))
|
||||||
|
|
||||||
(test-assertm "gexp->script #:module-path"
|
(test-assert "gexp->script #:module-path"
|
||||||
(call-with-temporary-directory
|
(call-with-temporary-directory
|
||||||
(lambda (directory)
|
(lambda (directory)
|
||||||
(define str
|
(define str
|
||||||
|
@ -961,23 +961,24 @@
|
||||||
(define-public %fake! ,str))
|
(define-public %fake! ,str))
|
||||||
port)))
|
port)))
|
||||||
|
|
||||||
(mlet* %store-monad ((exp -> (with-imported-modules '((guix base32))
|
(run-with-store %store
|
||||||
(gexp (begin
|
(mlet* %store-monad ((exp -> (with-imported-modules '((guix base32))
|
||||||
(use-modules (guix base32))
|
(gexp (begin
|
||||||
(write (list %load-path
|
(use-modules (guix base32))
|
||||||
%fake!))))))
|
(write (list %load-path
|
||||||
(drv (gexp->script "guile-thing" exp
|
%fake!))))))
|
||||||
#:guile %bootstrap-guile
|
(drv (gexp->script "guile-thing" exp
|
||||||
#:module-path (list directory)))
|
#:guile %bootstrap-guile
|
||||||
(out -> (derivation->output-path drv))
|
#:module-path (list directory)))
|
||||||
(done (built-derivations (list drv))))
|
(out -> (derivation->output-path drv))
|
||||||
(let* ((pipe (open-input-pipe out))
|
(done (built-derivations (list drv))))
|
||||||
(data (read pipe)))
|
(let* ((pipe (open-input-pipe out))
|
||||||
(return (and (zero? (close-pipe pipe))
|
(data (read pipe)))
|
||||||
(match data
|
(return (and (zero? (close-pipe pipe))
|
||||||
((load-path str*)
|
(match data
|
||||||
(and (string=? str* str)
|
((load-path str*)
|
||||||
(not (member directory load-path))))))))))))
|
(and (string=? str* str)
|
||||||
|
(not (member directory load-path)))))))))))))
|
||||||
|
|
||||||
(test-assertm "program-file"
|
(test-assertm "program-file"
|
||||||
(let* ((n (random (expt 2 50)))
|
(let* ((n (random (expt 2 50)))
|
||||||
|
@ -996,7 +997,7 @@
|
||||||
(return (and (zero? (close-pipe pipe))
|
(return (and (zero? (close-pipe pipe))
|
||||||
(= n (string->number str)))))))))
|
(= n (string->number str)))))))))
|
||||||
|
|
||||||
(test-assertm "program-file #:module-path"
|
(test-assert "program-file #:module-path"
|
||||||
(call-with-temporary-directory
|
(call-with-temporary-directory
|
||||||
(lambda (directory)
|
(lambda (directory)
|
||||||
(define text (random-text))
|
(define text (random-text))
|
||||||
|
@ -1014,14 +1015,15 @@
|
||||||
(file (program-file "program" exp
|
(file (program-file "program" exp
|
||||||
#:guile %bootstrap-guile
|
#:guile %bootstrap-guile
|
||||||
#:module-path (list directory))))
|
#:module-path (list directory))))
|
||||||
(mlet* %store-monad ((drv (lower-object file))
|
(run-with-store %store
|
||||||
(out -> (derivation->output-path drv)))
|
(mlet* %store-monad ((drv (lower-object file))
|
||||||
(mbegin %store-monad
|
(out -> (derivation->output-path drv)))
|
||||||
(built-derivations (list drv))
|
(mbegin %store-monad
|
||||||
(let* ((pipe (open-input-pipe out))
|
(built-derivations (list drv))
|
||||||
(str (get-string-all pipe)))
|
(let* ((pipe (open-input-pipe out))
|
||||||
(return (and (zero? (close-pipe pipe))
|
(str (get-string-all pipe)))
|
||||||
(string=? text str))))))))))
|
(return (and (zero? (close-pipe pipe))
|
||||||
|
(string=? text str)))))))))))
|
||||||
|
|
||||||
(test-assertm "program-file & with-extensions"
|
(test-assertm "program-file & with-extensions"
|
||||||
(let* ((exp (with-extensions (list %extension-package)
|
(let* ((exp (with-extensions (list %extension-package)
|
||||||
|
|
Loading…
Reference in New Issue