mirror of
https://github.com/NixOS/nix
synced 2025-06-25 06:31:14 +02:00
Merge remote-tracking branch 'origin/master' into large-path-warning
This commit is contained in:
commit
7f5b57d18f
435 changed files with 6086 additions and 2767 deletions
16
tests/functional/add.sh
Normal file → Executable file
16
tests/functional/add.sh
Normal file → Executable file
|
@ -1,10 +1,12 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
source common.sh
|
||||
|
||||
path1=$(nix-store --add ./dummy)
|
||||
echo $path1
|
||||
echo "$path1"
|
||||
|
||||
path2=$(nix-store --add-fixed sha256 --recursive ./dummy)
|
||||
echo $path2
|
||||
echo "$path2"
|
||||
|
||||
if test "$path1" != "$path2"; then
|
||||
echo "nix-store --add and --add-fixed mismatch"
|
||||
|
@ -12,18 +14,18 @@ if test "$path1" != "$path2"; then
|
|||
fi
|
||||
|
||||
path3=$(nix-store --add-fixed sha256 ./dummy)
|
||||
echo $path3
|
||||
echo "$path3"
|
||||
test "$path1" != "$path3" || exit 1
|
||||
|
||||
path4=$(nix-store --add-fixed sha1 --recursive ./dummy)
|
||||
echo $path4
|
||||
echo "$path4"
|
||||
test "$path1" != "$path4" || exit 1
|
||||
|
||||
hash1=$(nix-store -q --hash $path1)
|
||||
echo $hash1
|
||||
hash1=$(nix-store -q --hash "$path1")
|
||||
echo "$hash1"
|
||||
|
||||
hash2=$(nix-hash --type sha256 --base32 ./dummy)
|
||||
echo $hash2
|
||||
echo "$hash2"
|
||||
|
||||
test "$hash1" = "sha256:$hash2"
|
||||
|
||||
|
|
2
tests/functional/bash-profile.sh
Normal file → Executable file
2
tests/functional/bash-profile.sh
Normal file → Executable file
|
@ -1,3 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
source common.sh
|
||||
|
||||
sed -e "s|@localstatedir@|$TEST_ROOT/profile-var|g" -e "s|@coreutils@|$coreutils|g" < ../../scripts/nix-profile.sh.in > $TEST_ROOT/nix-profile.sh
|
||||
|
|
2
tests/functional/binary-cache-build-remote.sh
Normal file → Executable file
2
tests/functional/binary-cache-build-remote.sh
Normal file → Executable file
|
@ -1,3 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
source common.sh
|
||||
|
||||
clearStore
|
||||
|
|
2
tests/functional/binary-cache.sh
Normal file → Executable file
2
tests/functional/binary-cache.sh
Normal file → Executable file
|
@ -1,3 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
source common.sh
|
||||
|
||||
needLocalStore "'--no-require-sigs' can’t be used with the daemon"
|
||||
|
|
2
tests/functional/brotli.sh
Normal file → Executable file
2
tests/functional/brotli.sh
Normal file → Executable file
|
@ -1,3 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
source common.sh
|
||||
|
||||
clearStore
|
||||
|
|
2
tests/functional/build-delete.sh
Normal file → Executable file
2
tests/functional/build-delete.sh
Normal file → Executable file
|
@ -1,3 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
source common.sh
|
||||
|
||||
clearStore
|
||||
|
|
2
tests/functional/build-dry.sh
Normal file → Executable file
2
tests/functional/build-dry.sh
Normal file → Executable file
|
@ -1,3 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
source common.sh
|
||||
|
||||
###################################################
|
||||
|
|
2
tests/functional/build-remote-content-addressed-fixed.sh
Normal file → Executable file
2
tests/functional/build-remote-content-addressed-fixed.sh
Normal file → Executable file
|
@ -1,3 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
source common.sh
|
||||
|
||||
file=build-hook-ca-fixed.nix
|
||||
|
|
2
tests/functional/build-remote-content-addressed-floating.sh
Normal file → Executable file
2
tests/functional/build-remote-content-addressed-floating.sh
Normal file → Executable file
|
@ -1,3 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
source common.sh
|
||||
|
||||
file=build-hook-ca-floating.nix
|
||||
|
|
12
tests/functional/build-remote-input-addressed.sh
Normal file → Executable file
12
tests/functional/build-remote-input-addressed.sh
Normal file → Executable file
|
@ -1,3 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
source common.sh
|
||||
|
||||
file=build-hook.nix
|
||||
|
@ -11,17 +13,17 @@ registerBuildHook () {
|
|||
# Dummy post-build-hook just to ensure that it's executed correctly.
|
||||
# (we can't reuse the one from `$PWD/push-to-store.sh` because of
|
||||
# https://github.com/NixOS/nix/issues/4341)
|
||||
cat <<EOF > $TEST_ROOT/post-build-hook.sh
|
||||
cat <<EOF > "$TEST_ROOT/post-build-hook.sh"
|
||||
#!/bin/sh
|
||||
|
||||
echo "Post hook ran successfully"
|
||||
# Add an empty line to a counter file, just to check that this hook ran properly
|
||||
echo "" >> $TEST_ROOT/post-hook-counter
|
||||
EOF
|
||||
chmod +x $TEST_ROOT/post-build-hook.sh
|
||||
rm -f $TEST_ROOT/post-hook-counter
|
||||
chmod +x "$TEST_ROOT/post-build-hook.sh"
|
||||
rm -f "$TEST_ROOT/post-hook-counter"
|
||||
|
||||
echo "post-build-hook = $TEST_ROOT/post-build-hook.sh" >> $NIX_CONF_DIR/nix.conf
|
||||
echo "post-build-hook = $TEST_ROOT/post-build-hook.sh" >> "$NIX_CONF_DIR/nix.conf"
|
||||
}
|
||||
|
||||
registerBuildHook
|
||||
|
@ -30,4 +32,4 @@ source build-remote.sh
|
|||
# `build-hook.nix` has four derivations to build, and the hook runs twice for
|
||||
# each derivation (once on the builder and once on the host), so the counter
|
||||
# should contain eight lines now
|
||||
[[ $(cat $TEST_ROOT/post-hook-counter | wc -l) -eq 8 ]]
|
||||
[[ $(wc -l < "$TEST_ROOT/post-hook-counter") -eq 8 ]]
|
||||
|
|
|
@ -1,2 +1,7 @@
|
|||
outPath=$(readlink -f $TEST_ROOT/result)
|
||||
grep 'FOO BAR BAZ' ${remoteDir}/${outPath}
|
||||
# shellcheck shell=bash
|
||||
|
||||
# Variables must be defined by caller, so
|
||||
# shellcheck disable=SC2154
|
||||
|
||||
outPath=$(readlink -f "$TEST_ROOT/result")
|
||||
grep 'FOO BAR BAZ' "${remoteDir}/${outPath}"
|
||||
|
|
6
tests/functional/build-remote-trustless-should-fail-0.sh
Normal file → Executable file
6
tests/functional/build-remote-trustless-should-fail-0.sh
Normal file → Executable file
|
@ -1,3 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
source common.sh
|
||||
|
||||
enableFeatures "daemon-trust-override"
|
||||
|
@ -22,8 +24,12 @@ nix-build build-hook.nix -A passthru.input2 \
|
|||
# copy our already-build `input2` to the remote store. That store object
|
||||
# is input-addressed, so this will fail.
|
||||
|
||||
# For script below
|
||||
# shellcheck disable=SC2034
|
||||
file=build-hook.nix
|
||||
# shellcheck disable=SC2034
|
||||
prog=$(readlink -e ./nix-daemon-untrusting.sh)
|
||||
# shellcheck disable=SC2034
|
||||
proto=ssh-ng
|
||||
|
||||
expectStderr 1 source build-remote-trustless.sh \
|
||||
|
|
2
tests/functional/build-remote-trustless-should-pass-0.sh
Normal file → Executable file
2
tests/functional/build-remote-trustless-should-pass-0.sh
Normal file → Executable file
|
@ -1,3 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
source common.sh
|
||||
|
||||
# Remote trusts us
|
||||
|
|
2
tests/functional/build-remote-trustless-should-pass-1.sh
Normal file → Executable file
2
tests/functional/build-remote-trustless-should-pass-1.sh
Normal file → Executable file
|
@ -1,3 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
source common.sh
|
||||
|
||||
# Remote trusts us
|
||||
|
|
2
tests/functional/build-remote-trustless-should-pass-2.sh
Normal file → Executable file
2
tests/functional/build-remote-trustless-should-pass-2.sh
Normal file → Executable file
|
@ -1,3 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
source common.sh
|
||||
|
||||
enableFeatures "daemon-trust-override"
|
||||
|
|
2
tests/functional/build-remote-trustless-should-pass-3.sh
Normal file → Executable file
2
tests/functional/build-remote-trustless-should-pass-3.sh
Normal file → Executable file
|
@ -1,3 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
source common.sh
|
||||
|
||||
enableFeatures "daemon-trust-override"
|
||||
|
|
|
@ -1,5 +1,11 @@
|
|||
# shellcheck shell=bash
|
||||
|
||||
# All variables should be defined externally by the scripts that source
|
||||
# this, `set -u` will catch any that are forgotten.
|
||||
# shellcheck disable=SC2154
|
||||
|
||||
requireSandboxSupport
|
||||
[[ $busybox =~ busybox ]] || skipTest "no busybox"
|
||||
[[ "$busybox" =~ busybox ]] || skipTest "no busybox"
|
||||
|
||||
unset NIX_STORE_DIR
|
||||
unset NIX_STATE_DIR
|
||||
|
@ -8,7 +14,7 @@ remoteDir=$TEST_ROOT/remote
|
|||
|
||||
# Note: ssh{-ng}://localhost bypasses ssh. See tests/functional/build-remote.sh for
|
||||
# more details.
|
||||
nix-build $file -o $TEST_ROOT/result --max-jobs 0 \
|
||||
--arg busybox $busybox \
|
||||
--store $TEST_ROOT/local \
|
||||
nix-build "$file" -o "$TEST_ROOT/result" --max-jobs 0 \
|
||||
--arg busybox "$busybox" \
|
||||
--store "$TEST_ROOT/local" \
|
||||
--builders "$proto://localhost?remote-program=$prog&remote-store=${remoteDir}%3Fsystem-features=foo%20bar%20baz - - 1 1 foo,bar,baz"
|
||||
|
|
14
tests/functional/build-remote-with-mounted-ssh-ng.sh
Normal file → Executable file
14
tests/functional/build-remote-with-mounted-ssh-ng.sh
Normal file → Executable file
|
@ -1,3 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
source common.sh
|
||||
|
||||
requireSandboxSupport
|
||||
|
@ -6,17 +8,17 @@ requireSandboxSupport
|
|||
enableFeatures mounted-ssh-store
|
||||
|
||||
nix build -Lvf simple.nix \
|
||||
--arg busybox $busybox \
|
||||
--out-link $TEST_ROOT/result-from-remote \
|
||||
--arg busybox "$busybox" \
|
||||
--out-link "$TEST_ROOT/result-from-remote" \
|
||||
--store mounted-ssh-ng://localhost
|
||||
|
||||
nix build -Lvf simple.nix \
|
||||
--arg busybox $busybox \
|
||||
--out-link $TEST_ROOT/result-from-remote-new-cli \
|
||||
--arg busybox "$busybox" \
|
||||
--out-link "$TEST_ROOT/result-from-remote-new-cli" \
|
||||
--store 'mounted-ssh-ng://localhost?remote-program=nix daemon'
|
||||
|
||||
# This verifies that the out link was actually created and valid. The ability
|
||||
# to create out links (permanent gc roots) is the distinguishing feature of
|
||||
# the mounted-ssh-ng store.
|
||||
cat $TEST_ROOT/result-from-remote/hello | grepQuiet 'Hello World!'
|
||||
cat $TEST_ROOT/result-from-remote-new-cli/hello | grepQuiet 'Hello World!'
|
||||
grepQuiet 'Hello World!' < "$TEST_ROOT/result-from-remote/hello"
|
||||
grepQuiet 'Hello World!' < "$TEST_ROOT/result-from-remote-new-cli/hello"
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
# shellcheck shell=bash
|
||||
|
||||
: "${file?must be defined by caller (remote building test case using this)}"
|
||||
|
||||
requireSandboxSupport
|
||||
[[ $busybox =~ busybox ]] || skipTest "no busybox"
|
||||
[[ "${busybox-}" =~ busybox ]] || skipTest "no busybox"
|
||||
|
||||
# Avoid store dir being inside sandbox build-dir
|
||||
unset NIX_STORE_DIR
|
||||
|
@ -15,50 +19,50 @@ fi
|
|||
builders=(
|
||||
# system-features will automatically be added to the outer URL, but not inner
|
||||
# remote-store URL.
|
||||
"ssh://localhost?remote-store=$TEST_ROOT/machine1?system-features=$(join_by "%20" foo ${EXTRA_SYSTEM_FEATURES[@]}) - - 1 1 $(join_by "," foo ${EXTRA_SYSTEM_FEATURES[@]})"
|
||||
"$TEST_ROOT/machine2 - - 1 1 $(join_by "," bar ${EXTRA_SYSTEM_FEATURES[@]})"
|
||||
"ssh-ng://localhost?remote-store=$TEST_ROOT/machine3?system-features=$(join_by "%20" baz ${EXTRA_SYSTEM_FEATURES[@]}) - - 1 1 $(join_by "," baz ${EXTRA_SYSTEM_FEATURES[@]})"
|
||||
"ssh://localhost?remote-store=$TEST_ROOT/machine1?system-features=$(join_by "%20" foo "${EXTRA_SYSTEM_FEATURES[@]}") - - 1 1 $(join_by "," foo "${EXTRA_SYSTEM_FEATURES[@]}")"
|
||||
"$TEST_ROOT/machine2 - - 1 1 $(join_by "," bar "${EXTRA_SYSTEM_FEATURES[@]}")"
|
||||
"ssh-ng://localhost?remote-store=$TEST_ROOT/machine3?system-features=$(join_by "%20" baz "${EXTRA_SYSTEM_FEATURES[@]}") - - 1 1 $(join_by "," baz "${EXTRA_SYSTEM_FEATURES[@]}")"
|
||||
)
|
||||
|
||||
chmod -R +w $TEST_ROOT/machine* || true
|
||||
rm -rf $TEST_ROOT/machine* || true
|
||||
chmod -R +w "$TEST_ROOT/machine"* || true
|
||||
rm -rf "$TEST_ROOT/machine"* || true
|
||||
|
||||
# Note: ssh://localhost bypasses ssh, directly invoking nix-store as a
|
||||
# child process. This allows us to test LegacySSHStore::buildDerivation().
|
||||
# ssh-ng://... likewise allows us to test RemoteStore::buildDerivation().
|
||||
nix build -L -v -f $file -o $TEST_ROOT/result --max-jobs 0 \
|
||||
--arg busybox $busybox \
|
||||
--store $TEST_ROOT/machine0 \
|
||||
nix build -L -v -f "$file" -o "$TEST_ROOT/result" --max-jobs 0 \
|
||||
--arg busybox "$busybox" \
|
||||
--store "$TEST_ROOT/machine0" \
|
||||
--builders "$(join_by '; ' "${builders[@]}")"
|
||||
|
||||
outPath=$(readlink -f $TEST_ROOT/result)
|
||||
outPath=$(readlink -f "$TEST_ROOT/result")
|
||||
|
||||
grep 'FOO BAR BAZ' $TEST_ROOT/machine0/$outPath
|
||||
grep 'FOO BAR BAZ' "$TEST_ROOT/machine0/$outPath"
|
||||
|
||||
testPrintOutPath=$(nix build -L -v -f $file --no-link --print-out-paths --max-jobs 0 \
|
||||
--arg busybox $busybox \
|
||||
--store $TEST_ROOT/machine0 \
|
||||
testPrintOutPath=$(nix build -L -v -f "$file" --no-link --print-out-paths --max-jobs 0 \
|
||||
--arg busybox "$busybox" \
|
||||
--store "$TEST_ROOT/machine0" \
|
||||
--builders "$(join_by '; ' "${builders[@]}")"
|
||||
)
|
||||
|
||||
[[ $testPrintOutPath =~ store.*build-remote ]]
|
||||
|
||||
# Ensure that input1 was built on store1 due to the required feature.
|
||||
output=$(nix path-info --store $TEST_ROOT/machine1 --all)
|
||||
output=$(nix path-info --store "$TEST_ROOT/machine1" --all)
|
||||
echo "$output" | grepQuiet builder-build-remote-input-1.sh
|
||||
echo "$output" | grepQuietInverse builder-build-remote-input-2.sh
|
||||
echo "$output" | grepQuietInverse builder-build-remote-input-3.sh
|
||||
unset output
|
||||
|
||||
# Ensure that input2 was built on store2 due to the required feature.
|
||||
output=$(nix path-info --store $TEST_ROOT/machine2 --all)
|
||||
output=$(nix path-info --store "$TEST_ROOT/machine2" --all)
|
||||
echo "$output" | grepQuietInverse builder-build-remote-input-1.sh
|
||||
echo "$output" | grepQuiet builder-build-remote-input-2.sh
|
||||
echo "$output" | grepQuietInverse builder-build-remote-input-3.sh
|
||||
unset output
|
||||
|
||||
# Ensure that input3 was built on store3 due to the required feature.
|
||||
output=$(nix path-info --store $TEST_ROOT/machine3 --all)
|
||||
output=$(nix path-info --store "$TEST_ROOT/machine3" --all)
|
||||
echo "$output" | grepQuietInverse builder-build-remote-input-1.sh
|
||||
echo "$output" | grepQuietInverse builder-build-remote-input-2.sh
|
||||
echo "$output" | grepQuiet builder-build-remote-input-3.sh
|
||||
|
@ -66,7 +70,7 @@ unset output
|
|||
|
||||
|
||||
for i in input1 input3; do
|
||||
nix log --store $TEST_ROOT/machine0 --file "$file" --arg busybox $busybox passthru."$i" | grep hi-$i
|
||||
nix log --store "$TEST_ROOT/machine0" --file "$file" --arg busybox "$busybox" "passthru.$i" | grep hi-$i
|
||||
done
|
||||
|
||||
# Behavior of keep-failed
|
||||
|
@ -74,9 +78,9 @@ out="$(nix-build 2>&1 failing.nix \
|
|||
--no-out-link \
|
||||
--builders "$(join_by '; ' "${builders[@]}")" \
|
||||
--keep-failed \
|
||||
--store $TEST_ROOT/machine0 \
|
||||
--store "$TEST_ROOT/machine0" \
|
||||
-j0 \
|
||||
--arg busybox $busybox)" || true
|
||||
--arg busybox "$busybox")" || true
|
||||
|
||||
[[ "$out" =~ .*"note: keeping build directory".* ]]
|
||||
|
||||
|
|
42
tests/functional/build.sh
Normal file → Executable file
42
tests/functional/build.sh
Normal file → Executable file
|
@ -1,3 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
source common.sh
|
||||
|
||||
clearStore
|
||||
|
@ -43,6 +45,14 @@ nix build -f multiple-outputs.nix --json e --no-link | jq --exit-status '
|
|||
(.outputs | keys == ["a_a", "b"]))
|
||||
'
|
||||
|
||||
# Tests that we can handle empty 'outputsToInstall' (assuming that default
|
||||
# output "out" exists).
|
||||
nix build -f multiple-outputs.nix --json nothing-to-install --no-link | jq --exit-status '
|
||||
(.[0] |
|
||||
(.drvPath | match(".*nothing-to-install.drv")) and
|
||||
(.outputs | keys == ["out"]))
|
||||
'
|
||||
|
||||
# But not when it's overriden.
|
||||
nix build -f multiple-outputs.nix --json e^a_a --no-link
|
||||
nix build -f multiple-outputs.nix --json e^a_a --no-link | jq --exit-status '
|
||||
|
@ -133,3 +143,35 @@ nix build --impure -f multiple-outputs.nix --json e --no-link | jq --exit-status
|
|||
# Make sure that `--stdin` works and does not apply any defaults
|
||||
printf "" | nix build --no-link --stdin --json | jq --exit-status '. == []'
|
||||
printf "%s\n" "$drv^*" | nix build --no-link --stdin --json | jq --exit-status '.[0]|has("drvPath")'
|
||||
|
||||
# --keep-going and FOD
|
||||
out="$(nix build -f fod-failing.nix -L 2>&1)" && status=0 || status=$?
|
||||
test "$status" = 1
|
||||
# one "hash mismatch" error, one "build of ... failed"
|
||||
test "$(<<<"$out" grep -E '^error:' | wc -l)" = 2
|
||||
<<<"$out" grepQuiet -E "hash mismatch in fixed-output derivation '.*-x1\\.drv'"
|
||||
<<<"$out" grepQuiet -vE "hash mismatch in fixed-output derivation '.*-x3\\.drv'"
|
||||
<<<"$out" grepQuiet -vE "hash mismatch in fixed-output derivation '.*-x2\\.drv'"
|
||||
<<<"$out" grepQuiet -E "error: build of '.*-x[1-4]\\.drv\\^out', '.*-x[1-4]\\.drv\\^out', '.*-x[1-4]\\.drv\\^out', '.*-x[1-4]\\.drv\\^out' failed"
|
||||
|
||||
out="$(nix build -f fod-failing.nix -L x1 x2 x3 --keep-going 2>&1)" && status=0 || status=$?
|
||||
test "$status" = 1
|
||||
# three "hash mismatch" errors - for each failing fod, one "build of ... failed"
|
||||
test "$(<<<"$out" grep -E '^error:' | wc -l)" = 4
|
||||
<<<"$out" grepQuiet -E "hash mismatch in fixed-output derivation '.*-x1\\.drv'"
|
||||
<<<"$out" grepQuiet -E "hash mismatch in fixed-output derivation '.*-x3\\.drv'"
|
||||
<<<"$out" grepQuiet -E "hash mismatch in fixed-output derivation '.*-x2\\.drv'"
|
||||
<<<"$out" grepQuiet -E "error: build of '.*-x[1-3]\\.drv\\^out', '.*-x[1-3]\\.drv\\^out', '.*-x[1-3]\\.drv\\^out' failed"
|
||||
|
||||
out="$(nix build -f fod-failing.nix -L x4 2>&1)" && status=0 || status=$?
|
||||
test "$status" = 1
|
||||
test "$(<<<"$out" grep -E '^error:' | wc -l)" = 2
|
||||
<<<"$out" grepQuiet -E "error: 1 dependencies of derivation '.*-x4\\.drv' failed to build"
|
||||
<<<"$out" grepQuiet -E "hash mismatch in fixed-output derivation '.*-x2\\.drv'"
|
||||
|
||||
out="$(nix build -f fod-failing.nix -L x4 --keep-going 2>&1)" && status=0 || status=$?
|
||||
test "$status" = 1
|
||||
test "$(<<<"$out" grep -E '^error:' | wc -l)" = 3
|
||||
<<<"$out" grepQuiet -E "error: 2 dependencies of derivation '.*-x4\\.drv' failed to build"
|
||||
<<<"$out" grepQuiet -vE "hash mismatch in fixed-output derivation '.*-x3\\.drv'"
|
||||
<<<"$out" grepQuiet -vE "hash mismatch in fixed-output derivation '.*-x2\\.drv'"
|
||||
|
|
2
tests/functional/case-hack.sh
Normal file → Executable file
2
tests/functional/case-hack.sh
Normal file → Executable file
|
@ -1,3 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
source common.sh
|
||||
|
||||
clearStore
|
||||
|
|
2
tests/functional/check-refs.sh
Normal file → Executable file
2
tests/functional/check-refs.sh
Normal file → Executable file
|
@ -1,3 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
source common.sh
|
||||
|
||||
clearStore
|
||||
|
|
2
tests/functional/check-reqs.sh
Normal file → Executable file
2
tests/functional/check-reqs.sh
Normal file → Executable file
|
@ -1,3 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
source common.sh
|
||||
|
||||
clearStore
|
||||
|
|
2
tests/functional/check.sh
Normal file → Executable file
2
tests/functional/check.sh
Normal file → Executable file
|
@ -1,3 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
source common.sh
|
||||
|
||||
# XXX: This shouldn’t be, but #4813 cause this test to fail
|
||||
|
|
2
tests/functional/chroot-store.sh
Normal file → Executable file
2
tests/functional/chroot-store.sh
Normal file → Executable file
|
@ -1,3 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
source common.sh
|
||||
|
||||
echo example > $TEST_ROOT/example.txt
|
||||
|
|
|
@ -1,10 +1,16 @@
|
|||
# shellcheck shell=bash
|
||||
|
||||
set -eu -o pipefail
|
||||
|
||||
if [[ -z "${COMMON_SH_SOURCED-}" ]]; then
|
||||
|
||||
COMMON_SH_SOURCED=1
|
||||
|
||||
source "$(readlink -f "$(dirname "${BASH_SOURCE[0]-$0}")")/common/vars-and-functions.sh"
|
||||
functionalTestsDir="$(readlink -f "$(dirname "${BASH_SOURCE[0]-$0}")")"
|
||||
|
||||
source "$functionalTestsDir/common/vars-and-functions.sh"
|
||||
source "$functionalTestsDir/common/init.sh"
|
||||
|
||||
if [[ -n "${NIX_DAEMON_PACKAGE:-}" ]]; then
|
||||
startDaemon
|
||||
fi
|
||||
|
|
|
@ -1,14 +1,15 @@
|
|||
# Don't start the daemon
|
||||
source common/vars-and-functions.sh
|
||||
# shellcheck shell=bash
|
||||
|
||||
test -n "$TEST_ROOT"
|
||||
if test -d "$TEST_ROOT"; then
|
||||
chmod -R u+rw "$TEST_ROOT"
|
||||
# We would delete any daemon socket, so let's stop the daemon first.
|
||||
killDaemon
|
||||
# We would delete any daemon socket, so let's stop the daemon first.
|
||||
killDaemon
|
||||
# Destroy the test directory that may have persisted from previous runs
|
||||
if [[ -e "$TEST_ROOT" ]]; then
|
||||
chmod -R u+w "$TEST_ROOT"
|
||||
rm -rf "$TEST_ROOT"
|
||||
fi
|
||||
mkdir "$TEST_ROOT"
|
||||
mkdir -p "$TEST_ROOT"
|
||||
mkdir "$TEST_HOME"
|
||||
|
||||
mkdir "$NIX_STORE_DIR"
|
||||
mkdir "$NIX_LOCALSTATE_DIR"
|
||||
|
@ -36,7 +37,7 @@ extra-experimental-features = flakes
|
|||
EOF
|
||||
|
||||
# Initialise the database.
|
||||
# The flag itself does nothing, but running the command touches the store
|
||||
nix-store --init
|
||||
|
||||
# Did anything happen?
|
||||
# Sanity check
|
||||
test -e "$NIX_STATE_DIR"/db/db.sqlite
|
15
tests/functional/common/subst-vars.sh.in
Normal file
15
tests/functional/common/subst-vars.sh.in
Normal file
|
@ -0,0 +1,15 @@
|
|||
# NOTE: instances of @variable@ are substituted as defined in /mk/templates.mk
|
||||
|
||||
export PATH=@bindir@:$PATH
|
||||
export coreutils=@coreutils@
|
||||
#lsof=@lsof@
|
||||
|
||||
export dot=@dot@
|
||||
export SHELL="@bash@"
|
||||
export PAGER=cat
|
||||
export busybox="@sandbox_shell@"
|
||||
|
||||
export version=@PACKAGE_VERSION@
|
||||
export system=@system@
|
||||
|
||||
export BUILD_SHARED_LIBS=@BUILD_SHARED_LIBS@
|
|
@ -1,3 +1,5 @@
|
|||
# NOTE: instances of @variable@ are substituted as defined in /mk/templates.mk
|
||||
|
||||
set -eu -o pipefail
|
||||
|
||||
if [[ -z "${COMMON_VARS_AND_FUNCTIONS_SH_SOURCED-}" ]]; then
|
||||
|
@ -6,6 +8,12 @@ COMMON_VARS_AND_FUNCTIONS_SH_SOURCED=1
|
|||
|
||||
set +x
|
||||
|
||||
commonDir="$(readlink -f "$(dirname "${BASH_SOURCE[0]-$0}")")"
|
||||
|
||||
source "$commonDir/subst-vars.sh"
|
||||
# Make sure shellcheck knows all these will be defined by the above generated snippet
|
||||
: "${PATH?} ${coreutils?} ${dot?} ${SHELL?} ${PAGER?} ${busybox?} ${version?} ${system?} ${BUILD_SHARED_LIBS?}"
|
||||
|
||||
export TEST_ROOT=$(realpath ${TMPDIR:-/tmp}/nix-test)/${TEST_NAME:-default/tests\/functional//}
|
||||
export NIX_STORE_DIR
|
||||
if ! NIX_STORE_DIR=$(readlink -f $TEST_ROOT/store 2> /dev/null); then
|
||||
|
@ -34,9 +42,7 @@ unset XDG_DATA_HOME
|
|||
unset XDG_CONFIG_HOME
|
||||
unset XDG_CONFIG_DIRS
|
||||
unset XDG_CACHE_HOME
|
||||
mkdir -p $TEST_HOME
|
||||
|
||||
export PATH=@bindir@:$PATH
|
||||
if [[ -n "${NIX_CLIENT_PACKAGE:-}" ]]; then
|
||||
export PATH="$NIX_CLIENT_PACKAGE/bin":$PATH
|
||||
fi
|
||||
|
@ -44,18 +50,6 @@ DAEMON_PATH="$PATH"
|
|||
if [[ -n "${NIX_DAEMON_PACKAGE:-}" ]]; then
|
||||
DAEMON_PATH="${NIX_DAEMON_PACKAGE}/bin:$DAEMON_PATH"
|
||||
fi
|
||||
coreutils=@coreutils@
|
||||
lsof=@lsof@
|
||||
|
||||
export dot=@dot@
|
||||
export SHELL="@bash@"
|
||||
export PAGER=cat
|
||||
export busybox="@sandbox_shell@"
|
||||
|
||||
export version=@PACKAGE_VERSION@
|
||||
export system=@system@
|
||||
|
||||
export BUILD_SHARED_LIBS=@BUILD_SHARED_LIBS@
|
||||
|
||||
export IMPURE_VAR1=foo
|
||||
export IMPURE_VAR2=bar
|
2
tests/functional/completions.sh
Normal file → Executable file
2
tests/functional/completions.sh
Normal file → Executable file
|
@ -1,3 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
source common.sh
|
||||
|
||||
cd "$TEST_ROOT"
|
||||
|
|
2
tests/functional/compression-levels.sh
Normal file → Executable file
2
tests/functional/compression-levels.sh
Normal file → Executable file
|
@ -1,3 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
source common.sh
|
||||
|
||||
clearStore
|
||||
|
|
2
tests/functional/compute-levels.sh
Normal file → Executable file
2
tests/functional/compute-levels.sh
Normal file → Executable file
|
@ -1,3 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
source common.sh
|
||||
|
||||
if [[ $(uname -ms) = "Linux x86_64" ]]; then
|
||||
|
|
2
tests/functional/config.sh
Normal file → Executable file
2
tests/functional/config.sh
Normal file → Executable file
|
@ -1,3 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
source common.sh
|
||||
|
||||
# Isolate the home for this test.
|
||||
|
|
2
tests/functional/db-migration.sh
Normal file → Executable file
2
tests/functional/db-migration.sh
Normal file → Executable file
|
@ -1,3 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Test that we can successfully migrate from an older db schema
|
||||
|
||||
source common.sh
|
||||
|
|
2
tests/functional/debugger.sh
Normal file → Executable file
2
tests/functional/debugger.sh
Normal file → Executable file
|
@ -1,3 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
source common.sh
|
||||
|
||||
clearStore
|
||||
|
|
2
tests/functional/dependencies.sh
Normal file → Executable file
2
tests/functional/dependencies.sh
Normal file → Executable file
|
@ -1,3 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
source common.sh
|
||||
|
||||
clearStore
|
||||
|
|
2
tests/functional/derivation-json.sh
Normal file → Executable file
2
tests/functional/derivation-json.sh
Normal file → Executable file
|
@ -1,3 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
source common.sh
|
||||
|
||||
drvPath=$(nix-instantiate simple.nix)
|
||||
|
|
2
tests/functional/dump-db.sh
Normal file → Executable file
2
tests/functional/dump-db.sh
Normal file → Executable file
|
@ -1,3 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
source common.sh
|
||||
|
||||
needLocalStore "--dump-db requires a local store"
|
||||
|
|
2
tests/functional/eval-store.sh
Normal file → Executable file
2
tests/functional/eval-store.sh
Normal file → Executable file
|
@ -1,3 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
source common.sh
|
||||
|
||||
# Using `--eval-store` with the daemon will eventually copy everything
|
||||
|
|
6
tests/functional/eval.sh
Normal file → Executable file
6
tests/functional/eval.sh
Normal file → Executable file
|
@ -1,3 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
source common.sh
|
||||
|
||||
clearStore
|
||||
|
@ -52,3 +54,7 @@ fi
|
|||
|
||||
# Test --arg-from-stdin.
|
||||
[[ "$(echo bla | nix eval --raw --arg-from-stdin foo --expr '{ foo }: { inherit foo; }' foo)" = bla ]]
|
||||
|
||||
# Test that unknown settings are warned about
|
||||
out="$(expectStderr 0 nix eval --option foobar baz --expr '""' --raw)"
|
||||
[[ "$(echo "$out" | grep foobar | wc -l)" = 1 ]]
|
||||
|
|
2
tests/functional/experimental-features.sh
Normal file → Executable file
2
tests/functional/experimental-features.sh
Normal file → Executable file
|
@ -1,3 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
source common.sh
|
||||
|
||||
# Skipping these two for now, because we actually *do* want flags and
|
||||
|
|
2
tests/functional/export-graph.sh
Normal file → Executable file
2
tests/functional/export-graph.sh
Normal file → Executable file
|
@ -1,3 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
source common.sh
|
||||
|
||||
clearStore
|
||||
|
|
2
tests/functional/export.sh
Normal file → Executable file
2
tests/functional/export.sh
Normal file → Executable file
|
@ -1,3 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
source common.sh
|
||||
|
||||
clearStore
|
||||
|
|
2
tests/functional/extra-sandbox-profile.sh
Normal file → Executable file
2
tests/functional/extra-sandbox-profile.sh
Normal file → Executable file
|
@ -1,3 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
source common.sh
|
||||
|
||||
if [[ $(uname) != Darwin ]]; then skipTest "Need Darwin"; fi
|
||||
|
|
2
tests/functional/fetchClosure.sh
Normal file → Executable file
2
tests/functional/fetchClosure.sh
Normal file → Executable file
|
@ -1,3 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
source common.sh
|
||||
|
||||
enableFeatures "fetch-closure"
|
||||
|
|
2
tests/functional/fetchGit.sh
Normal file → Executable file
2
tests/functional/fetchGit.sh
Normal file → Executable file
|
@ -1,3 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
source common.sh
|
||||
|
||||
requireGit
|
||||
|
|
2
tests/functional/fetchGitRefs.sh
Normal file → Executable file
2
tests/functional/fetchGitRefs.sh
Normal file → Executable file
|
@ -1,3 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
source common.sh
|
||||
|
||||
requireGit
|
||||
|
|
2
tests/functional/fetchGitSubmodules.sh
Normal file → Executable file
2
tests/functional/fetchGitSubmodules.sh
Normal file → Executable file
|
@ -1,3 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
source common.sh
|
||||
|
||||
set -u
|
||||
|
|
2
tests/functional/fetchGitVerification.sh
Normal file → Executable file
2
tests/functional/fetchGitVerification.sh
Normal file → Executable file
|
@ -1,3 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
source common.sh
|
||||
|
||||
requireGit
|
||||
|
|
2
tests/functional/fetchMercurial.sh
Normal file → Executable file
2
tests/functional/fetchMercurial.sh
Normal file → Executable file
|
@ -1,3 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
source common.sh
|
||||
|
||||
[[ $(type -p hg) ]] || skipTest "Mercurial not installed"
|
||||
|
|
2
tests/functional/fetchPath.sh
Normal file → Executable file
2
tests/functional/fetchPath.sh
Normal file → Executable file
|
@ -1,3 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
source common.sh
|
||||
|
||||
touch $TEST_ROOT/foo -t 202211111111
|
||||
|
|
2
tests/functional/fetchTree-file.sh
Normal file → Executable file
2
tests/functional/fetchTree-file.sh
Normal file → Executable file
|
@ -1,3 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
source common.sh
|
||||
|
||||
clearStore
|
||||
|
|
2
tests/functional/fetchurl.sh
Normal file → Executable file
2
tests/functional/fetchurl.sh
Normal file → Executable file
|
@ -1,3 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
source common.sh
|
||||
|
||||
clearStore
|
||||
|
|
2
tests/functional/filter-source.sh
Normal file → Executable file
2
tests/functional/filter-source.sh
Normal file → Executable file
|
@ -1,3 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
source common.sh
|
||||
|
||||
rm -rf $TEST_ROOT/filterin
|
||||
|
|
2
tests/functional/fixed.sh
Normal file → Executable file
2
tests/functional/fixed.sh
Normal file → Executable file
|
@ -1,3 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
source common.sh
|
||||
|
||||
clearStore
|
||||
|
|
2
tests/functional/flakes/absolute-attr-paths.sh
Normal file → Executable file
2
tests/functional/flakes/absolute-attr-paths.sh
Normal file → Executable file
|
@ -1,3 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
source ./common.sh
|
||||
|
||||
flake1Dir=$TEST_ROOT/flake1
|
||||
|
|
2
tests/functional/flakes/absolute-paths.sh
Normal file → Executable file
2
tests/functional/flakes/absolute-paths.sh
Normal file → Executable file
|
@ -1,3 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
source ./common.sh
|
||||
|
||||
requireGit
|
||||
|
|
2
tests/functional/flakes/build-paths.sh
Normal file → Executable file
2
tests/functional/flakes/build-paths.sh
Normal file → Executable file
|
@ -1,3 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
source ./common.sh
|
||||
|
||||
flake1Dir=$TEST_ROOT/flake1
|
||||
|
|
2
tests/functional/flakes/bundle.sh
Normal file → Executable file
2
tests/functional/flakes/bundle.sh
Normal file → Executable file
|
@ -1,3 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
source common.sh
|
||||
|
||||
cp ../simple.nix ../simple.builder.sh ../config.nix $TEST_HOME
|
||||
|
|
2
tests/functional/flakes/check.sh
Normal file → Executable file
2
tests/functional/flakes/check.sh
Normal file → Executable file
|
@ -1,3 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
source common.sh
|
||||
|
||||
flakeDir=$TEST_ROOT/flake3
|
||||
|
|
2
tests/functional/flakes/circular.sh
Normal file → Executable file
2
tests/functional/flakes/circular.sh
Normal file → Executable file
|
@ -1,3 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Test circular flake dependencies.
|
||||
source ./common.sh
|
||||
|
||||
|
|
2
tests/functional/flakes/config.sh
Normal file → Executable file
2
tests/functional/flakes/config.sh
Normal file → Executable file
|
@ -1,3 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
source common.sh
|
||||
|
||||
cp ../simple.nix ../simple.builder.sh ../config.nix $TEST_HOME
|
||||
|
|
2
tests/functional/flakes/develop.sh
Normal file → Executable file
2
tests/functional/flakes/develop.sh
Normal file → Executable file
|
@ -1,3 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
source ../common.sh
|
||||
|
||||
clearStore
|
||||
|
|
13
tests/functional/flakes/edit.sh
Executable file
13
tests/functional/flakes/edit.sh
Executable file
|
@ -0,0 +1,13 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
source ./common.sh
|
||||
|
||||
requireGit
|
||||
|
||||
flake1Dir=$TEST_ROOT/flake1
|
||||
|
||||
createGitRepo "$flake1Dir"
|
||||
createSimpleGitFlake "$flake1Dir"
|
||||
|
||||
export EDITOR=cat
|
||||
nix edit "$flake1Dir#" | grepQuiet simple.builder.sh
|
22
tests/functional/flakes/eval-cache.sh
Normal file
22
tests/functional/flakes/eval-cache.sh
Normal file
|
@ -0,0 +1,22 @@
|
|||
source ./common.sh
|
||||
|
||||
requireGit
|
||||
|
||||
flake1Dir="$TEST_ROOT/eval-cache-flake"
|
||||
|
||||
createGitRepo "$flake1Dir" ""
|
||||
|
||||
cat >"$flake1Dir/flake.nix" <<EOF
|
||||
{
|
||||
description = "Fnord";
|
||||
outputs = { self }: {
|
||||
foo.bar = throw "breaks";
|
||||
};
|
||||
}
|
||||
EOF
|
||||
|
||||
git -C "$flake1Dir" add flake.nix
|
||||
git -C "$flake1Dir" commit -m "Init"
|
||||
|
||||
expect 1 nix build "$flake1Dir#foo.bar" 2>&1 | grepQuiet 'error: breaks'
|
||||
expect 1 nix build "$flake1Dir#foo.bar" 2>&1 | grepQuiet 'error: breaks'
|
2
tests/functional/flakes/flake-in-submodule.sh
Normal file → Executable file
2
tests/functional/flakes/flake-in-submodule.sh
Normal file → Executable file
|
@ -1,3 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
source common.sh
|
||||
|
||||
# Tests that:
|
||||
|
|
2
tests/functional/flakes/flakes.sh
Normal file → Executable file
2
tests/functional/flakes/flakes.sh
Normal file → Executable file
|
@ -1,3 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
source ./common.sh
|
||||
|
||||
requireGit
|
||||
|
|
2
tests/functional/flakes/follow-paths.sh
Normal file → Executable file
2
tests/functional/flakes/follow-paths.sh
Normal file → Executable file
|
@ -1,3 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
source ./common.sh
|
||||
|
||||
requireGit
|
||||
|
|
2
tests/functional/flakes/init.sh
Normal file → Executable file
2
tests/functional/flakes/init.sh
Normal file → Executable file
|
@ -1,3 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
source ./common.sh
|
||||
|
||||
requireGit
|
||||
|
|
2
tests/functional/flakes/inputs.sh
Normal file → Executable file
2
tests/functional/flakes/inputs.sh
Normal file → Executable file
|
@ -1,3 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
source ./common.sh
|
||||
|
||||
requireGit
|
||||
|
|
2
tests/functional/flakes/mercurial.sh
Normal file → Executable file
2
tests/functional/flakes/mercurial.sh
Normal file → Executable file
|
@ -1,3 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
source ./common.sh
|
||||
|
||||
[[ $(type -p hg) ]] || skipTest "Mercurial not installed"
|
||||
|
|
8
tests/functional/flakes/prefetch.sh
Executable file
8
tests/functional/flakes/prefetch.sh
Executable file
|
@ -0,0 +1,8 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
source common.sh
|
||||
|
||||
# Test symlinks in zip files (#10649).
|
||||
path=$(nix flake prefetch --json file://$(pwd)/tree.zip | jq -r .storePath)
|
||||
[[ $(cat $path/foo) = foo ]]
|
||||
[[ $(readlink $path/bar) = foo ]]
|
2
tests/functional/flakes/run.sh
Normal file → Executable file
2
tests/functional/flakes/run.sh
Normal file → Executable file
|
@ -1,3 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
source ../common.sh
|
||||
|
||||
clearStore
|
||||
|
|
2
tests/functional/flakes/search-root.sh
Normal file → Executable file
2
tests/functional/flakes/search-root.sh
Normal file → Executable file
|
@ -1,3 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
source common.sh
|
||||
|
||||
clearStore
|
||||
|
|
2
tests/functional/flakes/show.sh
Normal file → Executable file
2
tests/functional/flakes/show.sh
Normal file → Executable file
|
@ -1,3 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
source ./common.sh
|
||||
|
||||
flakeDir=$TEST_ROOT/flake
|
||||
|
|
BIN
tests/functional/flakes/tree.zip
Normal file
BIN
tests/functional/flakes/tree.zip
Normal file
Binary file not shown.
2
tests/functional/flakes/unlocked-override.sh
Normal file → Executable file
2
tests/functional/flakes/unlocked-override.sh
Normal file → Executable file
|
@ -1,3 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
source ./common.sh
|
||||
|
||||
requireGit
|
||||
|
|
2
tests/functional/fmt.sh
Normal file → Executable file
2
tests/functional/fmt.sh
Normal file → Executable file
|
@ -1,3 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
source common.sh
|
||||
|
||||
clearStore
|
||||
|
|
39
tests/functional/fod-failing.nix
Normal file
39
tests/functional/fod-failing.nix
Normal file
|
@ -0,0 +1,39 @@
|
|||
with import ./config.nix;
|
||||
rec {
|
||||
x1 = mkDerivation {
|
||||
name = "x1";
|
||||
builder = builtins.toFile "builder.sh"
|
||||
''
|
||||
echo $name > $out
|
||||
'';
|
||||
outputHashMode = "recursive";
|
||||
outputHash = "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=";
|
||||
};
|
||||
x2 = mkDerivation {
|
||||
name = "x2";
|
||||
builder = builtins.toFile "builder.sh"
|
||||
''
|
||||
echo $name > $out
|
||||
'';
|
||||
outputHashMode = "recursive";
|
||||
outputHash = "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=";
|
||||
};
|
||||
x3 = mkDerivation {
|
||||
name = "x3";
|
||||
builder = builtins.toFile "builder.sh"
|
||||
''
|
||||
echo $name > $out
|
||||
'';
|
||||
outputHashMode = "recursive";
|
||||
outputHash = "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=";
|
||||
};
|
||||
x4 = mkDerivation {
|
||||
name = "x4";
|
||||
inherit x2 x3;
|
||||
builder = builtins.toFile "builder.sh"
|
||||
''
|
||||
echo $x2 $x3
|
||||
exit 1
|
||||
'';
|
||||
};
|
||||
}
|
|
@ -1,3 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
source common.sh
|
||||
|
||||
set +x
|
||||
|
|
2
tests/functional/gc-auto.sh
Normal file → Executable file
2
tests/functional/gc-auto.sh
Normal file → Executable file
|
@ -1,3 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
source common.sh
|
||||
|
||||
needLocalStore "“min-free” and “max-free” are daemon options"
|
||||
|
|
2
tests/functional/gc-concurrent.sh
Normal file → Executable file
2
tests/functional/gc-concurrent.sh
Normal file → Executable file
|
@ -1,3 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
source common.sh
|
||||
|
||||
clearStore
|
||||
|
|
2
tests/functional/gc-non-blocking.sh
Normal file → Executable file
2
tests/functional/gc-non-blocking.sh
Normal file → Executable file
|
@ -1,3 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Test whether the collector is non-blocking, i.e. a build can run in
|
||||
# parallel with it.
|
||||
source common.sh
|
||||
|
|
2
tests/functional/gc-runtime.sh
Normal file → Executable file
2
tests/functional/gc-runtime.sh
Normal file → Executable file
|
@ -1,3 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
source common.sh
|
||||
|
||||
case $system in
|
||||
|
|
2
tests/functional/gc.sh
Normal file → Executable file
2
tests/functional/gc.sh
Normal file → Executable file
|
@ -1,3 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
source common.sh
|
||||
|
||||
clearStore
|
||||
|
|
2
tests/functional/hash-convert.sh
Normal file → Executable file
2
tests/functional/hash-convert.sh
Normal file → Executable file
|
@ -1,3 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
source common.sh
|
||||
|
||||
# Conversion with `nix hash` `nix-hash` and `nix hash convert`
|
||||
|
|
2
tests/functional/hash-path.sh
Normal file → Executable file
2
tests/functional/hash-path.sh
Normal file → Executable file
|
@ -1,3 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
source common.sh
|
||||
|
||||
try () {
|
||||
|
|
2
tests/functional/help.sh
Normal file → Executable file
2
tests/functional/help.sh
Normal file → Executable file
|
@ -1,3 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
source common.sh
|
||||
|
||||
clearStore
|
||||
|
|
2
tests/functional/import-derivation.sh
Normal file → Executable file
2
tests/functional/import-derivation.sh
Normal file → Executable file
|
@ -1,3 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
source common.sh
|
||||
|
||||
clearStore
|
||||
|
|
2
tests/functional/impure-derivations.sh
Normal file → Executable file
2
tests/functional/impure-derivations.sh
Normal file → Executable file
|
@ -1,3 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
source common.sh
|
||||
|
||||
requireDaemonNewerThan "2.8pre20220311"
|
||||
|
|
2
tests/functional/impure-env.sh
Normal file → Executable file
2
tests/functional/impure-env.sh
Normal file → Executable file
|
@ -1,3 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
source common.sh
|
||||
|
||||
# Needs the config option 'impure-env' to work
|
||||
|
|
2
tests/functional/impure-eval.sh
Normal file → Executable file
2
tests/functional/impure-eval.sh
Normal file → Executable file
|
@ -1,3 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
source common.sh
|
||||
|
||||
export REMOTE_STORE="dummy://"
|
||||
|
|
2
tests/functional/lang-test-infra.sh
Normal file → Executable file
2
tests/functional/lang-test-infra.sh
Normal file → Executable file
|
@ -1,3 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Test the function for lang.sh
|
||||
source common.sh
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
source common.sh
|
||||
|
||||
set -o pipefail
|
||||
|
@ -24,6 +26,9 @@ nix-instantiate --eval -E 'builtins.traceVerbose "Hello" 123' 2>&1 | grepQuietIn
|
|||
nix-instantiate --show-trace --eval -E 'builtins.addErrorContext "Hello" 123' 2>&1 | grepQuietInverse Hello
|
||||
expectStderr 1 nix-instantiate --show-trace --eval -E 'builtins.addErrorContext "Hello" (throw "Foo")' | grepQuiet Hello
|
||||
expectStderr 1 nix-instantiate --show-trace --eval -E 'builtins.addErrorContext "Hello %" (throw "Foo")' | grepQuiet 'Hello %'
|
||||
# Relies on parsing the expression derivation as a derivation, can't use --eval
|
||||
expectStderr 1 nix-instantiate --show-trace lang/non-eval-fail-bad-drvPath.nix | grepQuiet "store path '8qlfcic10lw5304gqm8q45nr7g7jl62b-cachix-1.7.3-bin' is not a valid derivation path"
|
||||
|
||||
|
||||
nix-instantiate --eval -E 'let x = builtins.trace { x = x; } true; in x' \
|
||||
2>&1 | grepQuiet -E 'trace: { x = «potential infinite recursion»; }'
|
||||
|
@ -72,7 +77,7 @@ for i in lang/eval-fail-*.nix; do
|
|||
if [[ -e "lang/$i.flags" ]]; then
|
||||
sed -e 's/#.*//' < "lang/$i.flags"
|
||||
else
|
||||
# note that show-trace is also set by init.sh
|
||||
# note that show-trace is also set by common/init.sh
|
||||
echo "--eval --strict --show-trace"
|
||||
fi
|
||||
)"
|
||||
|
|
14
tests/functional/lang/non-eval-fail-bad-drvPath.nix
Normal file
14
tests/functional/lang/non-eval-fail-bad-drvPath.nix
Normal file
|
@ -0,0 +1,14 @@
|
|||
let
|
||||
package = {
|
||||
type = "derivation";
|
||||
name = "cachix-1.7.3";
|
||||
system = builtins.currentSystem;
|
||||
outputs = [ "out" ];
|
||||
# Illegal, because does not end in `.drv`
|
||||
drvPath = "${builtins.storeDir}/8qlfcic10lw5304gqm8q45nr7g7jl62b-cachix-1.7.3-bin";
|
||||
outputName = "out";
|
||||
outPath = "${builtins.storeDir}/8qlfcic10lw5304gqm8q45nr7g7jl62b-cachix-1.7.3-bin";
|
||||
out = package;
|
||||
};
|
||||
in
|
||||
package
|
2
tests/functional/legacy-ssh-store.sh
Normal file → Executable file
2
tests/functional/legacy-ssh-store.sh
Normal file → Executable file
|
@ -1,3 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
source common.sh
|
||||
|
||||
store_uri="ssh://localhost?remote-store=$TEST_ROOT/other-store"
|
||||
|
|
2
tests/functional/linux-sandbox.sh
Normal file → Executable file
2
tests/functional/linux-sandbox.sh
Normal file → Executable file
|
@ -1,3 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
source common.sh
|
||||
|
||||
needLocalStore "the sandbox only runs on the builder side, so it makes no sense to test it with the daemon"
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
source common.sh
|
||||
source ../common/init.sh
|
||||
|
||||
requireEnvironment
|
||||
setupConfig
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
source common.sh
|
||||
source ../common/init.sh
|
||||
|
||||
requireEnvironment
|
||||
setupConfig
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
source common.sh
|
||||
source ../common/init.sh
|
||||
|
||||
requireEnvironment
|
||||
setupConfig
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue