diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/gexp.scm | 31 | ||||
-rw-r--r-- | tests/pack.scm | 2 | ||||
-rw-r--r-- | tests/store-database.scm | 53 |
3 files changed, 48 insertions, 38 deletions
diff --git a/tests/gexp.scm b/tests/gexp.scm index 001786c13c..905009caee 100644 --- a/tests/gexp.scm +++ b/tests/gexp.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2014-2023 Ludovic Courtès <ludo@gnu.org> +;;; Copyright © 2014-2024 Ludovic Courtès <ludo@gnu.org> ;;; Copyright © 2021-2022 Maxime Devos <maximedevos@telenet.be> ;;; ;;; This file is part of GNU Guix. @@ -661,7 +661,8 @@ (mlet* %store-monad ((exp -> (gexp (display (ungexp %bootstrap-guile)))) (guile (package-file %bootstrap-guile)) (sexp (gexp->sexp exp (%current-system) #f)) - (drv (gexp->file "foo" exp)) + (drv (gexp->file "foo" exp + #:guile %bootstrap-guile)) (out -> (derivation->output-path drv)) (done (built-derivations (list drv))) (refs (references* out))) @@ -672,7 +673,8 @@ (mlet* %store-monad ((exp -> #~#$(file-append %bootstrap-guile "/bin/guile")) (guile (package-file %bootstrap-guile)) - (drv (gexp->file "foo" exp)) + (drv (gexp->file "foo" exp + #:guile %bootstrap-guile)) (out -> (derivation->output-path drv)) (done (built-derivations (list drv))) (refs (references* out))) @@ -685,7 +687,9 @@ #~(define foo 'bar) #~(define guile #$%bootstrap-guile))) (guile (package-file %bootstrap-guile)) - (drv (gexp->file "splice" exp #:splice? #t)) + (drv (gexp->file "splice" exp + #:splice? #t + #:guile %bootstrap-guile)) (out -> (derivation->output-path drv)) (done (built-derivations (list drv))) (refs (references* out))) @@ -943,7 +947,8 @@ (let ((make-file (lambda () ;; Use 'eval' to make sure we get an object that's not ;; 'eq?' nor 'equal?' due to the closures it embeds. - (eval '(scheme-file "bar.scm" #~(define-module (bar))) + (eval '(scheme-file "bar.scm" #~(define-module (bar)) + #:guile %bootstrap-guile) (current-module))))) (define result ((@@ (guix gexp) gexp-modules) @@ -1035,7 +1040,8 @@ importing.* \\(guix config\\) from the host" #:export (the-answer)) (define the-answer 42)) - #:splice? #t)) + #:splice? #t + #:guile %bootstrap-guile)) (build -> (with-imported-modules `(((foo bar) => ,module) (guix build utils)) #~(begin @@ -1080,7 +1086,8 @@ importing.* \\(guix config\\) from the host" (define (multiply x) (* the-answer x))) - #:splice? #t)) + #:splice? #t + #:guile %bootstrap-guile)) (build -> (with-extensions (list extension) (with-imported-modules `((guix build utils) ((foo) => ,module)) @@ -1432,7 +1439,8 @@ importing.* \\(guix config\\) from the host" (test-assertm "scheme-file" (let* ((text (plain-file "foo" "Hello, world!")) - (scheme (scheme-file "bar" #~(list "foo" #$text)))) + (scheme (scheme-file "bar" #~(list "foo" #$text) + #:guile %bootstrap-guile))) (mlet* %store-monad ((drv (lower-object scheme)) (text (lower-object text)) (out -> (derivation->output-path drv))) @@ -1719,7 +1727,9 @@ importing.* \\(guix config\\) from the host" (test-assertm "gexp->file, cross-compilation" (mlet* %store-monad ((target -> "aarch64-linux-gnu") (exp -> (gexp (list (ungexp coreutils)))) - (xdrv (gexp->file "foo" exp #:target target)) + (xdrv (gexp->file "foo" exp + #:target target + #:guile %bootstrap-guile)) (refs (references* (derivation-file-name xdrv))) (xcu (package->cross-derivation coreutils @@ -1732,7 +1742,8 @@ importing.* \\(guix config\\) from the host" (mlet* %store-monad ((target -> "aarch64-linux-gnu") (_ (set-current-target target)) (exp -> (gexp (list (ungexp coreutils)))) - (xdrv (gexp->file "foo" exp)) + (xdrv (gexp->file "foo" exp + #:guile %bootstrap-guile)) (refs (references* (derivation-file-name xdrv))) (xcu (package->cross-derivation coreutils diff --git a/tests/pack.scm b/tests/pack.scm index 55445ea1e9..40897a5589 100644 --- a/tests/pack.scm +++ b/tests/pack.scm @@ -209,7 +209,7 @@ (and (every valid-file? '("α" "λ") '("alpha" "lambda")) - (integer? (path-id db #$tree))))))))))) + (integer? (valid-path-id db #$tree))))))))))) (built-derivations (list check)))) (unless store (test-skip 1)) diff --git a/tests/store-database.scm b/tests/store-database.scm index d8f3ce8070..67d464386d 100644 --- a/tests/store-database.scm +++ b/tests/store-database.scm @@ -87,23 +87,22 @@ (lambda (db-file port) (delete-file db-file) (with-database db-file db - (sqlite-register db - #:path "/gnu/foo" - #:references '() - #:deriver "/gnu/foo.drv" - #:hash (string-append "sha256:" (make-string 64 #\e)) - #:nar-size 1234) - (sqlite-register db - #:path "/gnu/bar" - #:references '("/gnu/foo") - #:deriver "/gnu/bar.drv" - #:hash (string-append "sha256:" (make-string 64 #\a)) - #:nar-size 4321) - (let ((path-id (@@ (guix store database) path-id))) - (list (path-id db "/gnu/foo") - (path-id db "/gnu/bar"))))))) + (register-valid-path db + #:path "/gnu/foo" + #:references '() + #:deriver "/gnu/foo.drv" + #:hash (string-append "sha256:" (make-string 64 #\e)) + #:nar-size 1234) + (register-valid-path db + #:path "/gnu/bar" + #:references '("/gnu/foo") + #:deriver "/gnu/bar.drv" + #:hash (string-append "sha256:" (make-string 64 #\a)) + #:nar-size 4321) + (list (valid-path-id db "/gnu/foo") + (valid-path-id db "/gnu/bar")))))) -(test-assert "sqlite-register with unregistered references" +(test-assert "register-valid-path with unregistered references" ;; Make sure we get a "NOT NULL constraint failed: Refs.reference" error ;; when we try to add references that are not registered yet. Better safe ;; than sorry. @@ -113,17 +112,17 @@ (catch 'sqlite-error (lambda () (with-database db-file db - (sqlite-register db #:path "/gnu/foo" - #:references '("/gnu/bar") - #:deriver "/gnu/foo.drv" - #:hash (string-append "sha256:" (make-string 64 #\e)) - #:nar-size 1234)) + (register-valid-path db #:path "/gnu/foo" + #:references '("/gnu/bar") + #:deriver "/gnu/foo.drv" + #:hash (string-append "sha256:" (make-string 64 #\e)) + #:nar-size 1234)) #f) (lambda args (pk 'welcome-exception! args) #t))))) -(test-equal "sqlite-register with incorrect size" +(test-equal "register-valid-path with incorrect size" 'out-of-range (call-with-temporary-output-file (lambda (db-file port) @@ -131,11 +130,11 @@ (catch #t (lambda () (with-database db-file db - (sqlite-register db #:path "/gnu/foo" - #:references '("/gnu/bar") - #:deriver "/gnu/foo.drv" - #:hash (string-append "sha256:" (make-string 64 #\e)) - #:nar-size -1234)) + (register-valid-path db #:path "/gnu/foo" + #:references '("/gnu/bar") + #:deriver "/gnu/foo.drv" + #:hash (string-append "sha256:" (make-string 64 #\e)) + #:nar-size -1234)) #f) (lambda (key . _) key))))) |