diff options
Diffstat (limited to 'tests')
244 files changed, 0 insertions, 4058 deletions
diff --git a/tests/add.sh b/tests/add.sh deleted file mode 100644 index e26e05843d..0000000000 --- a/tests/add.sh +++ /dev/null @@ -1,28 +0,0 @@ -source common.sh - -path1=$(nix-store --add ./dummy) -echo $path1 - -path2=$(nix-store --add-fixed sha256 --recursive ./dummy) -echo $path2 - -if test "$path1" != "$path2"; then - echo "nix-store --add and --add-fixed mismatch" - exit 1 -fi - -path3=$(nix-store --add-fixed sha256 ./dummy) -echo $path3 -test "$path1" != "$path3" || exit 1 - -path4=$(nix-store --add-fixed sha1 --recursive ./dummy) -echo $path4 -test "$path1" != "$path4" || exit 1 - -hash1=$(nix-store -q --hash $path1) -echo $hash1 - -hash2=$(nix-hash --type sha256 --base32 ./dummy) -echo $hash2 - -test "$hash1" = "sha256:$hash2" diff --git a/tests/binary-cache.sh b/tests/binary-cache.sh deleted file mode 100644 index 6f0c36f630..0000000000 --- a/tests/binary-cache.sh +++ /dev/null @@ -1,89 +0,0 @@ -source common.sh - -clearStore -clearManifests -clearCache - -# Create the binary cache. -outPath=$(nix-build dependencies.nix --no-out-link) - -nix-push --dest $cacheDir $outPath - - -# By default, a binary cache doesn't support "nix-env -qas", but does -# support installation. -clearStore -rm -f $NIX_STATE_DIR/binary-cache* - -export _NIX_CACHE_FILE_URLS=1 - -nix-env --option binary-caches "file://$cacheDir" -f dependencies.nix -qas \* | grep -- "---" - -nix-store --option binary-caches "file://$cacheDir" -r $outPath - -[ -x $outPath/program ] - - -# But with the right configuration, "nix-env -qas" should also work. -clearStore -rm -f $NIX_STATE_DIR/binary-cache* -echo "WantMassQuery: 1" >> $cacheDir/nix-cache-info - -nix-env --option binary-caches "file://$cacheDir" -f dependencies.nix -qas \* | grep -- "--S" - -x=$(nix-env -f dependencies.nix -qas \* --prebuilt-only) -[ -z "$x" ] - -nix-store --option binary-caches "file://$cacheDir" -r $outPath - -nix-store --check-validity $outPath -nix-store -qR $outPath | grep input-2 - - -# Test whether Nix notices if the NAR doesn't match the hash in the NAR info. -clearStore - -nar=$(ls $cacheDir/*.nar.xz | head -n1) -mv $nar $nar.good -mkdir -p $TEST_ROOT/empty -nix-store --dump $TEST_ROOT/empty | xz > $nar - -nix-build --option binary-caches "file://$cacheDir" dependencies.nix -o $TEST_ROOT/result 2>&1 | tee $TEST_ROOT/log -grep -q "hash mismatch in downloaded path" $TEST_ROOT/log - -mv $nar.good $nar - - -# Test whether this unsigned cache is rejected if the user requires signed caches. -clearStore - -rm -f $NIX_STATE_DIR/binary-cache* - -if nix-store --option binary-caches "file://$cacheDir" --option signed-binary-caches '*' -r $outPath; then - echo "unsigned binary cache incorrectly accepted" - exit 1 -fi - - -# Test whether fallback works if we have cached info but the -# corresponding NAR has disappeared. -clearStore - -nix-build --option binary-caches "file://$cacheDir" dependencies.nix --dry-run # get info - -mkdir $cacheDir/tmp -mv $cacheDir/*.nar* $cacheDir/tmp/ - -NIX_DEBUG_SUBST=1 nix-build --option binary-caches "file://$cacheDir" dependencies.nix -o $TEST_ROOT/result --fallback - -mv $cacheDir/tmp/* $cacheDir/ - - -# Test whether building works if the binary cache contains an -# incomplete closure. -clearStore - -rm $(grep -l "StorePath:.*dependencies-input-2" $cacheDir/*.narinfo) - -nix-build --option binary-caches "file://$cacheDir" dependencies.nix -o $TEST_ROOT/result 2>&1 | tee $TEST_ROOT/log -grep -q "Downloading" $TEST_ROOT/log diff --git a/tests/binary-patching.nix b/tests/binary-patching.nix deleted file mode 100644 index 8ed474d1f2..0000000000 --- a/tests/binary-patching.nix +++ /dev/null @@ -1,18 +0,0 @@ -{ version }: - -with import ./config.nix; - -mkDerivation { - name = "foo-${toString version}"; - builder = builtins.toFile "builder.sh" - '' - mkdir $out - (for ((n = 1; n < 100000; n++)); do echo $n; done) > $out/foo - ${if version != 1 then '' - (for ((n = 100000; n < 110000; n++)); do echo $n; done) >> $out/foo - '' else ""} - ${if version == 3 then '' - echo foobar >> $out/foo - '' else ""} - ''; -} diff --git a/tests/binary-patching.sh b/tests/binary-patching.sh deleted file mode 100644 index 188be109a0..0000000000 --- a/tests/binary-patching.sh +++ /dev/null @@ -1,61 +0,0 @@ -source common.sh - -clearManifests - -mkdir -p $TEST_ROOT/cache2 $TEST_ROOT/patches - -RESULT=$TEST_ROOT/result - -# Build version 1 and 2 of the "foo" package. -nix-push --dest $TEST_ROOT/cache2 --manifest --bzip2 \ - $(nix-build -o $RESULT binary-patching.nix --arg version 1) -mv $TEST_ROOT/cache2/MANIFEST $TEST_ROOT/manifest1 - -out2=$(nix-build -o $RESULT binary-patching.nix --arg version 2) -nix-push --dest $TEST_ROOT/cache2 --manifest --bzip2 $out2 -mv $TEST_ROOT/cache2/MANIFEST $TEST_ROOT/manifest2 - -out3=$(nix-build -o $RESULT binary-patching.nix --arg version 3) -nix-push --dest $TEST_ROOT/cache2 --manifest --bzip2 $out3 -mv $TEST_ROOT/cache2/MANIFEST $TEST_ROOT/manifest3 - -rm $RESULT - -# Generate binary patches. -nix-generate-patches $TEST_ROOT/cache2 $TEST_ROOT/patches \ - file://$TEST_ROOT/patches $TEST_ROOT/manifest1 $TEST_ROOT/manifest2 - -nix-generate-patches $TEST_ROOT/cache2 $TEST_ROOT/patches \ - file://$TEST_ROOT/patches $TEST_ROOT/manifest2 $TEST_ROOT/manifest3 - -grep -q "patch {" $TEST_ROOT/manifest3 - -# Get rid of versions 2 and 3. -nix-store --delete $out2 $out3 - -# Pull the manifest containing the patches. -clearManifests -nix-pull file://$TEST_ROOT/manifest3 - -# Make sure that the download size prediction uses the patches rather -# than the full download. -nix-build -o $RESULT binary-patching.nix --arg version 3 --dry-run 2>&1 | grep -q "0.01 MiB" - -# Now rebuild it. This should use the two patches generated above. -rm -f $TEST_ROOT/var/log/nix/downloads -nix-build -o $RESULT binary-patching.nix --arg version 3 -rm $RESULT -[ "$(grep ' patch ' $TEST_ROOT/var/log/nix/downloads | wc -l)" -eq 2 ] - -# Add a patch from version 1 directly to version 3. -nix-generate-patches $TEST_ROOT/cache2 $TEST_ROOT/patches \ - file://$TEST_ROOT/patches $TEST_ROOT/manifest1 $TEST_ROOT/manifest3 - -# Rebuild version 3. This should use the direct patch rather than the -# sequence of two patches. -nix-store --delete $out2 $out3 -clearManifests -rm $TEST_ROOT/var/log/nix/downloads -nix-pull file://$TEST_ROOT/manifest3 -nix-build -o $RESULT binary-patching.nix --arg version 3 -[ "$(grep ' patch ' $TEST_ROOT/var/log/nix/downloads | wc -l)" -eq 1 ] diff --git a/tests/build-hook.hook.sh b/tests/build-hook.hook.sh deleted file mode 100755 index ff709985d3..0000000000 --- a/tests/build-hook.hook.sh +++ /dev/null @@ -1,23 +0,0 @@ -#! /bin/sh - -#set -x - -while read x y drv rest; do - - echo "HOOK for $drv" >&2 - - outPath=`sed 's/Derive(\[("out",\"\([^\"]*\)\".*/\1/' $drv` - - echo "output path is $outPath" >&2 - - if `echo $outPath | grep -q input-1`; then - echo "# accept" >&2 - read inputs - read outputs - mkdir $outPath - echo "BAR" > $outPath/foo - else - echo "# decline" >&2 - fi - -done \ No newline at end of file diff --git a/tests/build-hook.nix b/tests/build-hook.nix deleted file mode 100644 index 666cc6ef80..0000000000 --- a/tests/build-hook.nix +++ /dev/null @@ -1,22 +0,0 @@ -with import ./config.nix; - -let - - input1 = mkDerivation { - name = "build-hook-input-1"; - builder = ./dependencies.builder1.sh; - }; - - input2 = mkDerivation { - name = "build-hook-input-2"; - builder = ./dependencies.builder2.sh; - }; - -in - - mkDerivation { - name = "build-hook"; - builder = ./dependencies.builder0.sh; - input1 = " " + input1 + "/."; - input2 = " ${input2}/."; - } diff --git a/tests/build-hook.sh b/tests/build-hook.sh deleted file mode 100644 index 681f65cc3b..0000000000 --- a/tests/build-hook.sh +++ /dev/null @@ -1,10 +0,0 @@ -source common.sh - -export NIX_BUILD_HOOK="build-hook.hook.sh" - -outPath=$(nix-build build-hook.nix --no-out-link) - -echo "output path is $outPath" - -text=$(cat "$outPath"/foobar) -if test "$text" != "BARBAR"; then exit 1; fi diff --git a/tests/check-refs.nix b/tests/check-refs.nix deleted file mode 100644 index 63791fe160..0000000000 --- a/tests/check-refs.nix +++ /dev/null @@ -1,58 +0,0 @@ -with import ./config.nix; - -rec { - - dep = import ./dependencies.nix; - - makeTest = nr: args: mkDerivation ({ - name = "check-refs-" + toString nr; - } // args); - - src = builtins.toFile "aux-ref" "bla bla"; - - test1 = makeTest 1 { - builder = builtins.toFile "builder.sh" "mkdir $out; ln -s $dep $out/link"; - inherit dep; - }; - - test2 = makeTest 2 { - builder = builtins.toFile "builder.sh" "mkdir $out; ln -s ${src} $out/link"; - inherit dep; - }; - - test3 = makeTest 3 { - builder = builtins.toFile "builder.sh" "mkdir $out; ln -s $dep $out/link"; - allowedReferences = []; - inherit dep; - }; - - test4 = makeTest 4 { - builder = builtins.toFile "builder.sh" "mkdir $out; ln -s $dep $out/link"; - allowedReferences = [dep]; - inherit dep; - }; - - test5 = makeTest 5 { - builder = builtins.toFile "builder.sh" "mkdir $out"; - allowedReferences = []; - inherit dep; - }; - - test6 = makeTest 6 { - builder = builtins.toFile "builder.sh" "mkdir $out; ln -s $out $out/link"; - allowedReferences = []; - inherit dep; - }; - - test7 = makeTest 7 { - builder = builtins.toFile "builder.sh" "mkdir $out; ln -s $out $out/link"; - allowedReferences = ["out"]; - inherit dep; - }; - - test8 = makeTest 8 { - builder = builtins.toFile "builder.sh" "mkdir $out; ln -s ${test1} $out/link"; - inherit dep; - }; - -} diff --git a/tests/check-refs.sh b/tests/check-refs.sh deleted file mode 100644 index 08fe01ec18..0000000000 --- a/tests/check-refs.sh +++ /dev/null @@ -1,36 +0,0 @@ -source common.sh - -set -x - -RESULT=$TEST_ROOT/result - -dep=$(nix-build -o $RESULT check-refs.nix -A dep) - -# test1 references dep, not itself. -test1=$(nix-build -o $RESULT check-refs.nix -A test1) -! nix-store -q --references $test1 | grep -q $test1 -nix-store -q --references $test1 | grep -q $dep - -# test2 references src, not itself nor dep. -test2=$(nix-build -o $RESULT check-refs.nix -A test2) -! nix-store -q --references $test2 | grep -q $test2 -! nix-store -q --references $test2 | grep -q $dep -nix-store -q --references $test2 | grep -q aux-ref - -# test3 should fail (unallowed ref). -! nix-build -o $RESULT check-refs.nix -A test3 - -# test4 should succeed. -nix-build -o $RESULT check-refs.nix -A test4 - -# test5 should succeed. -nix-build -o $RESULT check-refs.nix -A test5 - -# test6 should fail (unallowed self-ref). -! nix-build -o $RESULT check-refs.nix -A test6 - -# test7 should succeed (allowed self-ref). -nix-build -o $RESULT check-refs.nix -A test7 - -# test8 should fail (toFile depending on derivation output). -! nix-build -o $RESULT check-refs.nix -A test8 diff --git a/tests/common.sh.in b/tests/common.sh.in deleted file mode 100644 index 48ca7d2ddd..0000000000 --- a/tests/common.sh.in +++ /dev/null @@ -1,89 +0,0 @@ -set -e - -datadir="@datadir@" - -export TEST_ROOT=$(pwd)/test-tmp -export NIX_STORE_DIR -if ! NIX_STORE_DIR=$(readlink -f $TEST_ROOT/store 2> /dev/null); then - # Maybe the build directory is symlinked. - export NIX_IGNORE_SYMLINK_STORE=1 - NIX_STORE_DIR=$TEST_ROOT/store -fi -export NIX_LOCALSTATE_DIR=$TEST_ROOT/var -export NIX_LOG_DIR=$TEST_ROOT/var/log/nix -export NIX_STATE_DIR=$TEST_ROOT/var/nix -export NIX_DB_DIR=$TEST_ROOT/db -export NIX_CONF_DIR=$TEST_ROOT/etc -export NIX_MANIFESTS_DIR=$TEST_ROOT/var/nix/manifests -export _NIX_TEST_SHARED=$TEST_ROOT/shared -export NIX_REMOTE=$NIX_REMOTE_ - -export PATH=@bindir@:$PATH - -export NIX_BUILD_HOOK= -export dot=@dot@ -export xmllint="@xmllint@" -export xsltproc="@xsltproc@" -export SHELL="@bash@" - -export version=@PACKAGE_VERSION@ -export system=@system@ - -cacheDir=$TEST_ROOT/binary-cache - -readLink() { - ls -l "$1" | sed 's/.*->\ //' -} - -clearProfiles() { - profiles="$NIX_STATE_DIR"/profiles - rm -rf $profiles -} - -clearStore() { - echo "clearing store..." - chmod -R +w "$NIX_STORE_DIR" - rm -rf "$NIX_STORE_DIR" - mkdir "$NIX_STORE_DIR" - rm -rf "$NIX_DB_DIR" - mkdir "$NIX_DB_DIR" - nix-store --init - clearProfiles - rm -f "$NIX_STATE_DIR"/gcroots/auto/* - rm -f "$NIX_STATE_DIR"/gcroots/ref -} - -clearManifests() { - rm -f $NIX_STATE_DIR/manifests/* -} - -clearCache() { - rm -rf "$cacheDir" -} - -startDaemon() { - # Start the daemon, wait for the socket to appear. !!! - # ‘nix-daemon’ should have an option to fork into the background. - rm -f $NIX_STATE_DIR/daemon-socket/socket - nix-daemon & - for ((i = 0; i < 30; i++)); do - if [ -e $NIX_STATE_DIR/daemon-socket/socket ]; then break; fi - sleep 1 - done - pidDaemon=$! - trap "kill -9 $pidDaemon" EXIT - export NIX_REMOTE=daemon -} - -killDaemon() { - kill -9 $pidDaemon - wait $pidDaemon || true - trap "" EXIT -} - -fail() { - echo "$1" - exit 1 -} - -set -x diff --git a/tests/config.nix b/tests/config.nix deleted file mode 100644 index 6244a15fa4..0000000000 --- a/tests/config.nix +++ /dev/null @@ -1,20 +0,0 @@ -with import <nix/config.nix>; - -rec { - inherit shell; - - path = coreutils; - - system = builtins.currentSystem; - - shared = builtins.getEnv "_NIX_TEST_SHARED"; - - mkDerivation = args: - derivation ({ - inherit system; - builder = shell; - args = ["-e" args.builder]; - PATH = path; - } // removeAttrs args ["builder" "meta"]) - // { meta = args.meta or {}; }; -} diff --git a/tests/dependencies.builder0.sh b/tests/dependencies.builder0.sh deleted file mode 100644 index c37bf909a5..0000000000 --- a/tests/dependencies.builder0.sh +++ /dev/null @@ -1,16 +0,0 @@ -[ "${input1: -2}" = /. ] -[ "${input2: -2}" = /. ] - -mkdir $out -echo $(cat $input1/foo)$(cat $input2/bar) > $out/foobar - -ln -s $input2 $out/input-2 - -# Self-reference. -ln -s $out $out/self - -# Executable. -echo program > $out/program -chmod +x $out/program - -echo FOO diff --git a/tests/dependencies.builder1.sh b/tests/dependencies.builder1.sh deleted file mode 100644 index 4b006a17d7..0000000000 --- a/tests/dependencies.builder1.sh +++ /dev/null @@ -1,2 +0,0 @@ -mkdir $out -echo FOO > $out/foo diff --git a/tests/dependencies.builder2.sh b/tests/dependencies.builder2.sh deleted file mode 100644 index 4f886fdb3a..0000000000 --- a/tests/dependencies.builder2.sh +++ /dev/null @@ -1,2 +0,0 @@ -mkdir $out -echo BAR > $out/bar diff --git a/tests/dependencies.nix b/tests/dependencies.nix deleted file mode 100644 index 687237add8..0000000000 --- a/tests/dependencies.nix +++ /dev/null @@ -1,23 +0,0 @@ -with import ./config.nix; - -let { - - input1 = mkDerivation { - name = "dependencies-input-1"; - builder = ./dependencies.builder1.sh; - }; - - input2 = mkDerivation { - name = "dependencies-input-2"; - builder = "${./dependencies.builder2.sh}"; - }; - - body = mkDerivation { - name = "dependencies"; - builder = ./dependencies.builder0.sh + "/FOOBAR/../."; - input1 = input1 + "/."; - input2 = "${input2}/."; - meta.description = "Random test package"; - }; - -} diff --git a/tests/dependencies.sh b/tests/dependencies.sh deleted file mode 100644 index df204d185d..0000000000 --- a/tests/dependencies.sh +++ /dev/null @@ -1,52 +0,0 @@ -source common.sh - -clearStore - -drvPath=$(nix-instantiate dependencies.nix) - -echo "derivation is $drvPath" - -nix-store -q --tree "$drvPath" | grep ' +---.*builder1.sh' - -# Test Graphviz graph generation. -nix-store -q --graph "$drvPath" > $TEST_ROOT/graph -if test -n "$dot"; then - # Does it parse? - $dot < $TEST_ROOT/graph -fi - -outPath=$(nix-store -rvv "$drvPath") || fail "build failed" - -# Test Graphviz graph generation. -nix-store -q --graph "$outPath" > $TEST_ROOT/graph -if test -n "$dot"; then - # Does it parse? - $dot < $TEST_ROOT/graph -fi - -nix-store -q --tree "$outPath" | grep '+---.*dependencies-input-2' - -echo "output path is $outPath" - -text=$(cat "$outPath"/foobar) -if test "$text" != "FOOBAR"; then exit 1; fi - -deps=$(nix-store -quR "$drvPath") - -echo "output closure contains $deps" - -# The output path should be in the closure. -echo "$deps" | grep -q "$outPath" - -# Input-1 is not retained. -if echo "$deps" | grep -q "dependencies-input-1"; then exit 1; fi - -# Input-2 is retained. -input2OutPath=$(echo "$deps" | grep "dependencies-input-2") - -# The referrers closure of input-2 should include outPath. -nix-store -q --referrers-closure "$input2OutPath" | grep "$outPath" - -# Check that the derivers are set properly. -test $(nix-store -q --deriver "$outPath") = "$drvPath" -nix-store -q --deriver "$input2OutPath" | grep -q -- "-input-2.drv" diff --git a/tests/dump-db.sh b/tests/dump-db.sh deleted file mode 100644 index 234b7ac026..0000000000 --- a/tests/dump-db.sh +++ /dev/null @@ -1,20 +0,0 @@ -source common.sh - -clearStore - -path=$(nix-build dependencies.nix -o $TEST_ROOT/result) - -deps="$(nix-store -qR $TEST_ROOT/result)" - -nix-store --dump-db > $TEST_ROOT/dump - -rm -rf $NIX_DB_DIR - -nix-store --load-db < $TEST_ROOT/dump - -deps2="$(nix-store -qR $TEST_ROOT/result)" - -[ "$deps" = "$deps2" ]; - -nix-store --dump-db > $TEST_ROOT/dump2 -cmp $TEST_ROOT/dump $TEST_ROOT/dump2 diff --git a/tests/export-graph.nix b/tests/export-graph.nix deleted file mode 100644 index fdac9583db..0000000000 --- a/tests/export-graph.nix +++ /dev/null @@ -1,29 +0,0 @@ -with import ./config.nix; - -rec { - - printRefs = - '' - echo $exportReferencesGraph - while read path; do - read drv - read nrRefs - echo "$path has $nrRefs references" - echo "$path" >> $out - for ((n = 0; n < $nrRefs; n++)); do read ref; echo "ref $ref"; test -e "$ref"; done - done < refs - ''; - - foo."bar.runtimeGraph" = mkDerivation { - name = "dependencies"; - builder = builtins.toFile "build-graph-builder" "${printRefs}"; - exportReferencesGraph = ["refs" (import ./dependencies.nix)]; - }; - - foo."bar.buildGraph" = mkDerivation { - name = "dependencies"; - builder = builtins.toFile "build-graph-builder" "${printRefs}"; - exportReferencesGraph = ["refs" (import ./dependencies.nix).drvPath]; - }; - -} diff --git a/tests/export-graph.sh b/tests/export-graph.sh deleted file mode 100644 index a6fd690544..0000000000 --- a/tests/export-graph.sh +++ /dev/null @@ -1,30 +0,0 @@ -source common.sh - -clearStore -clearProfiles - -checkRef() { - nix-store -q --references $TEST_ROOT/result | grep -q "$1" || fail "missing reference $1" -} - -# Test the export of the runtime dependency graph. - -outPath=$(nix-build ./export-graph.nix -A 'foo."bar.runtimeGraph"' -o $TEST_ROOT/result) - -test $(nix-store -q --references $TEST_ROOT/result | wc -l) = 2 || fail "bad nr of references" - -checkRef input-2 -for i in $(cat $outPath); do checkRef $i; done - -# Test the export of the build-time dependency graph. - -nix-store --gc # should force rebuild of input-1 - -outPath=$(nix-build ./export-graph.nix -A 'foo."bar.buildGraph"' -o $TEST_ROOT/result) - -checkRef input-1 -checkRef input-1.drv -checkRef input-2 -checkRef input-2.drv - -for i in $(cat $outPath); do checkRef $i; done diff --git a/tests/export.sh b/tests/export.sh deleted file mode 100644 index ec7560f197..0000000000 --- a/tests/export.sh +++ /dev/null @@ -1,31 +0,0 @@ -source common.sh - -clearStore - -outPath=$(nix-build dependencies.nix --no-out-link) - -nix-store --export $outPath > $TEST_ROOT/exp - -nix-store --export $(nix-store -qR $outPath) > $TEST_ROOT/exp_all - - -clearStore - -if nix-store --import < $TEST_ROOT/exp; then - echo "importing a non-closure should fail" - exit 1 -fi - - -clearStore - -nix-store --import < $TEST_ROOT/exp_all - -nix-store --export $(nix-store -qR $outPath) > $TEST_ROOT/exp_all2 - - -clearStore - -# Regression test: the derivers in exp_all2 are empty, which shouldn't -# cause a failure. -nix-store --import < $TEST_ROOT/exp_all2 diff --git a/tests/fallback.sh b/tests/fallback.sh deleted file mode 100644 index f3a6b50515..0000000000 --- a/tests/fallback.sh +++ /dev/null @@ -1,20 +0,0 @@ -source common.sh - -clearStore - -drvPath=$(nix-instantiate simple.nix) -echo "derivation is $drvPath" - -outPath=$(nix-store -q --fallback "$drvPath") -echo "output path is $outPath" - -# Build with a substitute that fails. This should fail. -export NIX_SUBSTITUTERS=$(pwd)/substituter2.sh -if nix-store -r "$drvPath"; then echo unexpected fallback; exit 1; fi - -# Build with a substitute that fails. This should fall back to a source build. -export NIX_SUBSTITUTERS=$(pwd)/substituter2.sh -nix-store -r --fallback "$drvPath" - -text=$(cat "$outPath"/hello) -if test "$text" != "Hello World!"; then exit 1; fi diff --git a/tests/fetchurl.nix b/tests/fetchurl.nix deleted file mode 100644 index 2abcc039a8..0000000000 --- a/tests/fetchurl.nix +++ /dev/null @@ -1,6 +0,0 @@ -{ filename, sha256 }: - -import <nix/fetchurl.nix> { - url = "file://${filename}"; - inherit sha256; -} diff --git a/tests/fetchurl.sh b/tests/fetchurl.sh deleted file mode 100644 index 6acc87eafc..0000000000 --- a/tests/fetchurl.sh +++ /dev/null @@ -1,9 +0,0 @@ -source common.sh - -clearStore - -hash=$(nix-hash --flat --type sha256 ./fetchurl.nix) - -outPath=$(nix-build ./fetchurl.nix --argstr filename $(pwd)/fetchurl.nix --argstr sha256 $hash --no-out-link) - -cmp $outPath fetchurl.nix diff --git a/tests/filter-source.nix b/tests/filter-source.nix deleted file mode 100644 index a620f0fda5..0000000000 --- a/tests/filter-source.nix +++ /dev/null @@ -1,12 +0,0 @@ -with import ./config.nix; - -mkDerivation { - name = "filter"; - builder = builtins.toFile "builder" "ln -s $input $out"; - input = - let filter = path: type: - type != "symlink" - && baseNameOf path != "foo" - && !((import ./lang/lib.nix).hasSuffix ".bak" (baseNameOf path)); - in builtins.filterSource filter ./test-tmp/filterin; -} diff --git a/tests/filter-source.sh b/tests/filter-source.sh deleted file mode 100644 index f7a096ed60..0000000000 --- a/tests/filter-source.sh +++ /dev/null @@ -1,20 +0,0 @@ -source common.sh - -rm -rf $TEST_ROOT/filterin -mkdir $TEST_ROOT/filterin -mkdir $TEST_ROOT/filterin/foo -touch $TEST_ROOT/filterin/foo/bar -touch $TEST_ROOT/filterin/xyzzy -touch $TEST_ROOT/filterin/b -touch $TEST_ROOT/filterin/bak -touch $TEST_ROOT/filterin/bla.c.bak -ln -s xyzzy $TEST_ROOT/filterin/link - -nix-build ./filter-source.nix -o $TEST_ROOT/filterout - -set -x -test ! -e $TEST_ROOT/filterout/foo/bar -test -e $TEST_ROOT/filterout/xyzzy -test -e $TEST_ROOT/filterout/bak -test ! -e $TEST_ROOT/filterout/bla.c.bak -test ! -L $TEST_ROOT/filterout/link diff --git a/tests/fixed.builder1.sh b/tests/fixed.builder1.sh deleted file mode 100644 index c41bb2b9a6..0000000000 --- a/tests/fixed.builder1.sh +++ /dev/null @@ -1,3 +0,0 @@ -if test "$IMPURE_VAR1" != "foo"; then exit 1; fi -if test "$IMPURE_VAR2" != "bar"; then exit 1; fi -echo "Hello World!" > $out diff --git a/tests/fixed.builder2.sh b/tests/fixed.builder2.sh deleted file mode 100644 index 31ea1579a5..0000000000 --- a/tests/fixed.builder2.sh +++ /dev/null @@ -1,6 +0,0 @@ -echo dummy: $dummy -if test -n "$dummy"; then sleep 2; fi -mkdir $out -mkdir $out/bla -echo "Hello World!" > $out/foo -ln -s foo $out/bar diff --git a/tests/fixed.nix b/tests/fixed.nix deleted file mode 100644 index 76580ffa19..0000000000 --- a/tests/fixed.nix +++ /dev/null @@ -1,50 +0,0 @@ -with import ./config.nix; - -rec { - - f2 = dummy: builder: mode: algo: hash: mkDerivation { - name = "fixed"; - inherit builder; - outputHashMode = mode; - outputHashAlgo = algo; - outputHash = hash; - inherit dummy; - impureEnvVars = ["IMPURE_VAR1" "IMPURE_VAR2"]; - }; - - f = f2 ""; - - good = [ - (f ./fixed.builder1.sh "flat" "md5" "8ddd8be4b179a529afa5f2ffae4b9858") - (f ./fixed.builder1.sh "flat" "sha1" "a0b65939670bc2c010f4d5d6a0b3e4e4590fb92b") - (f ./fixed.builder2.sh "recursive" "md5" "3670af73070fa14077ad74e0f5ea4e42") - (f ./fixed.builder2.sh "recursive" "sha1" "vw46m23bizj4n8afrc0fj19wrp7mj3c0") - ]; - - good2 = [ - # Yes, this looks fscked up: builder2 doesn't have that result. - # But Nix sees that an output with the desired hash already - # exists, and will refrain from building it. - (f ./fixed.builder2.sh "flat" "md5" "8ddd8be4b179a529afa5f2ffae4b9858") - ]; - - sameAsAdd = - f ./fixed.builder2.sh "recursive" "sha256" "1ixr6yd3297ciyp9im522dfxpqbkhcw0pylkb2aab915278fqaik"; - - bad = [ - (f ./fixed.builder1.sh "flat" "md5" "0ddd8be4b179a529afa5f2ffae4b9858") - ]; - - reallyBad = [ - # Hash too short, and not base-32 either. - (f ./fixed.builder1.sh "flat" "md5" "ddd8be4b179a529afa5f2ffae4b9858") - ]; - - # Test for building two derivations in parallel that produce the - # same output path because they're fixed-output derivations. - parallelSame = [ - (f2 "foo" ./fixed.builder2.sh "recursive" "md5" "3670af73070fa14077ad74e0f5ea4e42") - (f2 "bar" ./fixed.builder2.sh "recursive" "md5" "3670af73070fa14077ad74e0f5ea4e42") - ]; - -} diff --git a/tests/fixed.sh b/tests/fixed.sh deleted file mode 100644 index ed0d06dd29..0000000000 --- a/tests/fixed.sh +++ /dev/null @@ -1,52 +0,0 @@ -source common.sh - -clearStore - -export IMPURE_VAR1=foo -export IMPURE_VAR2=bar - -echo 'testing good...' -nix-build fixed.nix -A good --no-out-link - -echo 'testing good2...' -nix-build fixed.nix -A good2 --no-out-link - -echo 'testing bad...' -nix-build fixed.nix -A bad --no-out-link && fail "should fail" - -echo 'testing reallyBad...' -nix-instantiate fixed.nix -A reallyBad && fail "should fail" - -# While we're at it, check attribute selection a bit more. -echo 'testing attribute selection...' -test $(nix-instantiate fixed.nix -A good.1 | wc -l) = 1 - -# Test parallel builds of derivations that produce the same output. -# Only one should run at the same time. -echo 'testing parallelSame...' -clearStore -nix-build fixed.nix -A parallelSame --no-out-link -j2 - -# Fixed-output derivations with a recursive SHA-256 hash should -# produce the same path as "nix-store --add". -echo 'testing sameAsAdd...' -out=$(nix-build fixed.nix -A sameAsAdd --no-out-link) - -# This is what fixed.builder2 produces... -rm -rf $TEST_ROOT/fixed -mkdir $TEST_ROOT/fixed -mkdir $TEST_ROOT/fixed/bla -echo "Hello World!" > $TEST_ROOT/fixed/foo -ln -s foo $TEST_ROOT/fixed/bar - -out2=$(nix-store --add $TEST_ROOT/fixed) -echo $out2 -test "$out" = "$out2" || exit 1 - -out3=$(nix-store --add-fixed --recursive sha256 $TEST_ROOT/fixed) -echo $out3 -test "$out" = "$out3" || exit 1 - -out4=$(nix-store --print-fixed-path --recursive sha256 "1ixr6yd3297ciyp9im522dfxpqbkhcw0pylkb2aab915278fqaik" fixed) -echo $out4 -test "$out" = "$out4" || exit 1 diff --git a/tests/gc-concurrent.builder.sh b/tests/gc-concurrent.builder.sh deleted file mode 100644 index 0cd67df3ae..0000000000 --- a/tests/gc-concurrent.builder.sh +++ /dev/null @@ -1,13 +0,0 @@ -mkdir $out -echo $(cat $input1/foo)$(cat $input2/bar) > $out/foobar - -sleep 10 - -# $out should not have been GC'ed while we were sleeping, but just in -# case... -mkdir -p $out - -# Check that the GC hasn't deleted the lock on our output. -test -e "$out.lock" - -ln -s $input2 $out/input-2 diff --git a/tests/gc-concurrent.nix b/tests/gc-concurrent.nix deleted file mode 100644 index c0595cc471..0000000000 --- a/tests/gc-concurrent.nix +++ /dev/null @@ -1,27 +0,0 @@ -with import ./config.nix; - -rec { - - input1 = mkDerivation { - name = "dependencies-input-1"; - builder = ./dependencies.builder1.sh; - }; - - input2 = mkDerivation { - name = "dependencies-input-2"; - builder = ./dependencies.builder2.sh; - }; - - test1 = mkDerivation { - name = "gc-concurrent"; - builder = ./gc-concurrent.builder.sh; - inherit input1 input2; - }; - - test2 = mkDerivation { - name = "gc-concurrent2"; - builder = ./gc-concurrent2.builder.sh; - inherit input1 input2; - }; - -} diff --git a/tests/gc-concurrent.sh b/tests/gc-concurrent.sh deleted file mode 100644 index 0bc5a12d31..0000000000 --- a/tests/gc-concurrent.sh +++ /dev/null @@ -1,58 +0,0 @@ -source common.sh - -clearStore - -drvPath1=$(nix-instantiate gc-concurrent.nix -A test1) -outPath1=$(nix-store -q $drvPath1) - -drvPath2=$(nix-instantiate gc-concurrent.nix -A test2) -outPath2=$(nix-store -q $drvPath2) - -drvPath3=$(nix-instantiate simple.nix) -outPath3=$(nix-store -r $drvPath3) - -! test -e $outPath3.lock -touch $outPath3.lock - -rm -f "$NIX_STATE_DIR"/gcroots/foo* -ln -s $drvPath2 "$NIX_STATE_DIR"/gcroots/foo -ln -s $outPath3 "$NIX_STATE_DIR"/gcroots/foo2 - -# Start build #1 in the background. It starts immediately. -nix-store -rvv "$drvPath1" & -pid1=$! - -# Start build #2 in the background after 10 seconds. -(sleep 10 && nix-store -rvv "$drvPath2") & -pid2=$! - -# Run the garbage collector while the build is running. -sleep 6 -nix-collect-garbage - -# Wait for build #1/#2 to finish. -echo waiting for pid $pid1 to finish... -wait $pid1 -echo waiting for pid $pid2 to finish... -wait $pid2 - -# Check that the root of build #1 and its dependencies haven't been -# deleted. The should not be deleted by the GC because they were -# being built during the GC. -cat $outPath1/foobar -cat $outPath1/input-2/bar - -# Check that build #2 has succeeded. It should succeed because the -# derivation is a GC root. -cat $outPath2/foobar - -rm -f "$NIX_STATE_DIR"/gcroots/foo* - -# The collector should have deleted lock files for paths that have -# been built previously. -! test -e $outPath3.lock - -# If we run the collector now, it should delete outPath1/2. -nix-collect-garbage -! test -e $outPath1 -! test -e $outPath2 diff --git a/tests/gc-concurrent2.builder.sh b/tests/gc-concurrent2.builder.sh deleted file mode 100644 index 4bfb33103e..0000000000 --- a/tests/gc-concurrent2.builder.sh +++ /dev/null @@ -1,7 +0,0 @@ -mkdir $out -echo $(cat $input1/foo)$(cat $input2/bar)xyzzy > $out/foobar - -# Check that the GC hasn't deleted the lock on our output. -test -e "$out.lock" - -sleep 6 diff --git a/tests/gc-runtime.nix b/tests/gc-runtime.nix deleted file mode 100644 index ee5980bdff..0000000000 --- a/tests/gc-runtime.nix +++ /dev/null @@ -1,17 +0,0 @@ -with import ./config.nix; - -mkDerivation { - name = "gc-runtime"; - builder = - # Test inline source file definitions. - builtins.toFile "builder.sh" '' - mkdir $out - - cat > $out/program <<EOF - #! ${shell} - sleep 10000 - EOF - - chmod +x $out/program - ''; -} diff --git a/tests/gc-runtime.sh b/tests/gc-runtime.sh deleted file mode 100644 index a44195756f..0000000000 --- a/tests/gc-runtime.sh +++ /dev/null @@ -1,38 +0,0 @@ -source common.sh - -case $system in - *linux*) - ;; - *) - exit 0; -esac - -set -m # enable job control, needed for kill - -profiles="$NIX_STATE_DIR"/profiles -rm -f $profiles/* - -nix-env -p $profiles/test -f ./gc-runtime.nix -i gc-runtime - -outPath=$(nix-env -p $profiles/test -q --no-name --out-path gc-runtime) -echo $outPath - -echo "backgrounding program..." -$profiles/test/program & -sleep 2 # hack - wait for the program to get started -child=$! -echo PID=$child - -nix-env -p $profiles/test -e gc-runtime -nix-env -p $profiles/test --delete-generations old - -nix-store --gc - -kill -- -$child - -if ! test -e $outPath; then - echo "running program was garbage collected!" - exit 1 -fi - -exit 0 diff --git a/tests/gc.sh b/tests/gc.sh deleted file mode 100644 index 0adb05bf17..0000000000 --- a/tests/gc.sh +++ /dev/null @@ -1,40 +0,0 @@ -source common.sh - -drvPath=$(nix-instantiate dependencies.nix) -outPath=$(nix-store -rvv "$drvPath") - -# Set a GC root. -rm -f "$NIX_STATE_DIR"/gcroots/foo -ln -sf $outPath "$NIX_STATE_DIR"/gcroots/foo - -[ "$(nix-store -q --roots $outPath)" = "$NIX_STATE_DIR"/gcroots/foo ] - -nix-store --gc --print-roots | grep $outPath -nix-store --gc --print-live | grep $outPath -nix-store --gc --print-dead | grep $drvPath -if nix-store --gc --print-dead | grep $outPath; then false; fi - -nix-store --gc --print-dead - -inUse=$(readLink $outPath/input-2) -if nix-store --delete $inUse; then false; fi -test -e $inUse - -if nix-store --delete $outPath; then false; fi -test -e $outPath - -nix-collect-garbage - -# Check that the root and its dependencies haven't been deleted. -cat $outPath/foobar -cat $outPath/input-2/bar - -# Check that the derivation has been GC'd. -if test -e $drvPath; then false; fi - -rm "$NIX_STATE_DIR"/gcroots/foo - -nix-collect-garbage - -# Check that the output has been GC'd. -if test -e $outPath/foobar; then false; fi diff --git a/tests/hash-check.nix b/tests/hash-check.nix deleted file mode 100644 index 4a8e9b8a8d..0000000000 --- a/tests/hash-check.nix +++ /dev/null @@ -1,29 +0,0 @@ -let { - - input1 = derivation { - name = "dependencies-input-1"; - system = "i086-msdos"; - builder = "/bar/sh"; - args = ["-e" "-x" ./dummy]; - }; - - input2 = derivation { - name = "dependencies-input-2"; - system = "i086-msdos"; - builder = "/bar/sh"; - args = ["-e" "-x" ./dummy]; - outputHashMode = "recursive"; - outputHashAlgo = "md5"; - outputHash = "ffffffffffffffffffffffffffffffff"; - }; - - body = derivation { - name = "dependencies"; - system = "i086-msdos"; - builder = "/bar/sh"; - args = ["-e" "-x" (./dummy + "/FOOBAR/../.")]; - input1 = input1 + "/."; - inherit input2; - }; - -} \ No newline at end of file diff --git a/tests/hash.sh b/tests/hash.sh deleted file mode 100644 index d659bbe34e..0000000000 --- a/tests/hash.sh +++ /dev/null @@ -1,62 +0,0 @@ -source common.sh - -try () { - printf "%s" "$2" > $TEST_ROOT/vector - hash=$(nix-hash $EXTRA --flat --type "$1" $TEST_ROOT/vector) - if test "$hash" != "$3"; then - echo "hash $1, expected $3, got $hash" - exit 1 - fi -} - -try md5 "" "d41d8cd98f00b204e9800998ecf8427e" -try md5 "a" "0cc175b9c0f1b6a831c399e269772661" -try md5 "abc" "900150983cd24fb0d6963f7d28e17f72" -try md5 "message digest" "f96b697d7cb7938d525a2f31aaf161d0" -try md5 "abcdefghijklmnopqrstuvwxyz" "c3fcd3d76192e4007dfb496cca67e13b" -try md5 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" "d174ab98d277d9f5a5611c2c9f419d9f" -try md5 "12345678901234567890123456789012345678901234567890123456789012345678901234567890" "57edf4a22be3c955ac49da2e2107b67a" - -try sha1 "abc" "a9993e364706816aba3e25717850c26c9cd0d89d" -try sha1 "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq" "84983e441c3bd26ebaae4aa1f95129e5e54670f1" - -try sha256 "abc" "ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad" -try sha256 "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq" "248d6a61d20638b8e5c026930c3e6039a33ce45964ff2167f6ecedd419db06c1" - -EXTRA=--base32 -try sha256 "abc" "1b8m03r63zqhnjf7l5wnldhh7c134ap5vpj0850ymkq1iyzicy5s" -EXTRA= - -try2 () { - hash=$(nix-hash --type "$1" $TEST_ROOT/hash-path) - if test "$hash" != "$2"; then - echo "hash $1, expected $2, got $hash" - exit 1 - fi -} - -rm -rf $TEST_ROOT/hash-path -mkdir $TEST_ROOT/hash-path -echo "Hello World" > $TEST_ROOT/hash-path/hello - -try2 md5 "ea9b55537dd4c7e104515b2ccfaf4100" - -# Execute bit matters. -chmod +x $TEST_ROOT/hash-path/hello -try2 md5 "20f3ffe011d4cfa7d72bfabef7882836" - -# Mtime and other bits don't. -touch -r . $TEST_ROOT/hash-path/hello -chmod 744 $TEST_ROOT/hash-path/hello -try2 md5 "20f3ffe011d4cfa7d72bfabef7882836" - -# File type (e.g., symlink) does. -rm $TEST_ROOT/hash-path/hello -ln -s x $TEST_ROOT/hash-path/hello -try2 md5 "f78b733a68f5edbdf9413899339eaa4a" - -# Conversion. -test $(nix-hash --type sha256 --to-base32 "ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad") = "1b8m03r63zqhnjf7l5wnldhh7c134ap5vpj0850ymkq1iyzicy5s" -test $(nix-hash --type sha256 --to-base16 "1b8m03r63zqhnjf7l5wnldhh7c134ap5vpj0850ymkq1iyzicy5s") = "ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad" -test $(nix-hash --type sha1 --to-base32 "800d59cfcd3c05e900cb4e214be48f6b886a08df") = "vw46m23bizj4n8afrc0fj19wrp7mj3c0" -test $(nix-hash --type sha1 --to-base16 "vw46m23bizj4n8afrc0fj19wrp7mj3c0") = "800d59cfcd3c05e900cb4e214be48f6b886a08df" diff --git a/tests/import-derivation.nix b/tests/import-derivation.nix deleted file mode 100644 index 91adcd288f..0000000000 --- a/tests/import-derivation.nix +++ /dev/null @@ -1,23 +0,0 @@ -with import ./config.nix; - -let - - bar = mkDerivation { - name = "bar"; - builder = builtins.toFile "builder.sh" - '' - echo 'builtins.add 123 456' > $out - ''; - }; - - value = import bar; - -in - -mkDerivation { - name = "foo"; - builder = builtins.toFile "builder.sh" - '' - echo -n FOO${toString value} > $out - ''; -} diff --git a/tests/import-derivation.sh b/tests/import-derivation.sh deleted file mode 100644 index 98d61ef49b..0000000000 --- a/tests/import-derivation.sh +++ /dev/null @@ -1,12 +0,0 @@ -source common.sh - -clearStore - -if nix-instantiate --readonly-mode ./import-derivation.nix; then - echo "read-only evaluation of an imported derivation unexpectedly failed" - exit 1 -fi - -outPath=$(nix-build ./import-derivation.nix --no-out-link) - -[ "$(cat $outPath)" = FOO579 ] diff --git a/tests/init.sh b/tests/init.sh deleted file mode 100644 index 37480f52bd..0000000000 --- a/tests/init.sh +++ /dev/null @@ -1,32 +0,0 @@ -source common.sh - -echo "NIX_STORE_DIR=$NIX_STORE_DIR NIX_DB_DIR=$NIX_DB_DIR" - -test -n "$TEST_ROOT" -if test -d "$TEST_ROOT"; then - chmod -R u+w "$TEST_ROOT" - rm -rf "$TEST_ROOT" -fi -mkdir "$TEST_ROOT" - -mkdir "$NIX_STORE_DIR" -mkdir "$NIX_LOCALSTATE_DIR" -mkdir -p "$NIX_LOG_DIR"/drvs -mkdir "$NIX_STATE_DIR" -mkdir "$NIX_DB_DIR" -mkdir "$NIX_CONF_DIR" - -cat > "$NIX_CONF_DIR"/nix.conf <<EOF -gc-keep-outputs = false -gc-keep-derivations = false -env-keep-derivations = false -fsync-metadata = false -EOF - -# Initialise the database. -nix-store --init - -# Did anything happen? -test -e "$NIX_DB_DIR"/db.sqlite - -echo 'Hello World' > ./dummy diff --git a/tests/install-package.sh b/tests/install-package.sh deleted file mode 100644 index 653dfee4c8..0000000000 --- a/tests/install-package.sh +++ /dev/null @@ -1,21 +0,0 @@ -source common.sh - -# Note: this test expects to be run *after* nix-push.sh. - -drvPath=$(nix-instantiate ./dependencies.nix) -outPath=$(nix-store -q $drvPath) - -clearStore -clearProfiles - -cat > $TEST_ROOT/foo.nixpkg <<EOF -NIXPKG1 file://$TEST_ROOT/cache/MANIFEST simple $system $drvPath $outPath -EOF - -nix-install-package --non-interactive -p $profiles/test $TEST_ROOT/foo.nixpkg -test "$(nix-env -p $profiles/test -q '*' | wc -l)" -eq 1 - -clearProfiles - -nix-install-package --non-interactive -p $profiles/test --url file://$TEST_ROOT/foo.nixpkg -test "$(nix-env -p $profiles/test -q '*' | wc -l)" -eq 1 diff --git a/tests/lang.sh b/tests/lang.sh deleted file mode 100644 index bb3b9ca775..0000000000 --- a/tests/lang.sh +++ /dev/null @@ -1,70 +0,0 @@ -source common.sh - -export TEST_VAR=foo # for eval-okay-getenv.nix - -nix-instantiate --eval -E 'builtins.trace "Hello" 123' 2>&1 | grep -q Hello -! nix-instantiate --show-trace --eval -E 'builtins.addErrorContext "Hello" 123' 2>&1 | grep -q Hello -nix-instantiate --show-trace --eval -E 'builtins.addErrorContext "Hello" (throw "Foo")' 2>&1 | grep -q Hello - -set +x - -fail=0 - -for i in lang/parse-fail-*.nix; do - echo "parsing $i (should fail)"; - i=$(basename $i .nix) - if nix-instantiate --parse - < lang/$i.nix; then - echo "FAIL: $i shouldn't parse" - fail=1 - fi -done - -for i in lang/parse-okay-*.nix; do - echo "parsing $i (should succeed)"; - i=$(basename $i .nix) - if ! nix-instantiate --parse - < lang/$i.nix > lang/$i.out; then - echo "FAIL: $i should parse" - fail=1 - fi -done - -for i in lang/eval-fail-*.nix; do - echo "evaluating $i (should fail)"; - i=$(basename $i .nix) - if nix-instantiate --eval lang/$i.nix; then - echo "FAIL: $i shouldn't evaluate" - fail=1 - fi -done - -for i in lang/eval-okay-*.nix; do - echo "evaluating $i (should succeed)"; - i=$(basename $i .nix) - - if test -e lang/$i.exp; then - flags= - if test -e lang/$i.flags; then - flags=$(cat lang/$i.flags) - fi - if ! NIX_PATH=lang/dir3:lang/dir4_PATH nix-instantiate $flags --eval --strict lang/$i.nix > lang/$i.out; then - echo "FAIL: $i should evaluate" - fail=1 - elif ! diff lang/$i.out lang/$i.exp; then - echo "FAIL: evaluation result of $i not as expected" - fail=1 - fi - fi - - if test -e lang/$i.exp.xml; then - if ! nix-instantiate --eval --xml --no-location --strict \ - lang/$i.nix > lang/$i.out.xml; then - echo "FAIL: $i should evaluate" - fail=1 - elif ! cmp -s lang/$i.out.xml lang/$i.exp.xml; then - echo "FAIL: XML evaluation result of $i not as expected" - fail=1 - fi - fi -done - -exit $fail diff --git a/tests/lang/dir1/a.nix b/tests/lang/dir1/a.nix deleted file mode 100644 index 231f150c57..0000000000 --- a/tests/lang/dir1/a.nix +++ /dev/null @@ -1 +0,0 @@ -"a" diff --git a/tests/lang/dir2/a.nix b/tests/lang/dir2/a.nix deleted file mode 100644 index 170df520ab..0000000000 --- a/tests/lang/dir2/a.nix +++ /dev/null @@ -1 +0,0 @@ -"X" diff --git a/tests/lang/dir2/b.nix b/tests/lang/dir2/b.nix deleted file mode 100644 index 19010cc35c..0000000000 --- a/tests/lang/dir2/b.nix +++ /dev/null @@ -1 +0,0 @@ -"b" diff --git a/tests/lang/dir3/a.nix b/tests/lang/dir3/a.nix deleted file mode 100644 index 170df520ab..0000000000 --- a/tests/lang/dir3/a.nix +++ /dev/null @@ -1 +0,0 @@ -"X" diff --git a/tests/lang/dir3/b.nix b/tests/lang/dir3/b.nix deleted file mode 100644 index 170df520ab..0000000000 --- a/tests/lang/dir3/b.nix +++ /dev/null @@ -1 +0,0 @@ -"X" diff --git a/tests/lang/dir3/c.nix b/tests/lang/dir3/c.nix deleted file mode 100644 index cdf158597e..0000000000 --- a/tests/lang/dir3/c.nix +++ /dev/null @@ -1 +0,0 @@ -"c" diff --git a/tests/lang/dir4/a.nix b/tests/lang/dir4/a.nix deleted file mode 100644 index 170df520ab..0000000000 --- a/tests/lang/dir4/a.nix +++ /dev/null @@ -1 +0,0 @@ -"X" diff --git a/tests/lang/dir4/c.nix b/tests/lang/dir4/c.nix deleted file mode 100644 index 170df520ab..0000000000 --- a/tests/lang/dir4/c.nix +++ /dev/null @@ -1 +0,0 @@ -"X" diff --git a/tests/lang/eval-fail-abort.nix b/tests/lang/eval-fail-abort.nix deleted file mode 100644 index 75c51bceb5..0000000000 --- a/tests/lang/eval-fail-abort.nix +++ /dev/null @@ -1 +0,0 @@ -if true then abort "this should fail" else 1 diff --git a/tests/lang/eval-fail-antiquoted-path.nix b/tests/lang/eval-fail-antiquoted-path.nix deleted file mode 100644 index f2f08107b5..0000000000 --- a/tests/lang/eval-fail-antiquoted-path.nix +++ /dev/null @@ -1,4 +0,0 @@ -# This must fail to evaluate, since ./fnord doesn't exist. If it did -# exist, it would produce "/nix/store/<hash>-fnord/xyzzy" (with an -# appropriate context). -"${./fnord}/xyzzy" diff --git a/tests/lang/eval-fail-assert.nix b/tests/lang/eval-fail-assert.nix deleted file mode 100644 index 3b7a1e8bf0..0000000000 --- a/tests/lang/eval-fail-assert.nix +++ /dev/null @@ -1,5 +0,0 @@ -let { - x = arg: assert arg == "y"; 123; - - body = x "x"; -} \ No newline at end of file diff --git a/tests/lang/eval-fail-bad-antiquote-1.nix b/tests/lang/eval-fail-bad-antiquote-1.nix deleted file mode 100644 index ffe9c983c2..0000000000 --- a/tests/lang/eval-fail-bad-antiquote-1.nix +++ /dev/null @@ -1 +0,0 @@ -"${x: x}" diff --git a/tests/lang/eval-fail-bad-antiquote-2.nix b/tests/lang/eval-fail-bad-antiquote-2.nix deleted file mode 100644 index 3745235ce9..0000000000 --- a/tests/lang/eval-fail-bad-antiquote-2.nix +++ /dev/null @@ -1 +0,0 @@ -"${./fnord}" diff --git a/tests/lang/eval-fail-bad-antiquote-3.nix b/tests/lang/eval-fail-bad-antiquote-3.nix deleted file mode 100644 index 65b9d4f505..0000000000 --- a/tests/lang/eval-fail-bad-antiquote-3.nix +++ /dev/null @@ -1 +0,0 @@ -''${x: x}'' diff --git a/tests/lang/eval-fail-blackhole.nix b/tests/lang/eval-fail-blackhole.nix deleted file mode 100644 index 81133b511c..0000000000 --- a/tests/lang/eval-fail-blackhole.nix +++ /dev/null @@ -1,5 +0,0 @@ -let { - body = x; - x = y; - y = x; -} diff --git a/tests/lang/eval-fail-missing-arg.nix b/tests/lang/eval-fail-missing-arg.nix deleted file mode 100644 index c4be9797c5..0000000000 --- a/tests/lang/eval-fail-missing-arg.nix +++ /dev/null @@ -1 +0,0 @@ -({x, y, z}: x + y + z) {x = "foo"; z = "bar";} diff --git a/tests/lang/eval-fail-remove.nix b/tests/lang/eval-fail-remove.nix deleted file mode 100644 index 539e0eb0a6..0000000000 --- a/tests/lang/eval-fail-remove.nix +++ /dev/null @@ -1,5 +0,0 @@ -let { - attrs = {x = 123; y = 456;}; - - body = (removeAttrs attrs ["x"]).x; -} \ No newline at end of file diff --git a/tests/lang/eval-fail-scope-5.nix b/tests/lang/eval-fail-scope-5.nix deleted file mode 100644 index f89a65a99b..0000000000 --- a/tests/lang/eval-fail-scope-5.nix +++ /dev/null @@ -1,10 +0,0 @@ -let { - - x = "a"; - y = "b"; - - f = {x ? y, y ? x}: x + y; - - body = f {}; - -} diff --git a/tests/lang/eval-fail-substring.nix b/tests/lang/eval-fail-substring.nix deleted file mode 100644 index f37c2bc0a1..0000000000 --- a/tests/lang/eval-fail-substring.nix +++ /dev/null @@ -1 +0,0 @@ -builtins.substring (builtins.sub 0 1) 1 "x" diff --git a/tests/lang/eval-fail-to-path.nix b/tests/lang/eval-fail-to-path.nix deleted file mode 100644 index 5e322bc313..0000000000 --- a/tests/lang/eval-fail-to-path.nix +++ /dev/null @@ -1 +0,0 @@ -builtins.toPath "foo/bar" diff --git a/tests/lang/eval-fail-undeclared-arg.nix b/tests/lang/eval-fail-undeclared-arg.nix deleted file mode 100644 index cafdf16362..0000000000 --- a/tests/lang/eval-fail-undeclared-arg.nix +++ /dev/null @@ -1 +0,0 @@ -({x, z}: x + z) {x = "foo"; y = "bla"; z = "bar";} diff --git a/tests/lang/eval-okay-arithmetic.exp b/tests/lang/eval-okay-arithmetic.exp deleted file mode 100644 index b195055b7a..0000000000 --- a/tests/lang/eval-okay-arithmetic.exp +++ /dev/null @@ -1 +0,0 @@ -2188 diff --git a/tests/lang/eval-okay-arithmetic.nix b/tests/lang/eval-okay-arithmetic.nix deleted file mode 100644 index bbbbc4691d..0000000000 --- a/tests/lang/eval-okay-arithmetic.nix +++ /dev/null @@ -1,55 +0,0 @@ -with import ./lib.nix; - -let { - - /* Supposedly tail recursive version: - - range_ = accum: first: last: - if first == last then ([first] ++ accum) - else range_ ([first] ++ accum) (builtins.add first 1) last; - - range = range_ []; - */ - - x = 12; - - err = abort "urgh"; - - body = sum - [ (sum (range 1 50)) - (123 + 456) - (0 + -10 + -(-11) + -x) - (10 - 7 - -2) - (10 - (6 - -1)) - (10 - 1 + 2) - (3 * 4 * 5) - (56088 / 123 / 2) - (3 + 4 * const 5 0 - 6 / id 2) - - (if 3 < 7 then 1 else err) - (if 7 < 3 then err else 1) - (if 3 < 3 then err else 1) - - (if 3 <= 7 then 1 else err) - (if 7 <= 3 then err else 1) - (if 3 <= 3 then 1 else err) - - (if 3 > 7 then err else 1) - (if 7 > 3 then 1 else err) - (if 3 > 3 then err else 1) - - (if 3 >= 7 then err else 1) - (if 7 >= 3 then 1 else err) - (if 3 >= 3 then 1 else err) - - (if 2 > 1 == 1 < 2 then 1 else err) - (if 1 + 2 * 3 >= 7 then 1 else err) - (if 1 + 2 * 3 < 7 then err else 1) - - # Not integer, but so what. - (if "aa" < "ab" then 1 else err) - (if "aa" < "aa" then err else 1) - (if "foo" < "foobar" then 1 else err) - ]; - -} diff --git a/tests/lang/eval-okay-attrnames.exp b/tests/lang/eval-okay-attrnames.exp deleted file mode 100644 index b4aa387e07..0000000000 --- a/tests/lang/eval-okay-attrnames.exp +++ /dev/null @@ -1 +0,0 @@ -"newxfoonewxy" diff --git a/tests/lang/eval-okay-attrnames.nix b/tests/lang/eval-okay-attrnames.nix deleted file mode 100644 index 978138f0c0..0000000000 --- a/tests/lang/eval-okay-attrnames.nix +++ /dev/null @@ -1,11 +0,0 @@ -with import ./lib.nix; - -let - - attrs = {y = "y"; x = "x"; foo = "foo";} // rec {x = "newx"; bar = x;}; - - names = builtins.attrNames attrs; - - values = map (name: builtins.getAttr name attrs) names; - -in concat values diff --git a/tests/lang/eval-okay-attrs.exp b/tests/lang/eval-okay-attrs.exp deleted file mode 100644 index 45b0f829eb..0000000000 --- a/tests/lang/eval-okay-attrs.exp +++ /dev/null @@ -1 +0,0 @@ -987 diff --git a/tests/lang/eval-okay-attrs.nix b/tests/lang/eval-okay-attrs.nix deleted file mode 100644 index 810b31a5da..0000000000 --- a/tests/lang/eval-okay-attrs.nix +++ /dev/null @@ -1,5 +0,0 @@ -let { - as = { x = 123; y = 456; } // { z = 789; } // { z = 987; }; - - body = if as ? a then as.a else assert as ? z; as.z; -} diff --git a/tests/lang/eval-okay-attrs2.exp b/tests/lang/eval-okay-attrs2.exp deleted file mode 100644 index 45b0f829eb..0000000000 --- a/tests/lang/eval-okay-attrs2.exp +++ /dev/null @@ -1 +0,0 @@ -987 diff --git a/tests/lang/eval-okay-attrs2.nix b/tests/lang/eval-okay-attrs2.nix deleted file mode 100644 index 9e06b83ac1..0000000000 --- a/tests/lang/eval-okay-attrs2.nix +++ /dev/null @@ -1,10 +0,0 @@ -let { - as = { x = 123; y = 456; } // { z = 789; } // { z = 987; }; - - A = "a"; - Z = "z"; - - body = if builtins.hasAttr A as - then builtins.getAttr A as - else assert builtins.hasAttr Z as; builtins.getAttr Z as; -} diff --git a/tests/lang/eval-okay-attrs3.exp b/tests/lang/eval-okay-attrs3.exp deleted file mode 100644 index 19de4fdf79..0000000000 --- a/tests/lang/eval-okay-attrs3.exp +++ /dev/null @@ -1 +0,0 @@ -"foo 22 80 itchyxac" diff --git a/tests/lang/eval-okay-attrs3.nix b/tests/lang/eval-okay-attrs3.nix deleted file mode 100644 index f29de11fe6..0000000000 --- a/tests/lang/eval-okay-attrs3.nix +++ /dev/null @@ -1,22 +0,0 @@ -let - - config = - { - services.sshd.enable = true; - services.sshd.port = 22; - services.httpd.port = 80; - hostName = "itchy"; - a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z = "x"; - foo = { - a = "a"; - b.c = "c"; - }; - }; - -in - if config.services.sshd.enable - then "foo ${toString config.services.sshd.port} ${toString config.services.httpd.port} ${config.hostName}" - + "${config.a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z}" - + "${config.foo.a}" - + "${config.foo.b.c}" - else "bar" diff --git a/tests/lang/eval-okay-attrs4.exp b/tests/lang/eval-okay-attrs4.exp deleted file mode 100644 index 1851731442..0000000000 --- a/tests/lang/eval-okay-attrs4.exp +++ /dev/null @@ -1 +0,0 @@ -[ true false true false false true false false ] diff --git a/tests/lang/eval-okay-attrs4.nix b/tests/lang/eval-okay-attrs4.nix deleted file mode 100644 index 43ec81210f..0000000000 --- a/tests/lang/eval-okay-attrs4.nix +++ /dev/null @@ -1,7 +0,0 @@ -let - - as = { x.y.z = 123; a.b.c = 456; }; - - bs = null; - -in [ (as ? x) (as ? y) (as ? x.y.z) (as ? x.y.z.a) (as ? x.y.a) (as ? a.b.c) (bs ? x) (bs ? x.y.z) ] diff --git a/tests/lang/eval-okay-attrs5.exp b/tests/lang/eval-okay-attrs5.exp deleted file mode 100644 index ce0430d780..0000000000 --- a/tests/lang/eval-okay-attrs5.exp +++ /dev/null @@ -1 +0,0 @@ -[ 123 "foo" 456 456 "foo" "xyzzy" "xyzzy" true ] diff --git a/tests/lang/eval-okay-attrs5.nix b/tests/lang/eval-okay-attrs5.nix deleted file mode 100644 index 0a98b8fdff..0000000000 --- a/tests/lang/eval-okay-attrs5.nix +++ /dev/null @@ -1,21 +0,0 @@ -with import ./lib.nix; - -let - - as = { x.y.z = 123; a.b.c = 456; }; - - bs = { f-o-o.bar = "foo"; }; - - or = x: y: x || y; - -in - [ as.x.y.z - as.foo or "foo" - as.x.y.bla or as.a.b.c - as.a.b.c or as.x.y.z - as.x.y.bla or bs.f-o-o.bar or "xyzzy" - as.x.y.bla or bs.bar.foo or "xyzzy" - 123.bla or null.foo or "xyzzy" - # Backwards compatibility test. - (fold or [] [true false false]) - ] diff --git a/tests/lang/eval-okay-autoargs.exp b/tests/lang/eval-okay-autoargs.exp deleted file mode 100644 index 7a8391786a..0000000000 --- a/tests/lang/eval-okay-autoargs.exp +++ /dev/null @@ -1 +0,0 @@ -"xyzzy!xyzzy!foobar" diff --git a/tests/lang/eval-okay-autoargs.flags b/tests/lang/eval-okay-autoargs.flags deleted file mode 100644 index ae37622544..0000000000 --- a/tests/lang/eval-okay-autoargs.flags +++ /dev/null @@ -1 +0,0 @@ ---arg lib import(lang/lib.nix) --argstr xyzzy xyzzy! -A result diff --git a/tests/lang/eval-okay-autoargs.nix b/tests/lang/eval-okay-autoargs.nix deleted file mode 100644 index 815f51b1d6..0000000000 --- a/tests/lang/eval-okay-autoargs.nix +++ /dev/null @@ -1,15 +0,0 @@ -let - - foobar = "foobar"; - -in - -{ xyzzy2 ? xyzzy # mutually recursive args -, xyzzy ? "blaat" # will be overridden by --argstr -, fb ? foobar -, lib # will be set by --arg -}: - -{ - result = lib.concat [xyzzy xyzzy2 fb]; -} diff --git a/tests/lang/eval-okay-builtins.exp b/tests/lang/eval-okay-builtins.exp deleted file mode 100644 index 0661686d61..0000000000 --- a/tests/lang/eval-okay-builtins.exp +++ /dev/null @@ -1 +0,0 @@ -/foo diff --git a/tests/lang/eval-okay-builtins.nix b/tests/lang/eval-okay-builtins.nix deleted file mode 100644 index e9d65e88a8..0000000000 --- a/tests/lang/eval-okay-builtins.nix +++ /dev/null @@ -1,12 +0,0 @@ -assert builtins ? currentSystem; -assert !builtins ? __currentSystem; - -let { - - x = if builtins ? dirOf then builtins.dirOf /foo/bar else ""; - - y = if builtins ? fnord then builtins.fnord "foo" else ""; - - body = x + y; - -} diff --git a/tests/lang/eval-okay-closure.exp.xml b/tests/lang/eval-okay-closure.exp.xml deleted file mode 100644 index dffc03a998..0000000000 --- a/tests/lang/eval-okay-closure.exp.xml +++ /dev/null @@ -1,343 +0,0 @@ -<?xml version='1.0' encoding='utf-8'?> -<expr> - <list> - <attrs> - <attr name="foo"> - <bool value="true" /> - </attr> - <attr name="key"> - <int value="-13" /> - </attr> - </attrs> - <attrs> - <attr name="foo"> - <bool value="true" /> - </attr> - <attr name="key"> - <int value="-12" /> - </attr> - </attrs> - <attrs> - <attr name="foo"> - <bool value="true" /> - </attr> - <attr name="key"> - <int value="-11" /> - </attr> - </attrs> - <attrs> - <attr name="foo"> - <bool value="true" /> - </attr> - <attr name="key"> - <int value="-9" /> - </attr> - </attrs> - <attrs> - <attr name="foo"> - <bool value="true" /> - </attr> - <attr name="key"> - <int value="-8" /> - </attr> - </attrs> - <attrs> - <attr name="foo"> - <bool value="true" /> - </attr> - <attr name="key"> - <int value="-7" /> - </attr> - </attrs> - <attrs> - <attr name="foo"> - <bool value="true" /> - </attr> - <attr name="key"> - <int value="-5" /> - </attr> - </attrs> - <attrs> - <attr name="foo"> - <bool value="true" /> - </attr> - <attr name="key"> - <int value="-4" /> - </attr> - </attrs> - <attrs> - <attr name="foo"> - <bool value="true" /> - </attr> - <attr name="key"> - <int value="-3" /> - </attr> - </attrs> - <attrs> - <attr name="key"> - <int value="-1" /> - </attr> - </attrs> - <attrs> - <attr name="foo"> - <bool value="true" /> - </attr> - <attr name="key"> - <int value="0" /> - </attr> - </attrs> - <attrs> - <attr name="foo"> - <bool value="true" /> - </attr> - <attr name="key"> - <int value="1" /> - </attr> - </attrs> - <attrs> - <attr name="foo"> - <bool value="true" /> - </attr> - <attr name="key"> - <int value="2" /> - </attr> - </attrs> - <attrs> - <attr name="foo"> - <bool value="true" /> - </attr> - <attr name="key"> - <int value="4" /> - </attr> - </attrs> - <attrs> - <attr name="foo"> - <bool value="true" /> - </attr> - <attr name="key"> - <int value="5" /> - </attr> - </attrs> - <attrs> - <attr name="foo"> - <bool value="true" /> - </attr> - <attr name="key"> - <int value="6" /> - </attr> - </attrs> - <attrs> - <attr name="key"> - <int value="8" /> - </attr> - </attrs> - <attrs> - <attr name="foo"> - <bool value="true" /> - </attr> - <attr name="key"> - <int value="9" /> - </attr> - </attrs> - <attrs> - <attr name="foo"> - <bool value="true" /> - </attr> - <attr name="key"> - <int value="10" /> - </attr> - </attrs> - <attrs> - <attr name="foo"> - <bool value="true" /> - </attr> - <attr name="key"> - <int value="13" /> - </attr> - </attrs> - <attrs> - <attr name="foo"> - <bool value="true" /> - </attr> - <attr name="key"> - <int value="14" /> - </attr> - </attrs> - <attrs> - <attr name="foo"> - <bool value="true" /> - </attr> - <attr name="key"> - <int value="15" /> - </attr> - </attrs> - <attrs> - <attr name="key"> - <int value="17" /> - </attr> - </attrs> - <attrs> - <attr name="foo"> - <bool value="true" /> - </attr> - <attr name="key"> - <int value="18" /> - </attr> - </attrs> - <attrs> - <attr name="foo"> - <bool value="true" /> - </attr> - <attr name="key"> - <int value="19" /> - </attr> - </attrs> - <attrs> - <attr name="foo"> - <bool value="true" /> - </attr> - <attr name="key"> - <int value="22" /> - </attr> - </attrs> - <attrs> - <attr name="foo"> - <bool value="true" /> - </attr> - <attr name="key"> - <int value="23" /> - </attr> - </attrs> - <attrs> - <attr name="key"> - <int value="26" /> - </attr> - </attrs> - <attrs> - <attr name="foo"> - <bool value="true" /> - </attr> - <attr name="key"> - <int value="27" /> - </attr> - </attrs> - <attrs> - <attr name="foo"> - <bool value="true" /> - </attr> - <attr name="key"> - <int value="28" /> - </attr> - </attrs> - <attrs> - <attr name="foo"> - <bool value="true" /> - </attr> - <attr name="key"> - <int value="31" /> - </attr> - </attrs> - <attrs> - <attr name="foo"> - <bool value="true" /> - </attr> - <attr name="key"> - <int value="32" /> - </attr> - </attrs> - <attrs> - <attr name="key"> - <int value="35" /> - </attr> - </attrs> - <attrs> - <attr name="foo"> - <bool value="true" /> - </attr> - <attr name="key"> - <int value="36" /> - </attr> - </attrs> - <attrs> - <attr name="foo"> - <bool value="true" /> - </attr> - <attr name="key"> - <int value="40" /> - </attr> - </attrs> - <attrs> - <attr name="foo"> - <bool value="true" /> - </attr> - <attr name="key"> - <int value="41" /> - </attr> - </attrs> - <attrs> - <attr name="key"> - <int value="44" /> - </attr> - </attrs> - <attrs> - <attr name="foo"> - <bool value="true" /> - </attr> - <attr name="key"> - <int value="45" /> - </attr> - </attrs> - <attrs> - <attr name="foo"> - <bool value="true" /> - </attr> - <attr name="key"> - <int value="49" /> - </attr> - </attrs> - <attrs> - <attr name="key"> - <int value="53" /> - </attr> - </attrs> - <attrs> - <attr name="foo"> - <bool value="true" /> - </attr> - <attr name="key"> - <int value="54" /> - </attr> - </attrs> - <attrs> - <attr name="foo"> - <bool value="true" /> - </attr> - <attr name="key"> - <int value="58" /> - </attr> - </attrs> - <attrs> - <attr name="key"> - <int value="62" /> - </attr> - </attrs> - <attrs> - <attr name="foo"> - <bool value="true" /> - </attr> - <attr name="key"> - <int value="67" /> - </attr> - </attrs> - <attrs> - <attr name="key"> - <int value="71" /> - </attr> - </attrs> - <attrs> - <attr name="key"> - <int value="80" /> - </attr> - </attrs> - </list> -</expr> diff --git a/tests/lang/eval-okay-closure.nix b/tests/lang/eval-okay-closure.nix deleted file mode 100644 index cccd4dc357..0000000000 --- a/tests/lang/eval-okay-closure.nix +++ /dev/null @@ -1,13 +0,0 @@ -let - - closure = builtins.genericClosure { - startSet = [{key = 80;}]; - operator = {key, foo ? false}: - if builtins.lessThan key 0 - then [] - else [{key = builtins.sub key 9;} {key = builtins.sub key 13; foo = true;}]; - }; - - sort = (import ./lib.nix).sortBy (a: b: builtins.lessThan a.key b.key); - -in sort closure diff --git a/tests/lang/eval-okay-concat.exp b/tests/lang/eval-okay-concat.exp deleted file mode 100644 index bb4bbd5774..0000000000 --- a/tests/lang/eval-okay-concat.exp +++ /dev/null @@ -1 +0,0 @@ -[ 1 2 3 4 5 6 7 8 9 ] diff --git a/tests/lang/eval-okay-concat.nix b/tests/lang/eval-okay-concat.nix deleted file mode 100644 index d158a9bf05..0000000000 --- a/tests/lang/eval-okay-concat.nix +++ /dev/null @@ -1 +0,0 @@ -[1 2 3] ++ [4 5 6] ++ [7 8 9] diff --git a/tests/lang/eval-okay-context.exp b/tests/lang/eval-okay-context.exp deleted file mode 100644 index 2f535bdbc4..0000000000 --- a/tests/lang/eval-okay-context.exp +++ /dev/null @@ -1 +0,0 @@ -"foo eval-okay-context.nix bar" diff --git a/tests/lang/eval-okay-context.nix b/tests/lang/eval-okay-context.nix deleted file mode 100644 index b3f1748975..0000000000 --- a/tests/lang/eval-okay-context.nix +++ /dev/null @@ -1,6 +0,0 @@ -let s = "foo ${builtins.substring 33 100 (baseNameOf ./eval-okay-context.nix)} bar"; -in - if s == "foo eval-okay-context.nix bar" - then abort "context not discarded" - else builtins.unsafeDiscardStringContext s - diff --git a/tests/lang/eval-okay-curpos.exp b/tests/lang/eval-okay-curpos.exp deleted file mode 100644 index 65fd65b4d0..0000000000 --- a/tests/lang/eval-okay-curpos.exp +++ /dev/null @@ -1 +0,0 @@ -[ 3 7 4 9 ] diff --git a/tests/lang/eval-okay-curpos.nix b/tests/lang/eval-okay-curpos.nix deleted file mode 100644 index b79553df0b..0000000000 --- a/tests/lang/eval-okay-curpos.nix +++ /dev/null @@ -1,5 +0,0 @@ -# Bla -let - x = __curPos; - y = __curPos; -in [ x.line x.column y.line y.column ] diff --git a/tests/lang/eval-okay-delayed-with-inherit.exp b/tests/lang/eval-okay-delayed-with-inherit.exp deleted file mode 100644 index eaacb55c1a..0000000000 --- a/tests/lang/eval-okay-delayed-with-inherit.exp +++ /dev/null @@ -1 +0,0 @@ -"b-overridden" diff --git a/tests/lang/eval-okay-delayed-with-inherit.nix b/tests/lang/eval-okay-delayed-with-inherit.nix deleted file mode 100644 index 84b388c271..0000000000 --- a/tests/lang/eval-okay-delayed-with-inherit.nix +++ /dev/null @@ -1,24 +0,0 @@ -let - pkgs_ = with pkgs; { - a = derivation { - name = "a"; - system = builtins.currentSystem; - builder = "/bin/sh"; - args = [ "-c" "touch $out" ]; - inherit b; - }; - - inherit b; - }; - - packageOverrides = p: { - b = derivation { - name = "b-overridden"; - system = builtins.currentSystem; - builder = "/bin/sh"; - args = [ "-c" "touch $out" ]; - }; - }; - - pkgs = pkgs_ // (packageOverrides pkgs_); -in pkgs.a.b.name diff --git a/tests/lang/eval-okay-delayed-with.exp b/tests/lang/eval-okay-delayed-with.exp deleted file mode 100644 index 8e7c61ab8e..0000000000 --- a/tests/lang/eval-okay-delayed-with.exp +++ /dev/null @@ -1 +0,0 @@ -"b-overridden b-overridden a" diff --git a/tests/lang/eval-okay-delayed-with.nix b/tests/lang/eval-okay-delayed-with.nix deleted file mode 100644 index 3fb023e1cd..0000000000 --- a/tests/lang/eval-okay-delayed-with.nix +++ /dev/null @@ -1,29 +0,0 @@ -let - - pkgs_ = with pkgs; { - a = derivation { - name = "a"; - system = builtins.currentSystem; - builder = "/bin/sh"; - args = [ "-c" "touch $out" ]; - inherit b; - }; - - b = derivation { - name = "b"; - system = builtins.currentSystem; - builder = "/bin/sh"; - args = [ "-c" "touch $out" ]; - inherit a; - }; - - c = b; - }; - - packageOverrides = pkgs: with pkgs; { - b = derivation (b.drvAttrs // { name = "${b.name}-overridden"; }); - }; - - pkgs = pkgs_ // (packageOverrides pkgs_); - -in "${pkgs.a.b.name} ${pkgs.c.name} ${pkgs.b.a.name}" diff --git a/tests/lang/eval-okay-dynamic-attrs-2.exp b/tests/lang/eval-okay-dynamic-attrs-2.exp deleted file mode 100644 index 27ba77ddaf..0000000000 --- a/tests/lang/eval-okay-dynamic-attrs-2.exp +++ /dev/null @@ -1 +0,0 @@ -true diff --git a/tests/lang/eval-okay-dynamic-attrs-2.nix b/tests/lang/eval-okay-dynamic-attrs-2.nix deleted file mode 100644 index 6d57bf8549..0000000000 --- a/tests/lang/eval-okay-dynamic-attrs-2.nix +++ /dev/null @@ -1 +0,0 @@ -{ a."${"b"}" = true; a."${"c"}" = false; }.a.b diff --git a/tests/lang/eval-okay-dynamic-attrs-bare.exp b/tests/lang/eval-okay-dynamic-attrs-bare.exp deleted file mode 100644 index df8750afc0..0000000000 --- a/tests/lang/eval-okay-dynamic-attrs-bare.exp +++ /dev/null @@ -1 +0,0 @@ -{ binds = true; hasAttrs = true; multiAttrs = true; recBinds = true; selectAttrs = true; selectOrAttrs = true; } diff --git a/tests/lang/eval-okay-dynamic-attrs-bare.nix b/tests/lang/eval-okay-dynamic-attrs-bare.nix deleted file mode 100644 index 0dbe15e638..0000000000 --- a/tests/lang/eval-okay-dynamic-attrs-bare.nix +++ /dev/null @@ -1,17 +0,0 @@ -let - aString = "a"; - - bString = "b"; -in { - hasAttrs = { a.b = null; } ? ${aString}.b; - - selectAttrs = { a.b = true; }.a.${bString}; - - selectOrAttrs = { }.${aString} or true; - - binds = { ${aString}."${bString}c" = true; }.a.bc; - - recBinds = rec { ${bString} = a; a = true; }.b; - - multiAttrs = { ${aString} = true; ${bString} = false; }.a; -} diff --git a/tests/lang/eval-okay-dynamic-attrs.exp b/tests/lang/eval-okay-dynamic-attrs.exp deleted file mode 100644 index df8750afc0..0000000000 --- a/tests/lang/eval-okay-dynamic-attrs.exp +++ /dev/null @@ -1 +0,0 @@ -{ binds = true; hasAttrs = true; multiAttrs = true; recBinds = true; selectAttrs = true; selectOrAttrs = true; } diff --git a/tests/lang/eval-okay-dynamic-attrs.nix b/tests/lang/eval-okay-dynamic-attrs.nix deleted file mode 100644 index ee02ac7e65..0000000000 --- a/tests/lang/eval-okay-dynamic-attrs.nix +++ /dev/null @@ -1,17 +0,0 @@ -let - aString = "a"; - - bString = "b"; -in { - hasAttrs = { a.b = null; } ? "${aString}".b; - - selectAttrs = { a.b = true; }.a."${bString}"; - - selectOrAttrs = { }."${aString}" or true; - - binds = { "${aString}"."${bString}c" = true; }.a.bc; - - recBinds = rec { "${bString}" = a; a = true; }.b; - - multiAttrs = { "${aString}" = true; "${bString}" = false; }.a; -} diff --git a/tests/lang/eval-okay-elem.exp b/tests/lang/eval-okay-elem.exp deleted file mode 100644 index 3cf6c0e962..0000000000 --- a/tests/lang/eval-okay-elem.exp +++ /dev/null @@ -1 +0,0 @@ -[ true false 30 ] diff --git a/tests/lang/eval-okay-elem.nix b/tests/lang/eval-okay-elem.nix deleted file mode 100644 index 71ea7a4ed0..0000000000 --- a/tests/lang/eval-okay-elem.nix +++ /dev/null @@ -1,6 +0,0 @@ -with import ./lib.nix; - -let xs = range 10 40; in - -[ (builtins.elem 23 xs) (builtins.elem 42 xs) (builtins.elemAt xs 20) ] - diff --git a/tests/lang/eval-okay-empty-args.exp b/tests/lang/eval-okay-empty-args.exp deleted file mode 100644 index cb5537d5d7..0000000000 --- a/tests/lang/eval-okay-empty-args.exp +++ /dev/null @@ -1 +0,0 @@ -"ab" diff --git a/tests/lang/eval-okay-empty-args.nix b/tests/lang/eval-okay-empty-args.nix deleted file mode 100644 index 78c133afdd..0000000000 --- a/tests/lang/eval-okay-empty-args.nix +++ /dev/null @@ -1 +0,0 @@ -({}: {x,y,}: "${x}${y}") {} {x = "a"; y = "b";} diff --git a/tests/lang/eval-okay-eq-derivations.exp b/tests/lang/eval-okay-eq-derivations.exp deleted file mode 100644 index ec04aab6ae..0000000000 --- a/tests/lang/eval-okay-eq-derivations.exp +++ /dev/null @@ -1 +0,0 @@ -[ true true true false ] diff --git a/tests/lang/eval-okay-eq-derivations.nix b/tests/lang/eval-okay-eq-derivations.nix deleted file mode 100644 index d526cb4a21..0000000000 --- a/tests/lang/eval-okay-eq-derivations.nix +++ /dev/null @@ -1,10 +0,0 @@ -let - - drvA1 = derivation { name = "a"; builder = "/foo"; system = "i686-linux"; }; - drvA2 = derivation { name = "a"; builder = "/foo"; system = "i686-linux"; }; - drvA3 = derivation { name = "a"; builder = "/foo"; system = "i686-linux"; } // { dummy = 1; }; - - drvC1 = derivation { name = "c"; builder = "/foo"; system = "i686-linux"; }; - drvC2 = derivation { name = "c"; builder = "/bar"; system = "i686-linux"; }; - -in [ (drvA1 == drvA1) (drvA1 == drvA2) (drvA1 == drvA3) (drvC1 == drvC2) ] diff --git a/tests/lang/eval-okay-eq.exp.disabled b/tests/lang/eval-okay-eq.exp.disabled deleted file mode 100644 index 2015847b65..0000000000 --- a/tests/lang/eval-okay-eq.exp.disabled +++ /dev/null @@ -1 +0,0 @@ -Bool(True) diff --git a/tests/lang/eval-okay-eq.nix b/tests/lang/eval-okay-eq.nix deleted file mode 100644 index 73d200b381..0000000000 --- a/tests/lang/eval-okay-eq.nix +++ /dev/null @@ -1,3 +0,0 @@ -["foobar" (rec {x = 1; y = x;})] -== -[("foo" + "bar") ({x = 1; y = 1;})] diff --git a/tests/lang/eval-okay-filter.exp b/tests/lang/eval-okay-filter.exp deleted file mode 100644 index 355d51c27d..0000000000 --- a/tests/lang/eval-okay-filter.exp +++ /dev/null @@ -1 +0,0 @@ -[ 0 2 4 6 8 10 100 102 104 106 108 110 ] diff --git a/tests/lang/eval-okay-filter.nix b/tests/lang/eval-okay-filter.nix deleted file mode 100644 index 85109b0d0e..0000000000 --- a/tests/lang/eval-okay-filter.nix +++ /dev/null @@ -1,5 +0,0 @@ -with import ./lib.nix; - -builtins.filter - (x: x / 2 * 2 == x) - (builtins.concatLists [ (range 0 10) (range 100 110) ]) diff --git a/tests/lang/eval-okay-flatten.exp b/tests/lang/eval-okay-flatten.exp deleted file mode 100644 index b979b2b8b9..0000000000 --- a/tests/lang/eval-okay-flatten.exp +++ /dev/null @@ -1 +0,0 @@ -"1234567" diff --git a/tests/lang/eval-okay-flatten.nix b/tests/lang/eval-okay-flatten.nix deleted file mode 100644 index fe911e9683..0000000000 --- a/tests/lang/eval-okay-flatten.nix +++ /dev/null @@ -1,8 +0,0 @@ -with import ./lib.nix; - -let { - - l = ["1" "2" ["3" ["4"] ["5" "6"]] "7"]; - - body = concat (flatten l); -} diff --git a/tests/lang/eval-okay-functionargs.exp.xml b/tests/lang/eval-okay-functionargs.exp.xml deleted file mode 100644 index 651f54c363..0000000000 --- a/tests/lang/eval-okay-functionargs.exp.xml +++ /dev/null @@ -1,15 +0,0 @@ -<?xml version='1.0' encoding='utf-8'?> -<expr> - <list> - <string value="stdenv" /> - <string value="fetchurl" /> - <string value="aterm-stdenv" /> - <string value="aterm-stdenv2" /> - <string value="libX11" /> - <string value="libXv" /> - <string value="mplayer-stdenv2.libXv-libX11" /> - <string value="mplayer-stdenv2.libXv-libX11_2" /> - <string value="nix-stdenv-aterm-stdenv" /> - <string value="nix-stdenv2-aterm2-stdenv2" /> - </list> -</expr> diff --git a/tests/lang/eval-okay-functionargs.nix b/tests/lang/eval-okay-functionargs.nix deleted file mode 100644 index 68dca62ee1..0000000000 --- a/tests/lang/eval-okay-functionargs.nix +++ /dev/null @@ -1,80 +0,0 @@ -let - - stdenvFun = { }: { name = "stdenv"; }; - stdenv2Fun = { }: { name = "stdenv2"; }; - fetchurlFun = { stdenv }: assert stdenv.name == "stdenv"; { name = "fetchurl"; }; - atermFun = { stdenv, fetchurl }: { name = "aterm-${stdenv.name}"; }; - aterm2Fun = { stdenv, fetchurl }: { name = "aterm2-${stdenv.name}"; }; - nixFun = { stdenv, fetchurl, aterm }: { name = "nix-${stdenv.name}-${aterm.name}"; }; - - mplayerFun = - { stdenv, fetchurl, enableX11 ? false, xorg ? null, enableFoo ? true, foo ? null }: - assert stdenv.name == "stdenv2"; - assert enableX11 -> xorg.libXv.name == "libXv"; - assert enableFoo -> foo != null; - { name = "mplayer-${stdenv.name}.${xorg.libXv.name}-${xorg.libX11.name}"; }; - - makeOverridable = f: origArgs: f origArgs // - { override = newArgs: - makeOverridable f (origArgs // (if builtins.isFunction newArgs then newArgs origArgs else newArgs)); - }; - - callPackage_ = pkgs: f: args: - makeOverridable f ((builtins.intersectAttrs (builtins.functionArgs f) pkgs) // args); - - allPackages = - { overrides ? (pkgs: pkgsPrev: { }) }: - let - callPackage = callPackage_ pkgs; - pkgs = pkgsStd // (overrides pkgs pkgsStd); - pkgsStd = { - inherit pkgs; - stdenv = callPackage stdenvFun { }; - stdenv2 = callPackage stdenv2Fun { }; - fetchurl = callPackage fetchurlFun { }; - aterm = callPackage atermFun { }; - xorg = callPackage xorgFun { }; - mplayer = callPackage mplayerFun { stdenv = pkgs.stdenv2; enableFoo = false; }; - nix = callPackage nixFun { }; - }; - in pkgs; - - libX11Fun = { stdenv, fetchurl }: { name = "libX11"; }; - libX11_2Fun = { stdenv, fetchurl }: { name = "libX11_2"; }; - libXvFun = { stdenv, fetchurl, libX11 }: { name = "libXv"; }; - - xorgFun = - { pkgs }: - let callPackage = callPackage_ (pkgs // pkgs.xorg); in - { - libX11 = callPackage libX11Fun { }; - libXv = callPackage libXvFun { }; - }; - -in - -let - - pkgs = allPackages { }; - - pkgs2 = allPackages { - overrides = pkgs: pkgsPrev: { - stdenv = pkgs.stdenv2; - nix = pkgsPrev.nix.override { aterm = aterm2Fun { inherit (pkgs) stdenv fetchurl; }; }; - xorg = pkgsPrev.xorg // { libX11 = libX11_2Fun { inherit (pkgs) stdenv fetchurl; }; }; - }; - }; - -in - - [ pkgs.stdenv.name - pkgs.fetchurl.name - pkgs.aterm.name - pkgs2.aterm.name - pkgs.xorg.libX11.name - pkgs.xorg.libXv.name - pkgs.mplayer.name - pkgs2.mplayer.name - pkgs.nix.name - pkgs2.nix.name - ] diff --git a/tests/lang/eval-okay-getattrpos.exp b/tests/lang/eval-okay-getattrpos.exp deleted file mode 100644 index 469249bbc6..0000000000 --- a/tests/lang/eval-okay-getattrpos.exp +++ /dev/null @@ -1 +0,0 @@ -{ column = 5; file = "eval-okay-getattrpos.nix"; line = 3; } diff --git a/tests/lang/eval-okay-getattrpos.nix b/tests/lang/eval-okay-getattrpos.nix deleted file mode 100644 index ca6b079615..0000000000 --- a/tests/lang/eval-okay-getattrpos.nix +++ /dev/null @@ -1,6 +0,0 @@ -let - as = { - foo = "bar"; - }; - pos = builtins.unsafeGetAttrPos "foo" as; -in { inherit (pos) column line; file = baseNameOf pos.file; } diff --git a/tests/lang/eval-okay-getenv.exp b/tests/lang/eval-okay-getenv.exp deleted file mode 100644 index 14e24d4190..0000000000 --- a/tests/lang/eval-okay-getenv.exp +++ /dev/null @@ -1 +0,0 @@ -"foobar" diff --git a/tests/lang/eval-okay-getenv.nix b/tests/lang/eval-okay-getenv.nix deleted file mode 100644 index 4cfec5f553..0000000000 --- a/tests/lang/eval-okay-getenv.nix +++ /dev/null @@ -1 +0,0 @@ -builtins.getEnv "TEST_VAR" + (if builtins.getEnv "NO_SUCH_VAR" == "" then "bar" else "bla") diff --git a/tests/lang/eval-okay-hash.exp b/tests/lang/eval-okay-hash.exp deleted file mode 100644 index 7bbe452bcc..0000000000 --- a/tests/lang/eval-okay-hash.exp +++ /dev/null @@ -1 +0,0 @@ -[ "d41d8cd98f00b204e9800998ecf8427e" "6c69ee7f211c640419d5366cc076ae46" "bb3438fbabd460ea6dbd27d153e2233b" "da39a3ee5e6b4b0d3255bfef95601890afd80709" "cd54e8568c1b37cf1e5badb0779bcbf382212189" "6d12e10b1d331dad210e47fd25d4f260802b7e77" "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" "900a4469df00ccbfd0c145c6d1e4b7953dd0afafadd7534e3a4019e8d38fc663" "ad0387b3bd8652f730ca46d25f9c170af0fd589f42e7f23f5a9e6412d97d7e56" ] diff --git a/tests/lang/eval-okay-hash.nix b/tests/lang/eval-okay-hash.nix deleted file mode 100644 index 2fff17f849..0000000000 --- a/tests/lang/eval-okay-hash.nix +++ /dev/null @@ -1,7 +0,0 @@ -let - md5 = builtins.hashString "md5"; - sha1 = builtins.hashString "sha1"; - sha256 = builtins.hashString "sha256"; - strings = [ "" "text 1" "text 2" ]; -in - (builtins.map md5 strings) ++ (builtins.map sha1 strings) ++ (builtins.map sha256 strings) diff --git a/tests/lang/eval-okay-if.exp b/tests/lang/eval-okay-if.exp deleted file mode 100644 index 00750edc07..0000000000 --- a/tests/lang/eval-okay-if.exp +++ /dev/null @@ -1 +0,0 @@ -3 diff --git a/tests/lang/eval-okay-if.nix b/tests/lang/eval-okay-if.nix deleted file mode 100644 index 23e4c74d50..0000000000 --- a/tests/lang/eval-okay-if.nix +++ /dev/null @@ -1 +0,0 @@ -if "foo" != "f" + "oo" then 1 else if false then 2 else 3 diff --git a/tests/lang/eval-okay-ind-string.exp b/tests/lang/eval-okay-ind-string.exp deleted file mode 100644 index 886219dcf6..0000000000 --- a/tests/lang/eval-okay-ind-string.exp +++ /dev/null @@ -1 +0,0 @@ -"This is an indented multi-line string\nliteral. An amount of whitespace at\nthe start of each line matching the minimum\nindentation of all lines in the string\nliteral together will be removed. Thus,\nin this case four spaces will be\nstripped from each line, even though\n THIS LINE is indented six spaces.\n\nAlso, empty lines don't count in the\ndetermination of the indentation level (the\nprevious empty line has indentation 0, but\nit doesn't matter).\nIf the string starts with whitespace\n followed by a newline, it's stripped, but\n that's not the case here. Two spaces are\n stripped because of the \" \" at the start. \nThis line is indented\na bit further.\nAnti-quotations, like so, are\nalso allowed.\n The \\ is not special here.\n' can be followed by any character except another ', e.g. 'x'.\nLikewise for $, e.g. $$ or $varName.\nBut ' followed by ' is special, as is $ followed by {.\nIf you want them, use anti-quotations: '', ${.\n Tabs are not interpreted as whitespace (since we can't guess\n what tab settings are intended), so don't use them.\n\tThis line starts with a space and a tab, so only one\n space will be stripped from each line.\nAlso note that if the last line (just before the closing ' ')\nconsists only of whitespace, it's ignored. But here there is\nsome non-whitespace stuff, so the line isn't removed. \nThis shows a hacky way to preserve an empty line after the start.\nBut there's no reason to do so: you could just repeat the empty\nline.\n Similarly you can force an indentation level,\n in this case to 2 spaces. This works because the anti-quote\n is significant (not whitespace).\nstart on network-interfaces\n\nstart script\n\n rm -f /var/run/opengl-driver\n ln -sf 123 /var/run/opengl-driver\n\n rm -f /var/log/slim.log\n \nend script\n\nenv SLIM_CFGFILE=abc\nenv SLIM_THEMESDIR=def\nenv FONTCONFIG_FILE=/etc/fonts/fonts.conf \t\t\t\t# !!! cleanup\nenv XKB_BINDIR=foo/bin \t\t\t\t# Needed for the Xkb extension.\nenv LD_LIBRARY_PATH=libX11/lib:libXext/lib:/usr/lib/ # related to xorg-sys-opengl - needed to load libglx for (AI)GLX support (for compiz)\n\nenv XORG_DRI_DRIVER_PATH=nvidiaDrivers/X11R6/lib/modules/drivers/ \n\nexec slim/bin/slim\nEscaping of ' followed by ': ''\nEscaping of $ followed by {: ${\nAnd finally to interpret \\n etc. as in a string: \n, \r, \t.\nfoo\n'bla'\nbar\n" diff --git a/tests/lang/eval-okay-ind-string.nix b/tests/lang/eval-okay-ind-string.nix deleted file mode 100644 index 1556aae9f5..0000000000 --- a/tests/lang/eval-okay-ind-string.nix +++ /dev/null @@ -1,120 +0,0 @@ -let - - s1 = '' - This is an indented multi-line string - literal. An amount of whitespace at - the start of each line matching the minimum - indentation of all lines in the string - literal together will be removed. Thus, - in this case four spaces will be - stripped from each line, even though - THIS LINE is indented six spaces. - - Also, empty lines don't count in the - determination of the indentation level (the - previous empty line has indentation 0, but - it doesn't matter). - ''; - - s2 = '' If the string starts with whitespace - followed by a newline, it's stripped, but - that's not the case here. Two spaces are - stripped because of the " " at the start. - ''; - - s3 = '' - This line is indented - a bit further. - ''; # indentation of last line doesn't count if it's empty - - s4 = '' - Anti-quotations, like ${if true then "so" else "not so"}, are - also allowed. - ''; - - s5 = '' - The \ is not special here. - ' can be followed by any character except another ', e.g. 'x'. - Likewise for $, e.g. $$ or $varName. - But ' followed by ' is special, as is $ followed by {. - If you want them, use anti-quotations: ${"''"}, ${"\${"}. - ''; - - s6 = '' - Tabs are not interpreted as whitespace (since we can't guess - what tab settings are intended), so don't use them. - This line starts with a space and a tab, so only one - space will be stripped from each line. - ''; - - s7 = '' - Also note that if the last line (just before the closing ' ') - consists only of whitespace, it's ignored. But here there is - some non-whitespace stuff, so the line isn't removed. ''; - - s8 = '' ${""} - This shows a hacky way to preserve an empty line after the start. - But there's no reason to do so: you could just repeat the empty - line. - ''; - - s9 = '' - ${""} Similarly you can force an indentation level, - in this case to 2 spaces. This works because the anti-quote - is significant (not whitespace). - ''; - - s10 = '' - ''; - - s11 = ''''; - - s12 = '' ''; - - s13 = '' - start on network-interfaces - - start script - - rm -f /var/run/opengl-driver - ${if true - then "ln -sf 123 /var/run/opengl-driver" - else if true - then "ln -sf 456 /var/run/opengl-driver" - else "" - } - - rm -f /var/log/slim.log - - end script - - env SLIM_CFGFILE=${"abc"} - env SLIM_THEMESDIR=${"def"} - env FONTCONFIG_FILE=/etc/fonts/fonts.conf # !!! cleanup - env XKB_BINDIR=${"foo"}/bin # Needed for the Xkb extension. - env LD_LIBRARY_PATH=${"libX11"}/lib:${"libXext"}/lib:/usr/lib/ # related to xorg-sys-opengl - needed to load libglx for (AI)GLX support (for compiz) - - ${if true - then "env XORG_DRI_DRIVER_PATH=${"nvidiaDrivers"}/X11R6/lib/modules/drivers/" - else if true - then "env XORG_DRI_DRIVER_PATH=${"mesa"}/lib/modules/dri" - else "" - } - - exec ${"slim"}/bin/slim - ''; - - s14 = '' - Escaping of ' followed by ': ''' - Escaping of $ followed by {: ''${ - And finally to interpret \n etc. as in a string: ''\n, ''\r, ''\t. - ''; - - # Regression test: antiquotation in '${x}' should work, but didn't. - s15 = let x = "bla"; in '' - foo - '${x}' - bar - ''; - -in s1 + s2 + s3 + s4 + s5 + s6 + s7 + s8 + s9 + s10 + s11 + s12 + s13 + s14 + s15 diff --git a/tests/lang/eval-okay-let.exp b/tests/lang/eval-okay-let.exp deleted file mode 100644 index 14e24d4190..0000000000 --- a/tests/lang/eval-okay-let.exp +++ /dev/null @@ -1 +0,0 @@ -"foobar" diff --git a/tests/lang/eval-okay-let.nix b/tests/lang/eval-okay-let.nix deleted file mode 100644 index fe118c5282..0000000000 --- a/tests/lang/eval-okay-let.nix +++ /dev/null @@ -1,5 +0,0 @@ -let { - x = "foo"; - y = "bar"; - body = x + y; -} diff --git a/tests/lang/eval-okay-list.exp b/tests/lang/eval-okay-list.exp deleted file mode 100644 index f784f26d83..0000000000 --- a/tests/lang/eval-okay-list.exp +++ /dev/null @@ -1 +0,0 @@ -"foobarblatest" diff --git a/tests/lang/eval-okay-list.nix b/tests/lang/eval-okay-list.nix deleted file mode 100644 index d433bcf908..0000000000 --- a/tests/lang/eval-okay-list.nix +++ /dev/null @@ -1,7 +0,0 @@ -with import ./lib.nix; - -let { - - body = concat ["foo" "bar" "bla" "test"]; - -} \ No newline at end of file diff --git a/tests/lang/eval-okay-listtoattrs.exp b/tests/lang/eval-okay-listtoattrs.exp deleted file mode 100644 index 74abef7bc6..0000000000 --- a/tests/lang/eval-okay-listtoattrs.exp +++ /dev/null @@ -1 +0,0 @@ -"AAbar" diff --git a/tests/lang/eval-okay-listtoattrs.nix b/tests/lang/eval-okay-listtoattrs.nix deleted file mode 100644 index 4186e029b5..0000000000 --- a/tests/lang/eval-okay-listtoattrs.nix +++ /dev/null @@ -1,11 +0,0 @@ -# this test shows how to use listToAttrs and that evaluation is still lazy (throw isn't called) -with import ./lib.nix; - -let - asi = name: value : { inherit name value; }; - list = [ ( asi "a" "A" ) ( asi "b" "B" ) ]; - a = builtins.listToAttrs list; - b = builtins.listToAttrs ( list ++ list ); - r = builtins.listToAttrs [ (asi "result" [ a b ]) ( asi "throw" (throw "this should not be thrown")) ]; - x = builtins.listToAttrs [ (asi "foo" "bar") (asi "foo" "bla") ]; -in concat (map (x: x.a) r.result) + x.foo diff --git a/tests/lang/eval-okay-logic.exp b/tests/lang/eval-okay-logic.exp deleted file mode 100644 index d00491fd7e..0000000000 --- a/tests/lang/eval-okay-logic.exp +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/tests/lang/eval-okay-logic.nix b/tests/lang/eval-okay-logic.nix deleted file mode 100644 index fbb1279440..0000000000 --- a/tests/lang/eval-okay-logic.nix +++ /dev/null @@ -1 +0,0 @@ -assert !false && (true || false) -> true; 1 diff --git a/tests/lang/eval-okay-map.exp b/tests/lang/eval-okay-map.exp deleted file mode 100644 index dbb64f717b..0000000000 --- a/tests/lang/eval-okay-map.exp +++ /dev/null @@ -1 +0,0 @@ -"foobarblabarxyzzybar" diff --git a/tests/lang/eval-okay-map.nix b/tests/lang/eval-okay-map.nix deleted file mode 100644 index a76c1d8114..0000000000 --- a/tests/lang/eval-okay-map.nix +++ /dev/null @@ -1,3 +0,0 @@ -with import ./lib.nix; - -concat (map (x: x + "bar") [ "foo" "bla" "xyzzy" ]) \ No newline at end of file diff --git a/tests/lang/eval-okay-new-let.exp b/tests/lang/eval-okay-new-let.exp deleted file mode 100644 index f98b388071..0000000000 --- a/tests/lang/eval-okay-new-let.exp +++ /dev/null @@ -1 +0,0 @@ -"xyzzyfoobar" diff --git a/tests/lang/eval-okay-new-let.nix b/tests/lang/eval-okay-new-let.nix deleted file mode 100644 index 7381231415..0000000000 --- a/tests/lang/eval-okay-new-let.nix +++ /dev/null @@ -1,14 +0,0 @@ -let - - f = z: - - let - x = "foo"; - y = "bar"; - body = 1; # compat test - in - z + x + y; - - arg = "xyzzy"; - -in f arg diff --git a/tests/lang/eval-okay-null-dynamic-attrs.exp b/tests/lang/eval-okay-null-dynamic-attrs.exp deleted file mode 100644 index 27ba77ddaf..0000000000 --- a/tests/lang/eval-okay-null-dynamic-attrs.exp +++ /dev/null @@ -1 +0,0 @@ -true diff --git a/tests/lang/eval-okay-null-dynamic-attrs.nix b/tests/lang/eval-okay-null-dynamic-attrs.nix deleted file mode 100644 index b060c0bc98..0000000000 --- a/tests/lang/eval-okay-null-dynamic-attrs.nix +++ /dev/null @@ -1 +0,0 @@ -{ ${null} = true; } == {} diff --git a/tests/lang/eval-okay-overrides.exp b/tests/lang/eval-okay-overrides.exp deleted file mode 100644 index 0cfbf08886..0000000000 --- a/tests/lang/eval-okay-overrides.exp +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/tests/lang/eval-okay-overrides.nix b/tests/lang/eval-okay-overrides.nix deleted file mode 100644 index 358742b36e..0000000000 --- a/tests/lang/eval-okay-overrides.nix +++ /dev/null @@ -1,9 +0,0 @@ -let - - overrides = { a = 2; }; - -in (rec { - __overrides = overrides; - x = a; - a = 1; -}).x diff --git a/tests/lang/eval-okay-pathexists.exp b/tests/lang/eval-okay-pathexists.exp deleted file mode 100644 index 27ba77ddaf..0000000000 --- a/tests/lang/eval-okay-pathexists.exp +++ /dev/null @@ -1 +0,0 @@ -true diff --git a/tests/lang/eval-okay-pathexists.nix b/tests/lang/eval-okay-pathexists.nix deleted file mode 100644 index 50c28ee0cd..0000000000 --- a/tests/lang/eval-okay-pathexists.nix +++ /dev/null @@ -1,5 +0,0 @@ -builtins.pathExists (builtins.toPath ./lib.nix) -&& builtins.pathExists (builtins.toPath (builtins.toString ./lib.nix)) -&& !builtins.pathExists (builtins.toPath (builtins.toString ./bla.nix)) -&& builtins.pathExists ./lib.nix -&& !builtins.pathExists ./bla.nix diff --git a/tests/lang/eval-okay-patterns.exp b/tests/lang/eval-okay-patterns.exp deleted file mode 100644 index a4304010fe..0000000000 --- a/tests/lang/eval-okay-patterns.exp +++ /dev/null @@ -1 +0,0 @@ -"abcxyzDDDDEFijk" diff --git a/tests/lang/eval-okay-patterns.nix b/tests/lang/eval-okay-patterns.nix deleted file mode 100644 index 96fd25a015..0000000000 --- a/tests/lang/eval-okay-patterns.nix +++ /dev/null @@ -1,16 +0,0 @@ -let - - f = args@{x, y, z}: x + args.y + z; - - g = {x, y, z}@args: f args; - - h = {x ? "d", y ? x, z ? args.x}@args: x + y + z; - - j = {x, y, z, ...}: x + y + z; - -in - f {x = "a"; y = "b"; z = "c";} + - g {x = "x"; y = "y"; z = "z";} + - h {x = "D";} + - h {x = "D"; y = "E"; z = "F";} + - j {x = "i"; y = "j"; z = "k"; bla = "bla"; foo = "bar";} diff --git a/tests/lang/eval-okay-readfile.exp b/tests/lang/eval-okay-readfile.exp deleted file mode 100644 index a2c87d0c43..0000000000 --- a/tests/lang/eval-okay-readfile.exp +++ /dev/null @@ -1 +0,0 @@ -"builtins.readFile ./eval-okay-readfile.nix\n" diff --git a/tests/lang/eval-okay-readfile.nix b/tests/lang/eval-okay-readfile.nix deleted file mode 100644 index 82f7cb1743..0000000000 --- a/tests/lang/eval-okay-readfile.nix +++ /dev/null @@ -1 +0,0 @@ -builtins.readFile ./eval-okay-readfile.nix diff --git a/tests/lang/eval-okay-redefine-builtin.exp b/tests/lang/eval-okay-redefine-builtin.exp deleted file mode 100644 index c508d5366f..0000000000 --- a/tests/lang/eval-okay-redefine-builtin.exp +++ /dev/null @@ -1 +0,0 @@ -false diff --git a/tests/lang/eval-okay-redefine-builtin.nix b/tests/lang/eval-okay-redefine-builtin.nix deleted file mode 100644 index df9fc3f37d..0000000000 --- a/tests/lang/eval-okay-redefine-builtin.nix +++ /dev/null @@ -1,3 +0,0 @@ -let - throw = abort "Error!"; -in (builtins.tryEval <foobaz>).success diff --git a/tests/lang/eval-okay-remove.exp b/tests/lang/eval-okay-remove.exp deleted file mode 100644 index 8d38505c16..0000000000 --- a/tests/lang/eval-okay-remove.exp +++ /dev/null @@ -1 +0,0 @@ -456 diff --git a/tests/lang/eval-okay-remove.nix b/tests/lang/eval-okay-remove.nix deleted file mode 100644 index 4ad5ba897f..0000000000 --- a/tests/lang/eval-okay-remove.nix +++ /dev/null @@ -1,5 +0,0 @@ -let { - attrs = {x = 123; y = 456;}; - - body = (removeAttrs attrs ["x"]).y; -} \ No newline at end of file diff --git a/tests/lang/eval-okay-scope-1.exp b/tests/lang/eval-okay-scope-1.exp deleted file mode 100644 index 00750edc07..0000000000 --- a/tests/lang/eval-okay-scope-1.exp +++ /dev/null @@ -1 +0,0 @@ -3 diff --git a/tests/lang/eval-okay-scope-1.nix b/tests/lang/eval-okay-scope-1.nix deleted file mode 100644 index fa38a7174e..0000000000 --- a/tests/lang/eval-okay-scope-1.nix +++ /dev/null @@ -1,6 +0,0 @@ -(({x}: x: - - { x = 1; - y = x; - } -) {x = 2;} 3).y diff --git a/tests/lang/eval-okay-scope-2.exp b/tests/lang/eval-okay-scope-2.exp deleted file mode 100644 index d00491fd7e..0000000000 --- a/tests/lang/eval-okay-scope-2.exp +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/tests/lang/eval-okay-scope-2.nix b/tests/lang/eval-okay-scope-2.nix deleted file mode 100644 index eb8b02bc49..0000000000 --- a/tests/lang/eval-okay-scope-2.nix +++ /dev/null @@ -1,6 +0,0 @@ -((x: {x}: - rec { - x = 1; - y = x; - } -) 2 {x = 3;}).y diff --git a/tests/lang/eval-okay-scope-3.exp b/tests/lang/eval-okay-scope-3.exp deleted file mode 100644 index b8626c4cff..0000000000 --- a/tests/lang/eval-okay-scope-3.exp +++ /dev/null @@ -1 +0,0 @@ -4 diff --git a/tests/lang/eval-okay-scope-3.nix b/tests/lang/eval-okay-scope-3.nix deleted file mode 100644 index 10d6bc04d8..0000000000 --- a/tests/lang/eval-okay-scope-3.nix +++ /dev/null @@ -1,6 +0,0 @@ -((x: as: {x}: - rec { - inherit (as) x; - y = x; - } -) 2 {x = 4;} {x = 3;}).y diff --git a/tests/lang/eval-okay-scope-4.exp b/tests/lang/eval-okay-scope-4.exp deleted file mode 100644 index 00ff03a46c..0000000000 --- a/tests/lang/eval-okay-scope-4.exp +++ /dev/null @@ -1 +0,0 @@ -"ccdd" diff --git a/tests/lang/eval-okay-scope-4.nix b/tests/lang/eval-okay-scope-4.nix deleted file mode 100644 index dc8243bc85..0000000000 --- a/tests/lang/eval-okay-scope-4.nix +++ /dev/null @@ -1,10 +0,0 @@ -let { - - x = "a"; - y = "b"; - - f = {x ? y, y ? x}: x + y; - - body = f {x = "c";} + f {y = "d";}; - -} diff --git a/tests/lang/eval-okay-scope-6.exp b/tests/lang/eval-okay-scope-6.exp deleted file mode 100644 index 00ff03a46c..0000000000 --- a/tests/lang/eval-okay-scope-6.exp +++ /dev/null @@ -1 +0,0 @@ -"ccdd" diff --git a/tests/lang/eval-okay-scope-6.nix b/tests/lang/eval-okay-scope-6.nix deleted file mode 100644 index 0995d4e7e7..0000000000 --- a/tests/lang/eval-okay-scope-6.nix +++ /dev/null @@ -1,7 +0,0 @@ -let { - - f = {x ? y, y ? x}: x + y; - - body = f {x = "c";} + f {y = "d";}; - -} diff --git a/tests/lang/eval-okay-scope-7.exp b/tests/lang/eval-okay-scope-7.exp deleted file mode 100644 index d00491fd7e..0000000000 --- a/tests/lang/eval-okay-scope-7.exp +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/tests/lang/eval-okay-scope-7.nix b/tests/lang/eval-okay-scope-7.nix deleted file mode 100644 index 4da02968f6..0000000000 --- a/tests/lang/eval-okay-scope-7.nix +++ /dev/null @@ -1,6 +0,0 @@ -rec { - inherit (x) y; - x = { - y = 1; - }; -}.y diff --git a/tests/lang/eval-okay-search-path.exp b/tests/lang/eval-okay-search-path.exp deleted file mode 100644 index d0bc8c5e86..0000000000 --- a/tests/lang/eval-okay-search-path.exp +++ /dev/null @@ -1 +0,0 @@ -"abcc" diff --git a/tests/lang/eval-okay-search-path.flags b/tests/lang/eval-okay-search-path.flags deleted file mode 100644 index a28e682100..0000000000 --- a/tests/lang/eval-okay-search-path.flags +++ /dev/null @@ -1 +0,0 @@ --I lang/dir1 -I lang/dir2 -I dir5=lang/dir3 \ No newline at end of file diff --git a/tests/lang/eval-okay-search-path.nix b/tests/lang/eval-okay-search-path.nix deleted file mode 100644 index 9b71150233..0000000000 --- a/tests/lang/eval-okay-search-path.nix +++ /dev/null @@ -1,3 +0,0 @@ -assert builtins.pathExists <nix/buildenv.nix>; - -import <a.nix> + import <b.nix> + import <c.nix> + import <dir5/c.nix> diff --git a/tests/lang/eval-okay-string.exp b/tests/lang/eval-okay-string.exp deleted file mode 100644 index 6079202470..0000000000 --- a/tests/lang/eval-okay-string.exp +++ /dev/null @@ -1 +0,0 @@ -"foobar/a/b/c/d/foo/xyzzy/foo.txt/../foo/x/yescape: \"quote\" \n \\end\nof\nlinefoobarblaatfoo$bar" diff --git a/tests/lang/eval-okay-string.nix b/tests/lang/eval-okay-string.nix deleted file mode 100644 index 839539e6c1..0000000000 --- a/tests/lang/eval-okay-string.nix +++ /dev/null @@ -1,10 +0,0 @@ -"foo" + "bar" - + toString (/a/b + /c/d) - + toString (/foo/bar + "/../xyzzy/." + "/foo.txt") - + ("/../foo" + toString /x/y) - + "escape: \"quote\" \n \\" - + "end -of -line" - + "foo${if true then "b${"a" + "r"}" else "xyzzy"}blaat" - + "foo$bar" diff --git a/tests/lang/eval-okay-strings-as-attrs-names.exp b/tests/lang/eval-okay-strings-as-attrs-names.exp deleted file mode 100644 index 27ba77ddaf..0000000000 --- a/tests/lang/eval-okay-strings-as-attrs-names.exp +++ /dev/null @@ -1 +0,0 @@ -true diff --git a/tests/lang/eval-okay-strings-as-attrs-names.nix b/tests/lang/eval-okay-strings-as-attrs-names.nix deleted file mode 100644 index 5e40928dbe..0000000000 --- a/tests/lang/eval-okay-strings-as-attrs-names.nix +++ /dev/null @@ -1,20 +0,0 @@ -let - - attr = { - "key 1" = "test"; - "key 2" = "caseok"; - }; - - t1 = builtins.getAttr "key 1" attr; - t2 = attr."key 2"; - t3 = attr ? "key 1"; - t4 = builtins.attrNames { inherit (attr) "key 1"; }; - - # This is permitted, but there is currently no way to reference this - # variable. - "foo bar" = 1; - -in t1 == "test" - && t2 == "caseok" - && t3 == true - && t4 == ["key 1"] diff --git a/tests/lang/eval-okay-substring.exp b/tests/lang/eval-okay-substring.exp deleted file mode 100644 index 6aace04b0f..0000000000 --- a/tests/lang/eval-okay-substring.exp +++ /dev/null @@ -1 +0,0 @@ -"ooxfoobarybarzobaabbc" diff --git a/tests/lang/eval-okay-substring.nix b/tests/lang/eval-okay-substring.nix deleted file mode 100644 index 424af00d9b..0000000000 --- a/tests/lang/eval-okay-substring.nix +++ /dev/null @@ -1,21 +0,0 @@ -with builtins; - -let - - s = "foobar"; - -in - -substring 1 2 s -+ "x" -+ substring 0 (stringLength s) s -+ "y" -+ substring 3 100 s -+ "z" -+ substring 2 (sub (stringLength s) 3) s -+ "a" -+ substring 3 0 s -+ "b" -+ substring 3 1 s -+ "c" -+ substring 5 10 "perl" diff --git a/tests/lang/eval-okay-tail-call-1.exp-disabled b/tests/lang/eval-okay-tail-call-1.exp-disabled deleted file mode 100644 index f7393e847d..0000000000 --- a/tests/lang/eval-okay-tail-call-1.exp-disabled +++ /dev/null @@ -1 +0,0 @@ -100000 diff --git a/tests/lang/eval-okay-tail-call-1.nix b/tests/lang/eval-okay-tail-call-1.nix deleted file mode 100644 index a3962ce3fd..0000000000 --- a/tests/lang/eval-okay-tail-call-1.nix +++ /dev/null @@ -1,3 +0,0 @@ -let - f = n: if n == 100000 then n else f (n + 1); -in f 0 diff --git a/tests/lang/eval-okay-tojson.exp b/tests/lang/eval-okay-tojson.exp deleted file mode 100644 index e8164af2b6..0000000000 --- a/tests/lang/eval-okay-tojson.exp +++ /dev/null @@ -1 +0,0 @@ -"{\"a\":123,\"b\":-456,\"c\":\"foo\",\"d\":\"foo\\n\\\"bar\\\"\",\"e\":true,\"f\":false,\"g\":[1,2,3],\"h\":[\"a\",[\"b\",{\"foo\\nbar\":{}}]],\"i\":3}" diff --git a/tests/lang/eval-okay-tojson.nix b/tests/lang/eval-okay-tojson.nix deleted file mode 100644 index 0d4e55b3d3..0000000000 --- a/tests/lang/eval-okay-tojson.nix +++ /dev/null @@ -1,11 +0,0 @@ -builtins.toJSON - { a = 123; - b = -456; - c = "foo"; - d = "foo\n\"bar\""; - e = true; - f = false; - g = [ 1 2 3 ]; - h = [ "a" [ "b" { "foo\nbar" = {}; } ] ]; - i = 1 + 2; - } diff --git a/tests/lang/eval-okay-toxml.exp b/tests/lang/eval-okay-toxml.exp deleted file mode 100644 index 828220890e..0000000000 --- a/tests/lang/eval-okay-toxml.exp +++ /dev/null @@ -1 +0,0 @@ -"<?xml version='1.0' encoding='utf-8'?>\n<expr>\n <attrs>\n <attr name=\"a\">\n <string value=\"s\" />\n </attr>\n </attrs>\n</expr>\n" diff --git a/tests/lang/eval-okay-toxml.nix b/tests/lang/eval-okay-toxml.nix deleted file mode 100644 index 068c97a6c1..0000000000 --- a/tests/lang/eval-okay-toxml.nix +++ /dev/null @@ -1,3 +0,0 @@ -# Make sure the expected XML output is produced; in particular, make sure it -# doesn't contain source location information. -builtins.toXML { a = "s"; } diff --git a/tests/lang/eval-okay-toxml2.exp b/tests/lang/eval-okay-toxml2.exp deleted file mode 100644 index 634a841eb1..0000000000 --- a/tests/lang/eval-okay-toxml2.exp +++ /dev/null @@ -1 +0,0 @@ -"<?xml version='1.0' encoding='utf-8'?>\n<expr>\n <list>\n <string value=\"ab\" />\n <int value=\"10\" />\n <attrs>\n <attr name=\"x\">\n <string value=\"x\" />\n </attr>\n <attr name=\"y\">\n <string value=\"x\" />\n </attr>\n </attrs>\n </list>\n</expr>\n" diff --git a/tests/lang/eval-okay-toxml2.nix b/tests/lang/eval-okay-toxml2.nix deleted file mode 100644 index ff1791b30e..0000000000 --- a/tests/lang/eval-okay-toxml2.nix +++ /dev/null @@ -1 +0,0 @@ -builtins.toXML [("a" + "b") 10 (rec {x = "x"; y = x;})] diff --git a/tests/lang/eval-okay-tryeval.exp b/tests/lang/eval-okay-tryeval.exp deleted file mode 100644 index 2b2e6fa711..0000000000 --- a/tests/lang/eval-okay-tryeval.exp +++ /dev/null @@ -1 +0,0 @@ -{ x = { success = true; value = "x"; }; y = { success = false; value = false; }; z = { success = false; value = false; }; } diff --git a/tests/lang/eval-okay-tryeval.nix b/tests/lang/eval-okay-tryeval.nix deleted file mode 100644 index 629bc440a8..0000000000 --- a/tests/lang/eval-okay-tryeval.nix +++ /dev/null @@ -1,5 +0,0 @@ -{ - x = builtins.tryEval "x"; - y = builtins.tryEval (assert false; "y"); - z = builtins.tryEval (throw "bla"); -} diff --git a/tests/lang/eval-okay-types.exp b/tests/lang/eval-okay-types.exp deleted file mode 100644 index 82487f7100..0000000000 --- a/tests/lang/eval-okay-types.exp +++ /dev/null @@ -1 +0,0 @@ -[ true false true false true false true false true false true false "int" "bool" "string" "null" "set" "list" "lambda" "lambda" "lambda" "lambda" ] diff --git a/tests/lang/eval-okay-types.nix b/tests/lang/eval-okay-types.nix deleted file mode 100644 index 8cb225e247..0000000000 --- a/tests/lang/eval-okay-types.nix +++ /dev/null @@ -1,25 +0,0 @@ -with builtins; - -[ (isNull null) - (isNull (x: x)) - (isFunction (x: x)) - (isFunction "fnord") - (isString ("foo" + "bar")) - (isString [ "x" ]) - (isInt (1 + 2)) - (isInt { x = 123; }) - (isBool (true && false)) - (isBool null) - (isAttrs { x = 123; }) - (isAttrs null) - (typeOf (3 * 4)) - (typeOf true) - (typeOf "xyzzy") - (typeOf null) - (typeOf { x = 456; }) - (typeOf [ 1 2 3 ]) - (typeOf (x: x)) - (typeOf ((x: y: x) 1)) - (typeOf map) - (typeOf (map (x: x))) -] diff --git a/tests/lang/eval-okay-versions.exp b/tests/lang/eval-okay-versions.exp deleted file mode 100644 index 27ba77ddaf..0000000000 --- a/tests/lang/eval-okay-versions.exp +++ /dev/null @@ -1 +0,0 @@ -true diff --git a/tests/lang/eval-okay-versions.nix b/tests/lang/eval-okay-versions.nix deleted file mode 100644 index e63c36586b..0000000000 --- a/tests/lang/eval-okay-versions.nix +++ /dev/null @@ -1,40 +0,0 @@ -let - - name1 = "hello-1.0.2"; - name2 = "hello"; - name3 = "915resolution-0.5.2"; - name4 = "xf86-video-i810-1.7.4"; - - eq = 0; - lt = builtins.sub 0 1; - gt = 1; - - versionTest = v1: v2: expected: - let d1 = builtins.compareVersions v1 v2; - d2 = builtins.compareVersions v2 v1; - in d1 == builtins.sub 0 d2 && d1 == expected; - - tests = [ - ((builtins.parseDrvName name1).name == "hello") - ((builtins.parseDrvName name1).version == "1.0.2") - ((builtins.parseDrvName name2).name == "hello") - ((builtins.parseDrvName name2).version == "") - ((builtins.parseDrvName name3).name == "915resolution") - ((builtins.parseDrvName name3).version == "0.5.2") - ((builtins.parseDrvName name4).name == "xf86-video-i810") - ((builtins.parseDrvName name4).version == "1.7.4") - (versionTest "1.0" "2.3" lt) - (versionTest "2.1" "2.3" lt) - (versionTest "2.3" "2.3" eq) - (versionTest "2.5" "2.3" gt) - (versionTest "3.1" "2.3" gt) - (versionTest "2.3.1" "2.3" gt) - (versionTest "2.3.1" "2.3a" gt) - (versionTest "2.3pre1" "2.3" lt) - (versionTest "2.3pre3" "2.3pre12" lt) - (versionTest "2.3a" "2.3c" lt) - (versionTest "2.3pre1" "2.3c" lt) - (versionTest "2.3pre1" "2.3q" lt) - ]; - -in (import ./lib.nix).and tests diff --git a/tests/lang/eval-okay-with.exp b/tests/lang/eval-okay-with.exp deleted file mode 100644 index 378c8dc804..0000000000 --- a/tests/lang/eval-okay-with.exp +++ /dev/null @@ -1 +0,0 @@ -"xyzzybarxyzzybar" diff --git a/tests/lang/eval-okay-with.nix b/tests/lang/eval-okay-with.nix deleted file mode 100644 index 033e8d3aba..0000000000 --- a/tests/lang/eval-okay-with.nix +++ /dev/null @@ -1,19 +0,0 @@ -let { - - a = "xyzzy"; - - as = { - a = "foo"; - b = "bar"; - }; - - bs = { - a = "bar"; - }; - - x = with as; a + b; - - y = with as; with bs; a + b; - - body = x + y; -} diff --git a/tests/lang/eval-okay-xml.exp.xml b/tests/lang/eval-okay-xml.exp.xml deleted file mode 100644 index f124f939ed..0000000000 --- a/tests/lang/eval-okay-xml.exp.xml +++ /dev/null @@ -1,49 +0,0 @@ -<?xml version='1.0' encoding='utf-8'?> -<expr> - <attrs> - <attr name="a"> - <string value="foo" /> - </attr> - <attr name="at"> - <function> - <attrspat name="args"> - <attr name="x" /> - <attr name="y" /> - <attr name="z" /> - </attrspat> - </function> - </attr> - <attr name="b"> - <string value="bar" /> - </attr> - <attr name="c"> - <string value="foobar" /> - </attr> - <attr name="ellipsis"> - <function> - <attrspat ellipsis="1"> - <attr name="x" /> - <attr name="y" /> - <attr name="z" /> - </attrspat> - </function> - </attr> - <attr name="f"> - <function> - <attrspat> - <attr name="z" /> - <attr name="x" /> - <attr name="y" /> - </attrspat> - </function> - </attr> - <attr name="id"> - <function> - <varpat name="x" /> - </function> - </attr> - <attr name="x"> - <int value="123" /> - </attr> - </attrs> -</expr> diff --git a/tests/lang/eval-okay-xml.nix b/tests/lang/eval-okay-xml.nix deleted file mode 100644 index b9389bfae7..0000000000 --- a/tests/lang/eval-okay-xml.nix +++ /dev/null @@ -1,19 +0,0 @@ -rec { - - x = 123; - - a = "foo"; - - b = "bar"; - - c = "foo" + "bar"; - - f = {z, x, y}: if y then x else z; - - id = x: x; - - at = args@{x, y, z}: x; - - ellipsis = {x, y, z, ...}: x; - -} diff --git a/tests/lang/lib.nix b/tests/lang/lib.nix deleted file mode 100644 index 882005dc1b..0000000000 --- a/tests/lang/lib.nix +++ /dev/null @@ -1,61 +0,0 @@ -with builtins; - -rec { - - fold = op: nul: list: - if list == [] - then nul - else op (head list) (fold op nul (tail list)); - - concat = - fold (x: y: x + y) ""; - - and = fold (x: y: x && y) true; - - flatten = x: - if isList x - then fold (x: y: (flatten x) ++ y) [] x - else [x]; - - sum = fold (x: y: add x y) 0; - - hasSuffix = ext: fileName: - let lenFileName = stringLength fileName; - lenExt = stringLength ext; - in !(lessThan lenFileName lenExt) && - substring (sub lenFileName lenExt) lenFileName fileName == ext; - - # Split a list at the given position. - splitAt = pos: list: - if pos == 0 then {first = []; second = list;} else - if list == [] then {first = []; second = [];} else - let res = splitAt (sub pos 1) (tail list); - in {first = [(head list)] ++ res.first; second = res.second;}; - - # Stable merge sort. - sortBy = comp: list: - if lessThan 1 (length list) - then - let - split = splitAt (div (length list) 2) list; - first = sortBy comp split.first; - second = sortBy comp split.second; - in mergeLists comp first second - else list; - - mergeLists = comp: list1: list2: - if list1 == [] then list2 else - if list2 == [] then list1 else - if comp (head list2) (head list1) then [(head list2)] ++ mergeLists comp list1 (tail list2) else - [(head list1)] ++ mergeLists comp (tail list1) list2; - - id = x: x; - - const = x: y: x; - - range = first: last: - if builtins.lessThan last first - then [] - else [first] ++ range (builtins.add first 1) last; - -} diff --git a/tests/lang/parse-fail-dup-attrs-1.nix b/tests/lang/parse-fail-dup-attrs-1.nix deleted file mode 100644 index 2c02317d2a..0000000000 --- a/tests/lang/parse-fail-dup-attrs-1.nix +++ /dev/null @@ -1,4 +0,0 @@ -{ x = 123; - y = 456; - x = 789; -} diff --git a/tests/lang/parse-fail-dup-attrs-2.nix b/tests/lang/parse-fail-dup-attrs-2.nix deleted file mode 100644 index 864d9865e0..0000000000 --- a/tests/lang/parse-fail-dup-attrs-2.nix +++ /dev/null @@ -1,13 +0,0 @@ -let { - - as = { - x = 123; - y = 456; - }; - - bs = { - x = 789; - inherit (as) x; - }; - -} diff --git a/tests/lang/parse-fail-dup-attrs-3.nix b/tests/lang/parse-fail-dup-attrs-3.nix deleted file mode 100644 index 114d19779f..0000000000 --- a/tests/lang/parse-fail-dup-attrs-3.nix +++ /dev/null @@ -1,13 +0,0 @@ -let { - - as = { - x = 123; - y = 456; - }; - - bs = rec { - x = 789; - inherit (as) x; - }; - -} diff --git a/tests/lang/parse-fail-dup-attrs-4.nix b/tests/lang/parse-fail-dup-attrs-4.nix deleted file mode 100644 index 77417432b3..0000000000 --- a/tests/lang/parse-fail-dup-attrs-4.nix +++ /dev/null @@ -1,4 +0,0 @@ -{ - services.ssh.port = 22; - services.ssh.port = 23; -} diff --git a/tests/lang/parse-fail-dup-attrs-6.nix b/tests/lang/parse-fail-dup-attrs-6.nix deleted file mode 100644 index ae6d7a7693..0000000000 --- a/tests/lang/parse-fail-dup-attrs-6.nix +++ /dev/null @@ -1,4 +0,0 @@ -{ - services.ssh.port = 23; - services.ssh = { enable = true; }; -} diff --git a/tests/lang/parse-fail-dup-attrs-7.nix b/tests/lang/parse-fail-dup-attrs-7.nix deleted file mode 100644 index bbc3eb08c0..0000000000 --- a/tests/lang/parse-fail-dup-attrs-7.nix +++ /dev/null @@ -1,9 +0,0 @@ -rec { - - x = 1; - - as = { - inherit x; - inherit x; - }; -} \ No newline at end of file diff --git a/tests/lang/parse-fail-dup-formals.nix b/tests/lang/parse-fail-dup-formals.nix deleted file mode 100644 index a0edd91a96..0000000000 --- a/tests/lang/parse-fail-dup-formals.nix +++ /dev/null @@ -1 +0,0 @@ -{x, y, x}: x \ No newline at end of file diff --git a/tests/lang/parse-fail-patterns-1.nix b/tests/lang/parse-fail-patterns-1.nix deleted file mode 100644 index 7b40616417..0000000000 --- a/tests/lang/parse-fail-patterns-1.nix +++ /dev/null @@ -1 +0,0 @@ -args@{args, x, y, z}: x diff --git a/tests/lang/parse-fail-regression-20060610.nix b/tests/lang/parse-fail-regression-20060610.nix deleted file mode 100644 index b1934f7e1e..0000000000 --- a/tests/lang/parse-fail-regression-20060610.nix +++ /dev/null @@ -1,11 +0,0 @@ -let { - x = - {gcc}: - { - inherit gcc; - }; - - body = ({ - inherit gcc; - }).gcc; -} diff --git a/tests/lang/parse-fail-undef-var-2.nix b/tests/lang/parse-fail-undef-var-2.nix deleted file mode 100644 index c10a52b1ea..0000000000 --- a/tests/lang/parse-fail-undef-var-2.nix +++ /dev/null @@ -1,7 +0,0 @@ -let { - - f = {x, y : ["baz" "bar" z "bat"]}: x + y; - - body = f {x = "foo"; y = "bar";}; - -} diff --git a/tests/lang/parse-fail-undef-var.nix b/tests/lang/parse-fail-undef-var.nix deleted file mode 100644 index 7b63008110..0000000000 --- a/tests/lang/parse-fail-undef-var.nix +++ /dev/null @@ -1 +0,0 @@ -x: y diff --git a/tests/lang/parse-okay-1.nix b/tests/lang/parse-okay-1.nix deleted file mode 100644 index 23a58ed109..0000000000 --- a/tests/lang/parse-okay-1.nix +++ /dev/null @@ -1 +0,0 @@ -{x, y, z}: x + y + z diff --git a/tests/lang/parse-okay-crlf.nix b/tests/lang/parse-okay-crlf.nix deleted file mode 100644 index 21518d4c6d..0000000000 --- a/tests/lang/parse-okay-crlf.nix +++ /dev/null @@ -1,17 +0,0 @@ -rec { - - /* Dit is - een test. */ - - x = - # Dit is een test. y; - - y = 123; - - # CR or CR/LF (but not explicit \r's) in strings should be - # translated to LF. - foo = "multi line - string - test\r"; - - z = 456; } diff --git a/tests/lang/parse-okay-dup-attrs-5.nix b/tests/lang/parse-okay-dup-attrs-5.nix deleted file mode 100644 index f4b9efd0c5..0000000000 --- a/tests/lang/parse-okay-dup-attrs-5.nix +++ /dev/null @@ -1,4 +0,0 @@ -{ - services.ssh = { enable = true; }; - services.ssh.port = 23; -} diff --git a/tests/lang/parse-okay-regression-20041027.nix b/tests/lang/parse-okay-regression-20041027.nix deleted file mode 100644 index ae2e256eea..0000000000 --- a/tests/lang/parse-okay-regression-20041027.nix +++ /dev/null @@ -1,11 +0,0 @@ -{stdenv, fetchurl /* pkgconfig, libX11 */ }: - -stdenv.mkDerivation { - name = "libXi-6.0.1"; - src = fetchurl { - url = http://freedesktop.org/~xlibs/release/libXi-6.0.1.tar.bz2; - md5 = "7e935a42428d63a387b3c048be0f2756"; - }; -/* buildInputs = [pkgconfig]; - propagatedBuildInputs = [libX11]; */ -} diff --git a/tests/lang/parse-okay-subversion.nix b/tests/lang/parse-okay-subversion.nix deleted file mode 100644 index 356272815d..0000000000 --- a/tests/lang/parse-okay-subversion.nix +++ /dev/null @@ -1,43 +0,0 @@ -{ localServer ? false -, httpServer ? false -, sslSupport ? false -, pythonBindings ? false -, javaSwigBindings ? false -, javahlBindings ? false -, stdenv, fetchurl -, openssl ? null, httpd ? null, db4 ? null, expat, swig ? null, j2sdk ? null -}: - -assert expat != null; -assert localServer -> db4 != null; -assert httpServer -> httpd != null && httpd.expat == expat; -assert sslSupport -> openssl != null && (httpServer -> httpd.openssl == openssl); -assert pythonBindings -> swig != null && swig.pythonSupport; -assert javaSwigBindings -> swig != null && swig.javaSupport; -assert javahlBindings -> j2sdk != null; - -stdenv.mkDerivation { - name = "subversion-1.1.1"; - - builder = /foo/bar; - src = fetchurl { - url = http://subversion.tigris.org/tarballs/subversion-1.1.1.tar.bz2; - md5 = "a180c3fe91680389c210c99def54d9e0"; - }; - - # This is a hopefully temporary fix for the problem that - # libsvnjavahl.so isn't linked against libstdc++, which causes - # loading the library into the JVM to fail. - patches = if javahlBindings then [/javahl.patch] else []; - - openssl = if sslSupport then openssl else null; - httpd = if httpServer then httpd else null; - db4 = if localServer then db4 else null; - swig = if pythonBindings || javaSwigBindings then swig else null; - python = if pythonBindings then swig.python else null; - j2sdk = if javaSwigBindings then swig.j2sdk else - if javahlBindings then j2sdk else null; - - inherit expat localServer httpServer sslSupport - pythonBindings javaSwigBindings javahlBindings; -} diff --git a/tests/lang/parse-okay-url.nix b/tests/lang/parse-okay-url.nix deleted file mode 100644 index fce3b13ee6..0000000000 --- a/tests/lang/parse-okay-url.nix +++ /dev/null @@ -1,7 +0,0 @@ -[ x:x - https://svn.cs.uu.nl:12443/repos/trace/trunk - http://www2.mplayerhq.hu/MPlayer/releases/fonts/font-arial-iso-8859-1.tar.bz2 - http://losser.st-lab.cs.uu.nl/~armijn/.nix/gcc-3.3.4-static-nix.tar.gz - http://fpdownload.macromedia.com/get/shockwave/flash/english/linux/7.0r25/install_flash_player_7_linux.tar.gz - ftp://ftp.gtk.org/pub/gtk/v1.2/gtk+-1.2.10.tar.gz -] diff --git a/tests/local.mk b/tests/local.mk deleted file mode 100644 index ab170dfe51..0000000000 --- a/tests/local.mk +++ /dev/null @@ -1,21 +0,0 @@ -check: - @echo "Warning: Nix has no 'make check'. Please install Nix and run 'make installcheck' instead." - -nix_tests = \ - init.sh hash.sh lang.sh add.sh simple.sh dependencies.sh \ - parallel.sh build-hook.sh substitutes.sh substitutes2.sh \ - fallback.sh nix-push.sh gc.sh gc-concurrent.sh nix-pull.sh \ - referrers.sh user-envs.sh logging.sh nix-build.sh misc.sh fixed.sh \ - gc-runtime.sh install-package.sh check-refs.sh filter-source.sh \ - remote-store.sh export.sh export-graph.sh negative-caching.sh \ - binary-patching.sh timeout.sh secure-drv-outputs.sh nix-channel.sh \ - multiple-outputs.sh import-derivation.sh fetchurl.sh optimise-store.sh \ - binary-cache.sh nix-profile.sh repair.sh dump-db.sh - -install-tests += $(foreach x, $(nix_tests), tests/$(x)) - -tests-environment = NIX_REMOTE= $(bash) -e - -clean-files += $(d)/common.sh - -installcheck: $(d)/common.sh diff --git a/tests/logging.sh b/tests/logging.sh deleted file mode 100644 index 5ba71c3e40..0000000000 --- a/tests/logging.sh +++ /dev/null @@ -1,34 +0,0 @@ -source common.sh - -clearStore - -# Produce an escaped log file. -set -x -path=$(nix-build --log-type escapes -vv dependencies.nix --no-out-link 2> $TEST_ROOT/log.esc) - -# Convert it to an XML representation. -nix-log2xml < $TEST_ROOT/log.esc > $TEST_ROOT/log.xml - -# Is this well-formed XML? -if test "$xmllint" != "false"; then - $xmllint --noout $TEST_ROOT/log.xml || fail "malformed XML" -fi - -# Convert to HTML. -if test "$xsltproc" != "false"; then - (cd $datadir/nix/log2html && $xsltproc mark-errors.xsl - | $xsltproc log2html.xsl -) < $TEST_ROOT/log.xml > $TEST_ROOT/log.html - # Ideally we would check that the generated HTML is valid... - - # A few checks... - grep "<code>.*FOO" $TEST_ROOT/log.html || fail "bad HTML output" -fi - -# Test nix-store -l. -[ "$(nix-store -l $path)" = FOO ] - -# Test compressed logs. -clearStore -rm -rf $NIX_LOG_DIR -! nix-store -l $path -nix-build dependencies.nix --no-out-link --option build-compress-log true -[ "$(nix-store -l $path)" = FOO ] diff --git a/tests/misc.sh b/tests/misc.sh deleted file mode 100644 index 1b4d8f2cfc..0000000000 --- a/tests/misc.sh +++ /dev/null @@ -1,16 +0,0 @@ -source common.sh - -# Tests miscellaneous commands. - -# Do all commands have help? -#nix-env --help | grep -q install -#nix-store --help | grep -q realise -#nix-instantiate --help | grep -q eval -#nix-hash --help | grep -q base32 - -# Can we ask for the version number? -nix-env --version | grep "$version" - -# Usage errors. -nix-env --foo 2>&1 | grep "no operation" -nix-env -q --foo 2>&1 | grep "unknown flag" diff --git a/tests/multiple-outputs.nix b/tests/multiple-outputs.nix deleted file mode 100644 index 4a9010d186..0000000000 --- a/tests/multiple-outputs.nix +++ /dev/null @@ -1,68 +0,0 @@ -with import ./config.nix; - -rec { - - a = mkDerivation { - name = "multiple-outputs-a"; - outputs = [ "first" "second" ]; - builder = builtins.toFile "builder.sh" - '' - mkdir $first $second - test -z $all - echo "first" > $first/file - echo "second" > $second/file - ln -s $first $second/link - ''; - helloString = "Hello, world!"; - }; - - b = mkDerivation { - defaultOutput = assert a.second.helloString == "Hello, world!"; a; - firstOutput = assert a.outputName == "first"; a.first.first; - secondOutput = assert a.second.outputName == "second"; a.second.first.first.second.second.first.second; - allOutputs = a.all; - name = "multiple-outputs-b"; - builder = builtins.toFile "builder.sh" - '' - mkdir $out - test "$firstOutput $secondOutput" = "$allOutputs" - test "$defaultOutput" = "$firstOutput" - test "$(cat $firstOutput/file)" = "first" - test "$(cat $secondOutput/file)" = "second" - echo "success" > $out/file - ''; - }; - - c = mkDerivation { - name = "multiple-outputs-c"; - drv = b.drvPath; - builder = builtins.toFile "builder.sh" - '' - mkdir $out - ln -s $drv $out/drv - ''; - }; - - d = mkDerivation { - name = "multiple-outputs-d"; - drv = builtins.unsafeDiscardOutputDependency b.drvPath; - builder = builtins.toFile "builder.sh" - '' - mkdir $out - echo $drv > $out/drv - ''; - }; - - cyclic = (mkDerivation { - name = "cyclic-outputs"; - outputs = [ "a" "b" "c" ]; - builder = builtins.toFile "builder.sh" - '' - mkdir $a $b $c - echo $a > $b/foo - echo $b > $c/bar - echo $c > $a/baz - ''; - }).a; - -} diff --git a/tests/multiple-outputs.sh b/tests/multiple-outputs.sh deleted file mode 100644 index ac622a7b4e..0000000000 --- a/tests/multiple-outputs.sh +++ /dev/null @@ -1,63 +0,0 @@ -source common.sh - -clearStore - -# Test whether read-only evaluation works when referring to the -# ‘drvPath’ attribute. -echo "evaluating c..." -#drvPath=$(nix-instantiate multiple-outputs.nix -A c --readonly-mode) - -# And check whether the resulting derivation explicitly depends on all -# outputs. -drvPath=$(nix-instantiate multiple-outputs.nix -A c) -#[ "$drvPath" = "$drvPath2" ] -grep -q 'multiple-outputs-a.drv",\["first","second"\]' $drvPath -grep -q 'multiple-outputs-b.drv",\["out"\]' $drvPath - -# While we're at it, test the ‘unsafeDiscardOutputDependency’ primop. -outPath=$(nix-build multiple-outputs.nix -A d --no-out-link) -drvPath=$(cat $outPath/drv) -outPath=$(nix-store -q $drvPath) -! [ -e "$outPath" ] - -# Do a build of something that depends on a derivation with multiple -# outputs. -echo "building b..." -outPath=$(nix-build multiple-outputs.nix -A b --no-out-link) -echo "output path is $outPath" -[ "$(cat "$outPath"/file)" = "success" ] - -# Test nix-build on a derivation with multiple outputs. -nix-build multiple-outputs.nix -A a -o $TEST_ROOT/result -[ -e $TEST_ROOT/result-first ] -! [ -e $TEST_ROOT/result-second ] -nix-build multiple-outputs.nix -A a.all -o $TEST_ROOT/result -[ "$(cat $TEST_ROOT/result-first/file)" = "first" ] -[ "$(cat $TEST_ROOT/result-second/file)" = "second" ] -[ "$(cat $TEST_ROOT/result-second/link/file)" = "first" ] -hash1=$(nix-store -q --hash $TEST_ROOT/result-second) - -# Delete one of the outputs and rebuild it. This will cause a hash -# rewrite. -nix-store --delete $TEST_ROOT/result-second --ignore-liveness -nix-build multiple-outputs.nix -A a.all -o $TEST_ROOT/result -[ "$(cat $TEST_ROOT/result-second/file)" = "second" ] -[ "$(cat $TEST_ROOT/result-second/link/file)" = "first" ] -hash2=$(nix-store -q --hash $TEST_ROOT/result-second) -[ "$hash1" = "$hash2" ] - -# Make sure that nix-build works on derivations with multiple outputs. -echo "building a.first..." -nix-build multiple-outputs.nix -A a.first --no-out-link - -# Cyclic outputs should be rejected. -echo "building cyclic..." -if nix-build multiple-outputs.nix -A cyclic --no-out-link; then - echo "Cyclic outputs incorrectly accepted!" - exit 1 -fi - -echo "collecting garbage..." -rm $TEST_ROOT/result* -nix-store --gc --option gc-keep-derivations true --option gc-keep-outputs true -nix-store --gc --print-roots diff --git a/tests/negative-caching.nix b/tests/negative-caching.nix deleted file mode 100644 index 10df67a748..0000000000 --- a/tests/negative-caching.nix +++ /dev/null @@ -1,21 +0,0 @@ -with import ./config.nix; - -rec { - - fail = mkDerivation { - name = "fail"; - builder = builtins.toFile "builder.sh" "echo FAIL; exit 1"; - }; - - succeed = mkDerivation { - name = "succeed"; - builder = builtins.toFile "builder.sh" "echo SUCCEED; mkdir $out"; - }; - - depOnFail = mkDerivation { - name = "dep-on-fail"; - builder = builtins.toFile "builder.sh" "echo URGH; mkdir $out"; - inputs = [fail succeed]; - }; - -} diff --git a/tests/negative-caching.sh b/tests/negative-caching.sh deleted file mode 100644 index 4217bc38e1..0000000000 --- a/tests/negative-caching.sh +++ /dev/null @@ -1,22 +0,0 @@ -source common.sh - -clearStore - -set +e - -opts="--option build-cache-failure true --print-build-trace" - -# This build should fail, and the failure should be cached. -log=$(nix-build $opts negative-caching.nix -A fail --no-out-link 2>&1) && fail "should fail" -echo "$log" | grep -q "@ build-failed" || fail "no build-failed trace" - -# Do it again. The build shouldn't be tried again. -log=$(nix-build $opts negative-caching.nix -A fail --no-out-link 2>&1) && fail "should fail" -echo "$log" | grep -q "FAIL" && fail "failed build not cached" -echo "$log" | grep -q "@ build-failed .* cached" || fail "trace doesn't say cached" - -# Check that --keep-going works properly with cached failures. -log=$(nix-build $opts --keep-going negative-caching.nix -A depOnFail --no-out-link 2>&1) && fail "should fail" -echo "$log" | grep -q "FAIL" && fail "failed build not cached (2)" -echo "$log" | grep -q "@ build-failed .* cached" || fail "trace doesn't say cached (2)" -echo "$log" | grep -q "@ build-succeeded .*-succeed" || fail "didn't keep going" diff --git a/tests/nix-build.sh b/tests/nix-build.sh deleted file mode 100644 index dc0e99c736..0000000000 --- a/tests/nix-build.sh +++ /dev/null @@ -1,19 +0,0 @@ -source common.sh - -clearStore - -nix-build dependencies.nix -o $TEST_ROOT/result -test "$(cat $TEST_ROOT/result/foobar)" = FOOBAR - -# The result should be retained by a GC. -echo A -target=$(readLink $TEST_ROOT/result) -echo B -echo target is $target -nix-store --gc -test -e $target/foobar - -# But now it should be gone. -rm $TEST_ROOT/result -nix-store --gc -if test -e $target/foobar; then false; fi diff --git a/tests/nix-channel.sh b/tests/nix-channel.sh deleted file mode 100644 index a25d56bec1..0000000000 --- a/tests/nix-channel.sh +++ /dev/null @@ -1,43 +0,0 @@ -source common.sh - -clearProfiles -clearManifests - -rm -f $TEST_ROOT/.nix-channels - -# Override location of ~/.nix-channels. -export HOME=$TEST_ROOT - -# Test add/list/remove. -nix-channel --add http://foo/bar xyzzy -nix-channel --list | grep -q http://foo/bar -nix-channel --remove xyzzy - -[ -e $TEST_ROOT/.nix-channels ] -[ "$(cat $TEST_ROOT/.nix-channels)" = '' ] - -# Create a channel. -rm -rf $TEST_ROOT/foo -mkdir -p $TEST_ROOT/foo -nix-push --dest $TEST_ROOT/foo --manifest --bzip2 $(nix-store -r $(nix-instantiate dependencies.nix)) -rm -rf $TEST_ROOT/nixexprs -mkdir -p $TEST_ROOT/nixexprs -cp config.nix dependencies.nix dependencies.builder*.sh $TEST_ROOT/nixexprs/ -ln -s dependencies.nix $TEST_ROOT/nixexprs/default.nix -(cd $TEST_ROOT && tar cvf - nixexprs) | bzip2 > $TEST_ROOT/foo/nixexprs.tar.bz2 - -# Test the update action. -nix-channel --add file://$TEST_ROOT/foo -nix-channel --update - -# Do a query. -nix-env -qa \* --meta --xml --out-path > $TEST_ROOT/meta.xml -if [ "$xmllint" != false ]; then - $xmllint --noout $TEST_ROOT/meta.xml || fail "malformed XML" -fi -grep -q 'meta.*description.*Random test package' $TEST_ROOT/meta.xml -grep -q 'item.*attrPath="foo".*name="dependencies"' $TEST_ROOT/meta.xml - -# Do an install. -nix-env -i dependencies -[ -e $TEST_ROOT/var/nix/profiles/default/foobar ] diff --git a/tests/nix-copy-closure.nix b/tests/nix-copy-closure.nix deleted file mode 100644 index 66c19a45d4..0000000000 --- a/tests/nix-copy-closure.nix +++ /dev/null @@ -1,54 +0,0 @@ -# Test ‘nix-copy-closure’. - -{ system, nix }: - -with import <nixpkgs/nixos/lib/testing.nix> { inherit system; }; - -makeTest ({ pkgs, ... }: let pkgA = pkgs.aterm; pkgB = pkgs.wget; in { - - nodes = - { client = - { config, pkgs, ... }: - { virtualisation.writableStore = true; - virtualisation.pathsInNixDB = [ pkgA ]; - environment.nix = nix; - }; - - server = - { config, pkgs, ... }: - { services.openssh.enable = true; - virtualisation.writableStore = true; - virtualisation.pathsInNixDB = [ pkgB ]; - environment.nix = nix; - }; - }; - - testScript = { nodes }: - '' - startAll; - - # Create an SSH key on the client. - my $key = `${pkgs.openssh}/bin/ssh-keygen -t dsa -f key -N ""`; - $client->succeed("mkdir -m 700 /root/.ssh"); - $client->copyFileFromHost("key", "/root/.ssh/id_dsa"); - $client->succeed("chmod 600 /root/.ssh/id_dsa"); - - # Install the SSH key on the server. - $server->succeed("mkdir -m 700 /root/.ssh"); - $server->copyFileFromHost("key.pub", "/root/.ssh/authorized_keys"); - $server->waitForUnit("sshd"); - $client->waitForUnit("network.target"); - $client->succeed("ssh -o StrictHostKeyChecking=no " . $server->name() . " 'echo hello world'"); - - # Copy the closure of package A from the client to the server. - $server->fail("nix-store --check-validity ${pkgA}"); - $client->succeed("nix-copy-closure --to server --gzip ${pkgA} >&2"); - $server->succeed("nix-store --check-validity ${pkgA}"); - - # Copy the closure of package B from the server to the client. - $client->fail("nix-store --check-validity ${pkgB}"); - $client->succeed("nix-copy-closure --from server --gzip ${pkgB} >&2"); - $client->succeed("nix-store --check-validity ${pkgB}"); - ''; - -}) diff --git a/tests/nix-profile.sh b/tests/nix-profile.sh deleted file mode 100644 index 3586a7efc3..0000000000 --- a/tests/nix-profile.sh +++ /dev/null @@ -1,10 +0,0 @@ -source common.sh - -home=$TEST_ROOT/home -rm -rf $home -mkdir -p $home -HOME=$home $SHELL -e -c ". ../scripts/nix-profile.sh" -HOME=$home $SHELL -e -c ". ../scripts/nix-profile.sh" # test idempotency - -[ -L $home/.nix-profile ] -[ -e $home/.nix-channels ] diff --git a/tests/nix-pull.sh b/tests/nix-pull.sh deleted file mode 100644 index 87239948c4..0000000000 --- a/tests/nix-pull.sh +++ /dev/null @@ -1,33 +0,0 @@ -source common.sh - -pullCache () { - echo "pulling cache..." - nix-pull file://$TEST_ROOT/cache/MANIFEST -} - -clearStore -clearManifests -pullCache - -drvPath=$(nix-instantiate dependencies.nix) -outPath=$(nix-store -q $drvPath) - -echo "building $outPath using substitutes..." -nix-store -r $outPath - -cat $outPath/input-2/bar - -clearStore -clearManifests -pullCache - -echo "building $drvPath using substitutes..." -nix-store -r $drvPath - -cat $outPath/input-2/bar - -# Check that the derivers are set properly. -test $(nix-store -q --deriver "$outPath") = "$drvPath" -nix-store -q --deriver $(readLink $outPath/input-2) | grep -q -- "-input-2.drv" - -clearManifests diff --git a/tests/nix-push.sh b/tests/nix-push.sh deleted file mode 100644 index 8ea59516c6..0000000000 --- a/tests/nix-push.sh +++ /dev/null @@ -1,12 +0,0 @@ -source common.sh - -clearStore - -drvPath=$(nix-instantiate dependencies.nix) -outPath=$(nix-store -r $drvPath) - -echo "pushing $drvPath" - -mkdir -p $TEST_ROOT/cache - -nix-push --dest $TEST_ROOT/cache --manifest $drvPath --bzip2 diff --git a/tests/optimise-store.sh b/tests/optimise-store.sh deleted file mode 100644 index ea4478693e..0000000000 --- a/tests/optimise-store.sh +++ /dev/null @@ -1,43 +0,0 @@ -source common.sh - -clearStore - -outPath1=$(echo 'with import ./config.nix; mkDerivation { name = "foo1"; builder = builtins.toFile "builder" "mkdir $out; echo hello > $out/foo"; }' | nix-build - --no-out-link --option auto-optimise-store true) -outPath2=$(echo 'with import ./config.nix; mkDerivation { name = "foo2"; builder = builtins.toFile "builder" "mkdir $out; echo hello > $out/foo"; }' | nix-build - --no-out-link --option auto-optimise-store true) - -inode1="$(perl -e "print ((lstat('$outPath1/foo'))[1])")" -inode2="$(perl -e "print ((lstat('$outPath2/foo'))[1])")" -if [ "$inode1" != "$inode2" ]; then - echo "inodes do not match" - exit 1 -fi - -nlink="$(perl -e "print ((lstat('$outPath1/foo'))[3])")" -if [ "$nlink" != 3 ]; then - echo "link count incorrect" - exit 1 -fi - -outPath3=$(echo 'with import ./config.nix; mkDerivation { name = "foo3"; builder = builtins.toFile "builder" "mkdir $out; echo hello > $out/foo"; }' | nix-build - --no-out-link) - -inode3="$(perl -e "print ((lstat('$outPath3/foo'))[1])")" -if [ "$inode1" = "$inode3" ]; then - echo "inodes match unexpectedly" - exit 1 -fi - -nix-store --optimise - -inode1="$(perl -e "print ((lstat('$outPath1/foo'))[1])")" -inode3="$(perl -e "print ((lstat('$outPath3/foo'))[1])")" -if [ "$inode1" != "$inode3" ]; then - echo "inodes do not match" - exit 1 -fi - -nix-store --gc - -if [ -n "$(ls $NIX_STORE_DIR/.links)" ]; then - echo ".links directory not empty after GC" - exit 1 -fi diff --git a/tests/parallel.builder.sh b/tests/parallel.builder.sh deleted file mode 100644 index d092bc5a6b..0000000000 --- a/tests/parallel.builder.sh +++ /dev/null @@ -1,29 +0,0 @@ -echo "DOING $text" - - -# increase counter -while ! ln -s x $shared.lock 2> /dev/null; do - sleep 1 -done -test -f $shared.cur || echo 0 > $shared.cur -test -f $shared.max || echo 0 > $shared.max -new=$(($(cat $shared.cur) + 1)) -if test $new -gt $(cat $shared.max); then - echo $new > $shared.max -fi -echo $new > $shared.cur -rm $shared.lock - - -echo -n $(cat $inputs)$text > $out - -sleep $sleepTime - - -# decrease counter -while ! ln -s x $shared.lock 2> /dev/null; do - sleep 1 -done -test -f $shared.cur || echo 0 > $shared.cur -echo $(($(cat $shared.cur) - 1)) > $shared.cur -rm $shared.lock diff --git a/tests/parallel.nix b/tests/parallel.nix deleted file mode 100644 index 23f142059f..0000000000 --- a/tests/parallel.nix +++ /dev/null @@ -1,19 +0,0 @@ -{sleepTime ? 3}: - -with import ./config.nix; - -let - - mkDrv = text: inputs: mkDerivation { - name = "parallel"; - builder = ./parallel.builder.sh; - inherit text inputs shared sleepTime; - }; - - a = mkDrv "a" []; - b = mkDrv "b" [a]; - c = mkDrv "c" [a]; - d = mkDrv "d" [a]; - e = mkDrv "e" [b c d]; - -in e diff --git a/tests/parallel.sh b/tests/parallel.sh deleted file mode 100644 index 3b7bbe5a22..0000000000 --- a/tests/parallel.sh +++ /dev/null @@ -1,56 +0,0 @@ -source common.sh - - -# First, test that -jN performs builds in parallel. -echo "testing nix-build -j..." - -clearStore - -rm -f $_NIX_TEST_SHARED.cur $_NIX_TEST_SHARED.max - -outPath=$(nix-build -j10000 parallel.nix --no-out-link) - -echo "output path is $outPath" - -text=$(cat "$outPath") -if test "$text" != "abacade"; then exit 1; fi - -if test "$(cat $_NIX_TEST_SHARED.cur)" != 0; then fail "wrong current process count"; fi -if test "$(cat $_NIX_TEST_SHARED.max)" != 3; then fail "not enough parallelism"; fi - - -# Second, test that parallel invocations of nix-build perform builds -# in parallel, and don't block waiting on locks held by the others. -echo "testing multiple nix-build -j1..." - -clearStore - -rm -f $_NIX_TEST_SHARED.cur $_NIX_TEST_SHARED.max - -drvPath=$(nix-instantiate parallel.nix --argstr sleepTime 15) - -cmd="nix-store -j1 -r $drvPath" - -$cmd & -pid1=$! -echo "pid 1 is $pid1" - -$cmd & -pid2=$! -echo "pid 2 is $pid2" - -$cmd & -pid3=$! -echo "pid 3 is $pid3" - -$cmd & -pid4=$! -echo "pid 4 is $pid4" - -wait $pid1 || fail "instance 1 failed: $?" -wait $pid2 || fail "instance 2 failed: $?" -wait $pid3 || fail "instance 3 failed: $?" -wait $pid4 || fail "instance 4 failed: $?" - -if test "$(cat $_NIX_TEST_SHARED.cur)" != 0; then fail "wrong current process count"; fi -if test "$(cat $_NIX_TEST_SHARED.max)" != 3; then fail "not enough parallelism"; fi diff --git a/tests/referrers.sh b/tests/referrers.sh deleted file mode 100644 index 0a1c86e0ab..0000000000 --- a/tests/referrers.sh +++ /dev/null @@ -1,36 +0,0 @@ -source common.sh - -clearStore - -max=500 - -reference=$NIX_STORE_DIR/abcdef -touch $reference -(echo $reference && echo && echo 0) | nix-store --register-validity - -echo "making registration..." - -set +x -for ((n = 0; n < $max; n++)); do - storePath=$NIX_STORE_DIR/$n - echo -n > $storePath - ref2=$NIX_STORE_DIR/$((n+1)) - if test $((n+1)) = $max; then - ref2=$reference - fi - echo $storePath; echo; echo 2; echo $reference; echo $ref2 -done > $TEST_ROOT/reg_info -set -x - -echo "registering..." - -nix-store --register-validity < $TEST_ROOT/reg_info - -echo "collecting garbage..." -ln -sfn $reference "$NIX_STATE_DIR"/gcroots/ref -nix-store --gc - -if [ -n "$(type -p sqlite3)" -a "$(sqlite3 ./test-tmp/db/db.sqlite 'select count(*) from Refs')" -ne 0 ]; then - echo "referrers not cleaned up" - exit 1 -fi diff --git a/tests/remote-builds.nix b/tests/remote-builds.nix deleted file mode 100644 index 56514e1749..0000000000 --- a/tests/remote-builds.nix +++ /dev/null @@ -1,98 +0,0 @@ -# Test Nix's remote build feature. - -{ system, nix }: - -with import <nixpkgs/nixos/lib/testing.nix> { inherit system; }; - -makeTest ({ pkgs, ... }: - -let - - # The configuration of the build slaves. - slave = - { config, pkgs, ... }: - { services.openssh.enable = true; - virtualisation.writableStore = true; - environment.nix = nix; - }; - - # Trivial Nix expression to build remotely. - expr = config: nr: pkgs.writeText "expr.nix" - '' - let utils = builtins.storePath ${config.system.build.extraUtils}; in - derivation { - name = "hello-${toString nr}"; - system = "i686-linux"; - PATH = "''${utils}/bin"; - builder = "''${utils}/bin/sh"; - args = [ "-c" "echo Hello; mkdir $out; cat /proc/sys/kernel/hostname > $out/host; sleep 3" ]; - } - ''; - -in - -{ - - nodes = - { slave1 = slave; - slave2 = slave; - - client = - { config, pkgs, ... }: - { nix.maxJobs = 0; # force remote building - nix.distributedBuilds = true; - nix.buildMachines = - [ { hostName = "slave1"; - sshUser = "root"; - sshKey = "/root/.ssh/id_dsa"; - system = "i686-linux"; - maxJobs = 1; - } - { hostName = "slave2"; - sshUser = "root"; - sshKey = "/root/.ssh/id_dsa"; - system = "i686-linux"; - maxJobs = 1; - } - ]; - virtualisation.writableStore = true; - virtualisation.pathsInNixDB = [ config.system.build.extraUtils ]; - environment.nix = nix; - }; - }; - - testScript = { nodes }: - '' - startAll; - - # Create an SSH key on the client. - my $key = `${pkgs.openssh}/bin/ssh-keygen -t dsa -f key -N ""`; - $client->succeed("mkdir -m 700 /root/.ssh"); - $client->copyFileFromHost("key", "/root/.ssh/id_dsa"); - $client->succeed("chmod 600 /root/.ssh/id_dsa"); - - # Install the SSH key on the slaves. - $client->waitForUnit("network.target"); - foreach my $slave ($slave1, $slave2) { - $slave->succeed("mkdir -m 700 /root/.ssh"); - $slave->copyFileFromHost("key.pub", "/root/.ssh/authorized_keys"); - $slave->waitForUnit("sshd"); - $client->succeed("ssh -o StrictHostKeyChecking=no " . $slave->name() . " 'echo hello world'"); - } - - # Perform a build and check that it was performed on the slave. - my $out = $client->succeed("nix-build ${expr nodes.client.config 1}"); - $slave1->succeed("test -e $out"); - - # And a parallel build. - my ($out1, $out2) = split /\s/, - $client->succeed("nix-store -r \$(nix-instantiate ${expr nodes.client.config 2} ${expr nodes.client.config 3})"); - $slave1->succeed("test -e $out1 -o -e $out2"); - $slave2->succeed("test -e $out1 -o -e $out2"); - - # Test whether the build hook automatically skips unavailable slaves. - $slave1->block; - $client->succeed("nix-build ${expr nodes.client.config 4}"); - ''; - -}) diff --git a/tests/remote-store.sh b/tests/remote-store.sh deleted file mode 100644 index 8312424f0a..0000000000 --- a/tests/remote-store.sh +++ /dev/null @@ -1,16 +0,0 @@ -source common.sh - -clearStore -clearManifests - -startDaemon - -$SHELL ./user-envs.sh - -nix-store --dump-db > $TEST_ROOT/d1 -NIX_REMOTE= nix-store --dump-db > $TEST_ROOT/d2 -cmp $TEST_ROOT/d1 $TEST_ROOT/d2 - -nix-store --gc --max-freed 1K - -killDaemon diff --git a/tests/repair.sh b/tests/repair.sh deleted file mode 100644 index ae82b649c6..0000000000 --- a/tests/repair.sh +++ /dev/null @@ -1,65 +0,0 @@ -source common.sh - -clearStore - -path=$(nix-build dependencies.nix -o $TEST_ROOT/result) -path2=$(nix-store -qR $path | grep input-2) - -nix-store --verify --check-contents -v - -hash=$(nix-hash $path2) - -# Corrupt a path and check whether nix-build --repair can fix it. -chmod u+w $path2 -touch $path2/bad - -if nix-store --verify --check-contents -v; then - echo "nix-store --verify succeeded unexpectedly" >&2 - exit 1 -fi - -if nix-store --verify --check-contents --repair; then - echo "nix-store --verify --repair succeeded unexpectedly" >&2 - exit 1 -fi - -nix-build dependencies.nix -o $TEST_ROOT/result --repair - -if [ "$(nix-hash $path2)" != "$hash" -o -e $path2/bad ]; then - echo "path not repaired properly" >&2 - exit 1 -fi - -# Corrupt a path that has a substitute and check whether nix-store -# --verify can fix it. -clearCache - -nix-push --dest $cacheDir $path - -chmod u+w $path2 -rm -rf $path2 - -nix-store --verify --check-contents --repair --option binary-caches "file://$cacheDir" - -if [ "$(nix-hash $path2)" != "$hash" -o -e $path2/bad ]; then - echo "path not repaired properly" >&2 - exit 1 -fi - -# Check --verify-path and --repair-path. -nix-store --verify-path $path2 - -chmod u+w $path2 -rm -rf $path2 - -if nix-store --verify-path $path2; then - echo "nix-store --verify-path succeeded unexpectedly" >&2 - exit 1 -fi - -nix-store --repair-path $path2 --option binary-caches "file://$cacheDir" - -if [ "$(nix-hash $path2)" != "$hash" -o -e $path2/bad ]; then - echo "path not repaired properly" >&2 - exit 1 -fi diff --git a/tests/secure-drv-outputs.nix b/tests/secure-drv-outputs.nix deleted file mode 100644 index b4ac8ff531..0000000000 --- a/tests/secure-drv-outputs.nix +++ /dev/null @@ -1,23 +0,0 @@ -with import ./config.nix; - -{ - - good = mkDerivation { - name = "good"; - builder = builtins.toFile "builder" - '' - mkdir $out - echo > $out/good - ''; - }; - - bad = mkDerivation { - name = "good"; - builder = builtins.toFile "builder" - '' - mkdir $out - echo > $out/bad - ''; - }; - -} diff --git a/tests/secure-drv-outputs.sh b/tests/secure-drv-outputs.sh deleted file mode 100644 index 4888123da9..0000000000 --- a/tests/secure-drv-outputs.sh +++ /dev/null @@ -1,37 +0,0 @@ -# Test that users cannot register specially-crafted derivations that -# produce output paths belonging to other derivations. This could be -# used to inject malware into the store. - -source common.sh - -clearStore -clearManifests - -startDaemon - -# Determine the output path of the "good" derivation. -goodOut=$(nix-store -q $(nix-instantiate ./secure-drv-outputs.nix -A good)) - -# Instantiate the "bad" derivation. -badDrv=$(nix-instantiate ./secure-drv-outputs.nix -A bad) -badOut=$(nix-store -q $badDrv) - -# Rewrite the bad derivation to produce the output path of the good -# derivation. -rm -f $TEST_ROOT/bad.drv -sed -e "s|$badOut|$goodOut|g" < $badDrv > $TEST_ROOT/bad.drv - -# Add the manipulated derivation to the store and build it. This -# should fail. -if badDrv2=$(nix-store --add $TEST_ROOT/bad.drv); then - nix-store -r "$badDrv2" -fi - -# Now build the good derivation. -goodOut2=$(nix-build ./secure-drv-outputs.nix -A good --no-out-link) -test "$goodOut" = "$goodOut2" - -if ! test -e "$goodOut"/good; then - echo "Bad derivation stole the output path of the good derivation!" - exit 1 -fi diff --git a/tests/simple.builder.sh b/tests/simple.builder.sh deleted file mode 100644 index 569e8ca88c..0000000000 --- a/tests/simple.builder.sh +++ /dev/null @@ -1,11 +0,0 @@ -echo "PATH=$PATH" - -# Verify that the PATH is empty. -if mkdir foo 2> /dev/null; then exit 1; fi - -# Set a PATH (!!! impure). -export PATH=$goodPath - -mkdir $out - -echo "Hello World!" > $out/hello \ No newline at end of file diff --git a/tests/simple.nix b/tests/simple.nix deleted file mode 100644 index 4223c0f23a..0000000000 --- a/tests/simple.nix +++ /dev/null @@ -1,8 +0,0 @@ -with import ./config.nix; - -mkDerivation { - name = "simple"; - builder = ./simple.builder.sh; - PATH = ""; - goodPath = path; -} diff --git a/tests/simple.sh b/tests/simple.sh deleted file mode 100644 index af8bccc2b4..0000000000 --- a/tests/simple.sh +++ /dev/null @@ -1,25 +0,0 @@ -source common.sh - -drvPath=$(nix-instantiate simple.nix) - -test "$(nix-store -q --binding system "$drvPath")" = "$system" - -echo "derivation is $drvPath" - -outPath=$(nix-store -rvv "$drvPath") - -echo "output path is $outPath" - -text=$(cat "$outPath"/hello) -if test "$text" != "Hello World!"; then exit 1; fi - -# Directed delete: $outPath is not reachable from a root, so it should -# be deleteable. -nix-store --delete $outPath -if test -e $outPath/hello; then false; fi - -outPath="$(NIX_STORE_DIR=/foo nix-instantiate --readonly-mode hash-check.nix)" -if test "$outPath" != "/foo/lfy1s6ca46rm5r6w4gg9hc0axiakjcnm-dependencies.drv"; then - echo "hashDerivationModulo appears broken, got $outPath" - exit 1 -fi diff --git a/tests/substituter.sh b/tests/substituter.sh deleted file mode 100755 index 9aab295de8..0000000000 --- a/tests/substituter.sh +++ /dev/null @@ -1,37 +0,0 @@ -#! /bin/sh -e -echo -echo substituter args: $* >&2 - -if test $1 = "--query"; then - while read cmd args; do - echo "CMD = $cmd, ARGS = $args" >&2 - if test "$cmd" = "have"; then - for path in $args; do - read path - if grep -q "$path" $TEST_ROOT/sub-paths; then - echo $path - fi - done - echo - elif test "$cmd" = "info"; then - for path in $args; do - echo $path - echo "" # deriver - echo 0 # nr of refs - echo $((1 * 1024 * 1024)) # download size - echo $((2 * 1024 * 1024)) # nar size - done - echo - else - echo "bad command $cmd" - exit 1 - fi - done -elif test $1 = "--substitute"; then - mkdir $2 - echo "Hallo Wereld" > $2/hello - echo # no expected hash -else - echo "unknown substituter operation" - exit 1 -fi diff --git a/tests/substituter2.sh b/tests/substituter2.sh deleted file mode 100755 index 5d1763599c..0000000000 --- a/tests/substituter2.sh +++ /dev/null @@ -1,33 +0,0 @@ -#! /bin/sh -e -echo -echo substituter2 args: $* >&2 - -if test $1 = "--query"; then - while read cmd args; do - if test "$cmd" = have; then - for path in $args; do - if grep -q "$path" $TEST_ROOT/sub-paths; then - echo $path - fi - done - echo - elif test "$cmd" = info; then - for path in $args; do - echo $path - echo "" # deriver - echo 0 # nr of refs - echo 0 # download size - echo 0 # nar size - done - echo - else - echo "bad command $cmd" - exit 1 - fi - done -elif test $1 = "--substitute"; then - exit 1 -else - echo "unknown substituter operation" - exit 1 -fi diff --git a/tests/substitutes.sh b/tests/substitutes.sh deleted file mode 100644 index 0c6adf2601..0000000000 --- a/tests/substitutes.sh +++ /dev/null @@ -1,22 +0,0 @@ -source common.sh - -clearStore - -# Instantiate. -drvPath=$(nix-instantiate simple.nix) -echo "derivation is $drvPath" - -# Find the output path. -outPath=$(nix-store -qvv "$drvPath") -echo "output path is $outPath" - -echo $outPath > $TEST_ROOT/sub-paths - -export NIX_SUBSTITUTERS=$(pwd)/substituter.sh - -nix-store -r "$drvPath" --dry-run 2>&1 | grep -q "1.00 MiB.*2.00 MiB" - -nix-store -rvv "$drvPath" - -text=$(cat "$outPath"/hello) -if test "$text" != "Hallo Wereld"; then echo "wrong substitute output: $text"; exit 1; fi diff --git a/tests/substitutes2.sh b/tests/substitutes2.sh deleted file mode 100644 index bd914575cc..0000000000 --- a/tests/substitutes2.sh +++ /dev/null @@ -1,21 +0,0 @@ -source common.sh - -clearStore - -# Instantiate. -drvPath=$(nix-instantiate simple.nix) -echo "derivation is $drvPath" - -# Find the output path. -outPath=$(nix-store -qvvvvv "$drvPath") -echo "output path is $outPath" - -echo $outPath > $TEST_ROOT/sub-paths - -# First try a substituter that fails, then one that succeeds -export NIX_SUBSTITUTERS=$(pwd)/substituter2.sh:$(pwd)/substituter.sh - -nix-store -j0 -rvv "$drvPath" - -text=$(cat "$outPath"/hello) -if test "$text" != "Hallo Wereld"; then echo "wrong substitute output: $text"; exit 1; fi diff --git a/tests/timeout.builder.sh b/tests/timeout.builder.sh deleted file mode 100644 index 1ddb44e99c..0000000000 --- a/tests/timeout.builder.sh +++ /dev/null @@ -1,2 +0,0 @@ -echo "\`timeout' builder entering an infinite loop" -while true ; do echo -n .; done diff --git a/tests/timeout.nix b/tests/timeout.nix deleted file mode 100644 index b41368bb38..0000000000 --- a/tests/timeout.nix +++ /dev/null @@ -1,6 +0,0 @@ -with import ./config.nix; - -mkDerivation { - name = "timeout"; - builder = ./timeout.builder.sh; -} diff --git a/tests/timeout.sh b/tests/timeout.sh deleted file mode 100644 index 4a4769a165..0000000000 --- a/tests/timeout.sh +++ /dev/null @@ -1,21 +0,0 @@ -# Test the `--timeout' option. - -source common.sh - -failed=0 -messages="`nix-build timeout.nix --timeout 2 2>&1 || failed=1`" -if [ $failed -ne 0 ]; then - echo "error: \`nix-store' succeeded; should have timed out" - exit 1 -fi - -if ! echo "$messages" | grep -q "timed out"; then - echo "error: build may have failed for reasons other than timeout; output:" - echo "$messages" >&2 - exit 1 -fi - -if nix-build timeout.nix --option build-max-log-size 100; then - echo "build should have failed" - exit 1 -fi diff --git a/tests/user-envs.builder.sh b/tests/user-envs.builder.sh deleted file mode 100644 index 5fafa797f1..0000000000 --- a/tests/user-envs.builder.sh +++ /dev/null @@ -1,5 +0,0 @@ -mkdir $out -mkdir $out/bin -echo "#! $shell" > $out/bin/$progName -echo "echo $name" >> $out/bin/$progName -chmod +x $out/bin/$progName diff --git a/tests/user-envs.nix b/tests/user-envs.nix deleted file mode 100644 index 1aa410cc96..0000000000 --- a/tests/user-envs.nix +++ /dev/null @@ -1,29 +0,0 @@ -# Some dummy arguments... -{ foo ? "foo" -}: - -with import ./config.nix; - -assert foo == "foo"; - -let - - makeDrv = name: progName: (mkDerivation { - inherit name progName system; - builder = ./user-envs.builder.sh; - } // { - meta = { - description = "A silly test package"; - }; - }); - -in - - [ - (makeDrv "foo-1.0" "foo") - (makeDrv "foo-2.0pre1" "foo") - (makeDrv "bar-0.1" "bar") - (makeDrv "foo-2.0" "foo") - (makeDrv "bar-0.1.1" "bar") - (makeDrv "foo-0.1" "foo" // { meta.priority = 10; }) - ] diff --git a/tests/user-envs.sh b/tests/user-envs.sh deleted file mode 100644 index 0d997acd69..0000000000 --- a/tests/user-envs.sh +++ /dev/null @@ -1,168 +0,0 @@ -source common.sh - -clearStore -clearProfiles - -set -x - -# Query installed: should be empty. -test "$(nix-env -p $profiles/test -q '*' | wc -l)" -eq 0 - -export HOME=$TEST_ROOT/home -mkdir -p $HOME -nix-env --switch-profile $profiles/test - -# Query available: should contain several. -test "$(nix-env -f ./user-envs.nix -qa '*' | wc -l)" -eq 6 -outPath10=$(nix-env -f ./user-envs.nix -qa --out-path --no-name '*' | grep foo-1.0) -drvPath10=$(nix-env -f ./user-envs.nix -qa --drv-path --no-name '*' | grep foo-1.0) -[ -n "$outPath10" -a -n "$drvPath10" ] - -# Query descriptions. -nix-env -f ./user-envs.nix -qa '*' --description | grep -q silly -rm -f $HOME/.nix-defexpr -ln -s $(pwd)/user-envs.nix $HOME/.nix-defexpr -nix-env -qa '*' --description | grep -q silly - -# Install "foo-1.0". -nix-env -i foo-1.0 - -# Query installed: should contain foo-1.0 now (which should be -# executable). -test "$(nix-env -q '*' | wc -l)" -eq 1 -nix-env -q '*' | grep -q foo-1.0 -test "$($profiles/test/bin/foo)" = "foo-1.0" - -# Test nix-env -qc to compare installed against available packages, and vice versa. -nix-env -qc '*' | grep -q '< 2.0' -nix-env -qac '*' | grep -q '> 1.0' - -# Test the -b flag to filter out source-only packages. -[ "$(nix-env -qab | wc -l)" -eq 1 ] - -# Test the -s flag to get package status. -nix-env -qas | grep -q 'IP- foo-1.0' -nix-env -qas | grep -q -- '--- bar-0.1' - -# Disable foo. -nix-env --set-flag active false foo -! [ -e "$profiles/test/bin/foo" ] - -# Enable foo. -nix-env --set-flag active true foo -[ -e "$profiles/test/bin/foo" ] - -# Store the path of foo-1.0. -outPath10_=$(nix-env -q --out-path --no-name '*' | grep foo-1.0) -echo "foo-1.0 = $outPath10" -[ "$outPath10" = "$outPath10_" ] - -# Install "foo-2.0pre1": should remove foo-1.0. -nix-env -i foo-2.0pre1 - -# Query installed: should contain foo-2.0pre1 now. -test "$(nix-env -q '*' | wc -l)" -eq 1 -nix-env -q '*' | grep -q foo-2.0pre1 -test "$($profiles/test/bin/foo)" = "foo-2.0pre1" - -# Upgrade "foo": should install foo-2.0. -NIX_PATH=nixpkgs=./user-envs.nix:$NIX_PATH nix-env -f '<nixpkgs>' -u foo - -# Query installed: should contain foo-2.0 now. -test "$(nix-env -q '*' | wc -l)" -eq 1 -nix-env -q '*' | grep -q foo-2.0 -test "$($profiles/test/bin/foo)" = "foo-2.0" - -# Store the path of foo-2.0. -outPath20=$(nix-env -q --out-path --no-name '*' | grep foo-2.0) -test -n "$outPath20" - -# Install bar-0.1, uninstall foo. -nix-env -i bar-0.1 -nix-env -e foo - -# Query installed: should only contain bar-0.1 now. -if nix-env -q '*' | grep -q foo; then false; fi -nix-env -q '*' | grep -q bar - -# Rollback: should bring "foo" back. -oldGen="$(nix-store -q --resolve $profiles/test)" -nix-env --rollback -[ "$(nix-store -q --resolve $profiles/test)" != "$oldGen" ] -nix-env -q '*' | grep -q foo-2.0 -nix-env -q '*' | grep -q bar - -# Rollback again: should remove "bar". -nix-env --rollback -nix-env -q '*' | grep -q foo-2.0 -if nix-env -q '*' | grep -q bar; then false; fi - -# Count generations. -nix-env --list-generations -test "$(nix-env --list-generations | wc -l)" -eq 7 - -# Switch to a specified generation. -nix-env --switch-generation 7 -[ "$(nix-store -q --resolve $profiles/test)" = "$oldGen" ] - -# Install foo-1.0, now using its store path. -nix-env -i "$outPath10" -nix-env -q '*' | grep -q foo-1.0 -nix-store -qR $profiles/test | grep "$outPath10" -nix-store -q --referrers-closure $profiles/test | grep "$(nix-store -q --resolve $profiles/test)" -[ "$(nix-store -q --deriver "$outPath10")" = $drvPath10 ] - -# Uninstall foo-1.0, using a symlink to its store path. -ln -sfn $outPath10/bin/foo $TEST_ROOT/symlink -nix-env -e $TEST_ROOT/symlink -if nix-env -q '*' | grep -q foo; then false; fi -! nix-store -qR $profiles/test | grep "$outPath10" - -# Install foo-1.0, now using a symlink to its store path. -nix-env -i $TEST_ROOT/symlink -nix-env -q '*' | grep -q foo - -# Delete all old generations. -nix-env --delete-generations old - -# Run the garbage collector. This should get rid of foo-2.0 but not -# foo-1.0. -nix-collect-garbage -test -e "$outPath10" -! [ -e "$outPath20" ] - -# Uninstall everything -nix-env -e '*' -test "$(nix-env -q '*' | wc -l)" -eq 0 - -# Installing "foo" should only install the newest foo. -nix-env -i foo -test "$(nix-env -q '*' | grep foo- | wc -l)" -eq 1 -nix-env -q '*' | grep -q foo-2.0 - -# On the other hand, this should install both (and should fail due to -# a collision). -nix-env -e '*' -! nix-env -i foo-1.0 foo-2.0 - -# Installing "*" should install one foo and one bar. -nix-env -e '*' -nix-env -i '*' -test "$(nix-env -q '*' | wc -l)" -eq 2 -nix-env -q '*' | grep -q foo-2.0 -nix-env -q '*' | grep -q bar-0.1.1 - -# Test priorities: foo-0.1 has a lower priority than foo-1.0, so it -# should be possible to install both without a collision. Also test -# ‘--set-flag priority’ to manually override the declared priorities. -nix-env -e '*' -nix-env -i foo-0.1 foo-1.0 -[ "$($profiles/test/bin/foo)" = "foo-1.0" ] -nix-env --set-flag priority 1 foo-0.1 -[ "$($profiles/test/bin/foo)" = "foo-0.1" ] - -# Test nix-env --set. -nix-env --set $outPath10 -[ "$(nix-store -q --resolve $profiles/test)" = $outPath10 ] -nix-env --set $drvPath10 -[ "$(nix-store -q --resolve $profiles/test)" = $outPath10 ] |