daemon: Add tests for substitutes and --no-substitutes.
* tests/guix-daemon.sh: Add substituter tests.
This commit is contained in:
parent
968e84a6cf
commit
c9e2b0b16e
|
@ -1,5 +1,5 @@
|
||||||
# GNU Guix --- Functional package management for GNU
|
# GNU Guix --- Functional package management for GNU
|
||||||
# Copyright © 2012 Ludovic Courtès <ludo@gnu.org>
|
# Copyright © 2012, 2014 Ludovic Courtès <ludo@gnu.org>
|
||||||
#
|
#
|
||||||
# This file is part of GNU Guix.
|
# This file is part of GNU Guix.
|
||||||
#
|
#
|
||||||
|
@ -17,7 +17,7 @@
|
||||||
# along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
|
# along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
#
|
#
|
||||||
# Test the daemon.
|
# Test the daemon and its interaction with 'guix substitute-binary'.
|
||||||
#
|
#
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
@ -25,5 +25,53 @@ set -e
|
||||||
guix-daemon --version
|
guix-daemon --version
|
||||||
guix build --version
|
guix build --version
|
||||||
|
|
||||||
guix build -e '(@ (gnu packages bootstrap) %bootstrap-guile)'
|
drv="`guix build emacs -d`"
|
||||||
guix build coreutils -n
|
out="`guile -c ' \
|
||||||
|
(use-modules (guix) (gnu packages emacs)) \
|
||||||
|
(define store (open-connection)) \
|
||||||
|
(display (derivation->output-path (package-derivation store emacs)))'`"
|
||||||
|
|
||||||
|
hash_part="`basename $out | cut -c 1-32`"
|
||||||
|
narinfo="$hash_part.narinfo"
|
||||||
|
substitute_dir="`echo $GUIX_BINARY_SUBSTITUTE_URL | sed -'es,file://,,g'`"
|
||||||
|
|
||||||
|
cat > "$substitute_dir/nix-cache-info"<<EOF
|
||||||
|
StoreDir: `dirname $drv`
|
||||||
|
WantMassQuery: 0
|
||||||
|
EOF
|
||||||
|
|
||||||
|
cat > "$substitute_dir/$narinfo"<<EOF
|
||||||
|
StorePath: $out
|
||||||
|
URL: /nowhere/example.nar
|
||||||
|
Compression: none
|
||||||
|
NarSize: 1234
|
||||||
|
References:
|
||||||
|
System: `guile -c '(use-modules (guix)) (display (%current-system))'`
|
||||||
|
Deriver: $drv
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# Remove the cached narinfo.
|
||||||
|
rm -f "$XDG_CACHE_HOME/guix/substitute-binary/$hash_part"
|
||||||
|
|
||||||
|
# Make sure we see the substitute.
|
||||||
|
guile -c '
|
||||||
|
(use-modules (guix))
|
||||||
|
(define store (open-connection))
|
||||||
|
(set-build-options store #:use-substitutes? #t)
|
||||||
|
(exit (has-substitutes? store "'"$out"'"))'
|
||||||
|
|
||||||
|
# Now, run guix-daemon --no-substitutes.
|
||||||
|
socket="$NIX_STATE_DIR/alternate-socket"
|
||||||
|
guix-daemon --no-substitutes --listen="$socket" --disable-chroot &
|
||||||
|
daemon_pid=$!
|
||||||
|
trap "kill $daemon_pid" EXIT
|
||||||
|
|
||||||
|
# Make sure we DON'T see the substitute.
|
||||||
|
guile -c "
|
||||||
|
(use-modules (guix))
|
||||||
|
(define store (open-connection \"$socket\"))
|
||||||
|
|
||||||
|
;; This setting MUST NOT override the daemon's --no-substitutes.
|
||||||
|
(set-build-options store #:use-substitutes? #t)
|
||||||
|
|
||||||
|
(exit (not (has-substitutes? store \"$out\")))"
|
||||||
|
|
Loading…
Reference in New Issue