summary refs log tree commit diff
path: root/tests/utils.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2012-08-14 18:36:01 +0200
committerLudovic Courtès <ludo@gnu.org>2012-08-14 18:42:46 +0200
commitb86b00567c82e0e16a3cfa65b3f87d95f31506bb (patch)
tree941eb32405715acea95b3bd9072c6243dd416118 /tests/utils.scm
parented795c060858f3949bf5ad321008626f5e7f195a (diff)
downloadguix-b86b00567c82e0e16a3cfa65b3f87d95f31506bb.tar.gz
build: Pass $(NIX_INSTANTIATE) to the build and test environments.
* Makefile.am (.scm.go): Define $NIX_INSTANTIATE.
  (TESTS_ENVIRONMENT): Likewise, and define $NIX_HASH.
* guix/utils.scm (nixpkgs-derivation): Use $NIX_INSTANTIATE when
  defined.

* tests/utils.scm (%nix-hash): New variable.
  ("sha256 & bytevector->nix-base32-string"): Use it.
Diffstat (limited to 'tests/utils.scm')
-rw-r--r--tests/utils.scm10
1 files changed, 7 insertions, 3 deletions
diff --git a/tests/utils.scm b/tests/utils.scm
index 4a24e23df9..6a90817ec3 100644
--- a/tests/utils.scm
+++ b/tests/utils.scm
@@ -29,6 +29,10 @@
   #:use-module (ice-9 popen)
   #:use-module (ice-9 match))
 
+(define %nix-hash
+  (or (getenv "NIX_HASH")
+      "nix-hash"))
+
 (test-begin "utils")
 
 (test-assert "bytevector->base32-string"
@@ -72,7 +76,7 @@
          (map string->utf8 '("" "f" "fo" "foo" "foob" "fooba" "foobar"))))
 
 ;; The following tests requires `nix-hash' in $PATH.
-(test-skip (if (false-if-exception (system* "nix-hash" "--version"))
+(test-skip (if (false-if-exception (system* %nix-hash "--version"))
                0
                1))
 
@@ -80,8 +84,8 @@
   (let ((file (search-path %load-path "tests/test.drv")))
     (equal? (bytevector->nix-base32-string
              (sha256 (call-with-input-file file get-bytevector-all)))
-            (let* ((c (format #f "nix-hash --type sha256 --base32 --flat \"~a\""
-                              file))
+            (let* ((c (format #f "~a --type sha256 --base32 --flat \"~a\""
+                              %nix-hash file))
                    (p (open-input-pipe c))
                    (l (read-line p)))
               (close-pipe p)