X-Git-Url: http://git.hcoop.net/jackhill/guix/guix.git/blobdiff_plain/c52872bfc418c6b2273f973dff8003ca9e062792..ef34558db2fba4204b50e79cf75f9aafdfde81fd:/tests/guix-daemon.sh diff --git a/tests/guix-daemon.sh b/tests/guix-daemon.sh index 9ae6e0b77a..330ad68835 100644 --- a/tests/guix-daemon.sh +++ b/tests/guix-daemon.sh @@ -1,5 +1,5 @@ # GNU Guix --- Functional package management for GNU -# Copyright © 2012, 2014, 2015, 2016, 2017, 2018 Ludovic Courtès +# Copyright © 2012, 2014, 2015, 2016, 2017, 2018, 2019 Ludovic Courtès # # This file is part of GNU Guix. # @@ -63,7 +63,7 @@ guile -c " (exit (has-substitutes? store \"$out\"))" # Now, run guix-daemon --no-substitutes. -socket="$NIX_STATE_DIR/alternate-socket" +socket="$GUIX_STATE_DIRECTORY/alternate-socket" guix-daemon --no-substitutes --listen="$socket" --disable-chroot & daemon_pid=$! trap 'kill $daemon_pid' EXIT @@ -94,6 +94,27 @@ done kill "$daemon_pid" +# Make sure 'profiles/per-user' is created when connecting over TCP. + +orig_GUIX_STATE_DIRECTORY="$GUIX_STATE_DIRECTORY" +GUIX_STATE_DIRECTORY="$GUIX_STATE_DIRECTORY-2" + +guix-daemon --disable-chroot --listen="localhost:9877" & +daemon_pid=$! + +GUIX_DAEMON_SOCKET="guix://localhost:9877" +export GUIX_DAEMON_SOCKET + +test ! -d "$GUIX_STATE_DIRECTORY/profiles/per-user" + +guix build guile-bootstrap -d + +test -d "$GUIX_STATE_DIRECTORY/profiles/per-user/$USER" + +kill "$daemon_pid" +unset GUIX_DAEMON_SOCKET +GUIX_STATE_DIRECTORY="$orig_GUIX_STATE_DIRECTORY" + # Check the failed build cache. guix-daemon --no-substitutes --listen="$socket" --disable-chroot \ @@ -109,7 +130,7 @@ guile -c " (define (build-without-failing drv) (lambda (store) - (guard (c ((nix-protocol-error? c) (values #t store))) + (guard (c ((store-protocol-error? c) (values #t store))) (build-derivations store (list drv)) (values #f store)))) @@ -141,7 +162,7 @@ daemon_pid=$! GUIX_DAEMON_SOCKET="$socket" \ guile -c ' - (use-modules (guix) (gnu packages) (guix tests)) + (use-modules (guix) (guix tests)) (with-store store (let* ((build (add-text-to-store store "build.sh" @@ -165,7 +186,7 @@ kill "$daemon_pid" # honored. client_code=' - (use-modules (guix) (gnu packages) (guix tests) (srfi srfi-34)) + (use-modules (guix) (guix tests) (srfi srfi-34)) (with-store store (let* ((build (add-text-to-store store "build.sh" @@ -177,9 +198,9 @@ client_code=' `("-e" ,build) #:inputs `((,bash) (,build)) #:env-vars `(("x" . ,(random-text)))))) - (exit (guard (c ((nix-protocol-error? c) + (exit (guard (c ((store-protocol-error? c) (->bool - (string-contains (pk (nix-protocol-error-message c)) + (string-contains (pk (store-protocol-error-message c)) "failed")))) (build-derivations store (list drv)) #f))))' @@ -196,14 +217,14 @@ done # Make sure garbage collection from a TCP connection does not work. -tcp_socket="127.0.0.1:9999" +tcp_socket="127.0.0.1:9998" guix-daemon --listen="$tcp_socket" & daemon_pid=$! GUIX_DAEMON_SOCKET="guix://$tcp_socket" export GUIX_DAEMON_SOCKET -if guix gc; then false; else true; fi +! guix gc unset GUIX_DAEMON_SOCKET kill "$daemon_pid"