diff options
| -rw-r--r-- | build-aux/pre-inst-env.in | 9 | ||||
| -rw-r--r-- | configure.ac | 5 | ||||
| -rw-r--r-- | tests/base32.scm | 31 |
3 files changed, 2 insertions, 43 deletions
diff --git a/build-aux/pre-inst-env.in b/build-aux/pre-inst-env.in index e0aa7fe8685..cd90a06cbc7 100644 --- a/build-aux/pre-inst-env.in +++ b/build-aux/pre-inst-env.in | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | #!/bin/sh | 1 | #!/bin/sh |
| 2 | 2 | ||
| 3 | # GNU Guix --- Functional package management for GNU | 3 | # GNU Guix --- Functional package management for GNU |
| 4 | # Copyright © 2012, 2013, 2014, 2015, 2017, 2018, 2019 Ludovic Courtès <ludo@gnu.org> | 4 | # Copyright © 2012, 2013, 2014, 2015, 2017, 2018, 2019, 2020 Ludovic Courtès <ludo@gnu.org> |
| 5 | # Copyright © 2017 Eric Bavier <bavier@cray.com> | 5 | # Copyright © 2017 Eric Bavier <bavier@cray.com> |
| 6 | # | 6 | # |
| 7 | # This file is part of GNU Guix. | 7 | # This file is part of GNU Guix. |
| @@ -46,13 +46,6 @@ export PATH | |||
| 46 | GUIX="$abs_top_builddir/scripts/guix" | 46 | GUIX="$abs_top_builddir/scripts/guix" |
| 47 | export GUIX | 47 | export GUIX |
| 48 | 48 | ||
| 49 | # The following variables need only be defined when compiling Guix | ||
| 50 | # modules, but we define them to be on the safe side in case of | ||
| 51 | # auto-compilation. | ||
| 52 | |||
| 53 | NIX_HASH="@NIX_HASH@" | ||
| 54 | export NIX_HASH | ||
| 55 | |||
| 56 | # Define $GUIX_UNINSTALLED to prevent `guix' from | 49 | # Define $GUIX_UNINSTALLED to prevent `guix' from |
| 57 | # prepending @guilemoduledir@ to the Guile load paths. | 50 | # prepending @guilemoduledir@ to the Guile load paths. |
| 58 | 51 | ||
diff --git a/configure.ac b/configure.ac index 7959d08cd7c..adca3746195 100644 --- a/configure.ac +++ b/configure.ac | |||
| @@ -194,11 +194,6 @@ AC_ARG_WITH([nix-prefix], | |||
| 194 | esac], | 194 | esac], |
| 195 | []) | 195 | []) |
| 196 | 196 | ||
| 197 | AC_PATH_PROG([NIX_HASH], [nix-hash]) | ||
| 198 | if test "x$guix_build_daemon$NIX_HASH" = "xno"; then | ||
| 199 | AC_MSG_ERROR([Nix programs not found; please install Nix or use `--with-nix-prefix'.]) | ||
| 200 | fi | ||
| 201 | |||
| 202 | AC_ARG_WITH([nixpkgs], | 197 | AC_ARG_WITH([nixpkgs], |
| 203 | [AS_HELP_STRING([--with-nixpkgs=DIR], | 198 | [AS_HELP_STRING([--with-nixpkgs=DIR], |
| 204 | [search for Nixpkgs in DIR (for testing purposes only)])], | 199 | [search for Nixpkgs in DIR (for testing purposes only)])], |
diff --git a/tests/base32.scm b/tests/base32.scm index 134e5786330..a999edcaccb 100644 --- a/tests/base32.scm +++ b/tests/base32.scm | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | ;;; GNU Guix --- Functional package management for GNU | 1 | ;;; GNU Guix --- Functional package management for GNU |
| 2 | ;;; Copyright © 2012, 2013, 2015 Ludovic Courtès <ludo@gnu.org> | 2 | ;;; Copyright © 2012, 2013, 2015, 2020 Ludovic Courtès <ludo@gnu.org> |
| 3 | ;;; | 3 | ;;; |
| 4 | ;;; This file is part of GNU Guix. | 4 | ;;; This file is part of GNU Guix. |
| 5 | ;;; | 5 | ;;; |
| @@ -23,26 +23,12 @@ | |||
| 23 | #:use-module (srfi srfi-1) | 23 | #:use-module (srfi srfi-1) |
| 24 | #:use-module (srfi srfi-34) | 24 | #:use-module (srfi srfi-34) |
| 25 | #:use-module (srfi srfi-64) | 25 | #:use-module (srfi srfi-64) |
| 26 | #:use-module (ice-9 rdelim) | ||
| 27 | #:use-module (ice-9 popen) | ||
| 28 | #:use-module (ice-9 match) | 26 | #:use-module (ice-9 match) |
| 29 | #:use-module (rnrs bytevectors) | 27 | #:use-module (rnrs bytevectors) |
| 30 | #:use-module (rnrs io ports)) | 28 | #:use-module (rnrs io ports)) |
| 31 | 29 | ||
| 32 | ;; Test the (guix base32) module. | 30 | ;; Test the (guix base32) module. |
| 33 | 31 | ||
| 34 | (define %nix-hash | ||
| 35 | (or (and=> (getenv "NIX_HASH") | ||
| 36 | (match-lambda | ||
| 37 | ("" #f) | ||
| 38 | (val val))) | ||
| 39 | "nix-hash")) | ||
| 40 | |||
| 41 | (define %have-nix-hash? | ||
| 42 | ;; Note: Use `system', not `system*', because of <http://bugs.gnu.org/13166>. | ||
| 43 | (false-if-exception | ||
| 44 | (zero? (system (string-append %nix-hash " --version"))))) | ||
| 45 | |||
| 46 | (test-begin "base32") | 32 | (test-begin "base32") |
| 47 | 33 | ||
| 48 | (test-assert "bytevector->base32-string" | 34 | (test-assert "bytevector->base32-string" |
| @@ -85,19 +71,4 @@ | |||
| 85 | (nix-base32-string->bytevector | 71 | (nix-base32-string->bytevector |
| 86 | (string-append (make-string 51 #\a) "e")))) | 72 | (string-append (make-string 51 #\a) "e")))) |
| 87 | 73 | ||
| 88 | ;; The following test requires `nix-hash' in $PATH. | ||
| 89 | (unless %have-nix-hash? | ||
| 90 | (test-skip 1)) | ||
| 91 | |||
| 92 | (test-assert "sha256 & bytevector->nix-base32-string" | ||
| 93 | (let ((file (search-path %load-path "tests/test.drv"))) | ||
| 94 | (equal? (bytevector->nix-base32-string | ||
| 95 | (sha256 (call-with-input-file file get-bytevector-all))) | ||
| 96 | (let* ((c (format #f "~a --type sha256 --base32 --flat \"~a\"" | ||
| 97 | %nix-hash file)) | ||
| 98 | (p (open-input-pipe c)) | ||
| 99 | (l (read-line p))) | ||
| 100 | (close-pipe p) | ||
| 101 | l)))) | ||
| 102 | |||
| 103 | (test-end) | 74 | (test-end) |
