| 1 | |
| 2 | |
| 3 | |
| 4 | |
| 5 | |
| 6 | |
| 7 | |
| 8 | |
| 9 | |
| 10 | |
| 11 | |
| 12 | |
| 13 | |
| 14 | |
| 15 | |
| 16 | |
| 17 | |
| 18 |
|
| 19 | |
| 20 | |
| 21 | |
| 22 |
|
| 23 | guix shell --version
|
| 24 |
|
| 25 | configdir="t-guix-shell-config-$$"
|
| 26 | tmpdir="t-guix-shell-$$"
|
| 27 | trap 'rm -r "$tmpdir" "$configdir"' EXIT
|
| 28 | mkdir "$tmpdir" "$configdir" "$configdir/guix"
|
| 29 |
|
| 30 | XDG_CONFIG_HOME="$(realpath $configdir)"
|
| 31 | export XDG_CONFIG_HOME
|
| 32 |
|
| 33 | guix shell --bootstrap --pure guile-bootstrap -- guile --version
|
| 34 |
|
| 35 | |
| 36 | guix shell --bootstrap guile-bootstrap -S /dummy=bin/guile && false
|
| 37 |
|
| 38 | |
| 39 | guix shell --cwd=/tmp -n hello && false
|
| 40 |
|
| 41 | |
| 42 | guix shell --ad-hoc guile-bootstrap && false
|
| 43 |
|
| 44 | |
| 45 | guix shell -s armhf-linux intelmetool -n && false
|
| 46 |
|
| 47 | |
| 48 | |
| 49 | |
| 50 | |
| 51 | |
| 52 | initial_fd_list="$(echo /proc/$$/fd/*)"
|
| 53 | fd_list="$(guix shell --bootstrap guile-bootstrap -- \
|
| 54 | bash -c 'echo /proc/$$/fd/*')"
|
| 55 | test "$(echo $fd_list | wc -w)" -le "$(echo $initial_fd_list | wc -w)"
|
| 56 |
|
| 57 | |
| 58 | cat > "$tmpdir/guix.scm" <<EOF
|
| 59 | This is a broken guix.scm file.
|
| 60 | EOF
|
| 61 | (cd "$tmpdir"; SHELL="$(type -P true)" guix shell --bootstrap 2> "stderr") && false
|
| 62 | grep "not authorized" "$tmpdir/stderr"
|
| 63 | rm "$tmpdir/stderr"
|
| 64 |
|
| 65 | |
| 66 | echo "$(realpath "$tmpdir")" > "$configdir/guix/shell-authorized-directories"
|
| 67 |
|
| 68 | |
| 69 | (cd "$tmpdir"; guix shell --bootstrap -- true)
|
| 70 | mv "$tmpdir/guix.scm" "$tmpdir/manifest.scm"
|
| 71 | (cd "$tmpdir"; guix shell --bootstrap -- true)
|
| 72 | rm "$tmpdir/manifest.scm"
|
| 73 |
|
| 74 | |
| 75 | cat > "$tmpdir/manifest.scm" <<EOF
|
| 76 | (specifications->manifest '("guile-bootstrap"))
|
| 77 | EOF
|
| 78 | cat > "$tmpdir/fake-shell.sh" <<EOF
|
| 79 | #!$SHELL
|
| 80 | # This fake shell allows us to test interactive use.
|
| 81 | exec echo "\$GUIX_ENVIRONMENT"
|
| 82 | EOF
|
| 83 | chmod +x "$tmpdir/fake-shell.sh"
|
| 84 | profile1="$(cd "$tmpdir"; SHELL="$(realpath fake-shell.sh)" guix shell --bootstrap)"
|
| 85 | profile2="$(guix shell --bootstrap guile-bootstrap -- "$SHELL" -c 'echo $GUIX_ENVIRONMENT')"
|
| 86 | test -n "$profile1"
|
| 87 | test "$profile1" = "$profile2"
|
| 88 | rm "$tmpdir/manifest.scm"
|
| 89 |
|
| 90 | |
| 91 | echo "Broken manifest." > "$tmpdir/manifest.scm"
|
| 92 | (cd "$tmpdir"; SHELL="$(realpath fake-shell.sh)" guix shell --bootstrap -q)
|
| 93 | rm "$tmpdir/manifest.scm"
|
| 94 |
|
| 95 | |
| 96 | |
| 97 | cat > "$tmpdir/empty-package.scm" <<EOF
|
| 98 | (use-modules (guix) (guix tests)
|
| 99 | (guix build-system trivial))
|
| 100 |
|
| 101 | (dummy-package "empty-package"
|
| 102 | (build-system trivial-build-system)) ;zero inputs
|
| 103 | EOF
|
| 104 |
|
| 105 | guix shell --bootstrap --pure -D -f "$tmpdir/empty-package.scm" \
|
| 106 | guile-bootstrap -- guile --version
|
| 107 | rm "$tmpdir/empty-package.scm"
|
| 108 |
|
| 109 | |
| 110 | this_system="$(guile -c '(use-modules (guix utils))
|
| 111 | (display (%current-system))')"
|
| 112 | other_system="$(guile -c '(use-modules (guix utils))
|
| 113 | (display (if (string=? "riscv64-linux" (%current-system))
|
| 114 | "x86_64-linux"
|
| 115 | "riscv64-linux"))')"
|
| 116 | cat > "$tmpdir/some-package.scm" <<EOF
|
| 117 | (use-modules (guix utils)
|
| 118 | (guix packages)
|
| 119 | (gnu packages base))
|
| 120 |
|
| 121 | (define unsupported-dependency
|
| 122 | (package
|
| 123 | (inherit grep)
|
| 124 | (name "unsupported-dependency")
|
| 125 | (supported-systems '())))
|
| 126 |
|
| 127 | (package
|
| 128 | (inherit hello)
|
| 129 | (name "phony-package")
|
| 130 | (inputs
|
| 131 | (if (string=? (%current-system) "$this_system")
|
| 132 | (list unsupported-dependency)
|
| 133 | '())))
|
| 134 | EOF
|
| 135 |
|
| 136 | guix shell -D -f "$tmpdir/some-package.scm" -n && false
|
| 137 | guix shell -D -f "$tmpdir/some-package.scm" -n -s "$other_system"
|
| 138 |
|
| 139 |
|
| 140 | if guile -c '(getaddrinfo "www.gnu.org" "80" AI_NUMERICSERV)' 2> /dev/null
|
| 141 | then
|
| 142 | |
| 143 | guix shell --bootstrap --no-substitutes --search-paths --pure \
|
| 144 | -D -e '(@ (guix tests) gnu-make-for-tests)' > "$tmpdir/a"
|
| 145 |
|
| 146 | |
| 147 | profile=`grep "^export PATH" "$tmpdir/a" | sed -r 's|^.*="(.*)/bin"|\1|'`
|
| 148 |
|
| 149 | |
| 150 | grep -E "^export PATH=\"$profile/bin\"" "$tmpdir/a"
|
| 151 | grep -E "^export C_INCLUDE_PATH=\"$profile/include\"" "$tmpdir/a"
|
| 152 | grep -E "^export LIBRARY_PATH=\"$profile/lib\"" "$tmpdir/a"
|
| 153 | for dep in bootstrap-binaries-0 gcc-bootstrap-0 glibc-bootstrap-0
|
| 154 | do
|
| 155 | guix gc --references "$profile" | grep "$dep"
|
| 156 | done
|
| 157 |
|
| 158 | |
| 159 | guix gc --references "$profile" | grep make-boot0 && false
|
| 160 |
|
| 161 | |
| 162 | echo '(@ (guix tests) gnu-make-for-tests)' > "$tmpdir/guix.scm"
|
| 163 | (cd "$tmpdir"; guix shell --bootstrap --search-paths --pure > "b")
|
| 164 | cmp "$tmpdir/a" "$tmpdir/b"
|
| 165 | rm "$tmpdir/guix.scm"
|
| 166 | fi
|