diff --git a/substitute.mk b/substitute.mk index 18e4585d7..5038bd4bf 100644 --- a/substitute.mk +++ b/substitute.mk @@ -23,5 +23,6 @@ -e "s^@xsltproc\@^$(xsltproc)^g" \ -e "s^@aterm_bin\@^$(aterm_bin)^g" \ -e "s^@version\@^$(VERSION)^g" \ + -e "s^@testPath\@^$(coreutils):$$(dirname $$(type -P expr))^g" \ < $< > $@ || rm $@ if test -x $<; then chmod +x $@; fi diff --git a/tests/build-hook.nix.in b/tests/build-hook.nix.in index b38077e7f..697cab81e 100644 --- a/tests/build-hook.nix.in +++ b/tests/build-hook.nix.in @@ -5,6 +5,7 @@ let { system = "@system@"; builder = "@shell@"; args = ["-e" "-x" ./dependencies.builder1.sh]; + PATH = "@testPath@"; }; input2 = derivation { @@ -12,6 +13,7 @@ let { system = "@system@"; builder = "@shell@"; args = ["-e" "-x" ./dependencies.builder2.sh]; + PATH = "@testPath@"; }; body = derivation { @@ -19,6 +21,7 @@ let { system = "@system@"; builder = "@shell@"; args = ["-e" "-x" ./dependencies.builder0.sh]; + PATH = "@testPath@"; inherit input1 input2; }; diff --git a/tests/dependencies.builder0.sh b/tests/dependencies.builder0.sh index 69269916c..dc0bd9a9b 100644 --- a/tests/dependencies.builder0.sh +++ b/tests/dependencies.builder0.sh @@ -1,5 +1,3 @@ -export PATH=/bin:/usr/bin:$PATH - mkdir $out echo $(cat $input1/foo)$(cat $input2/bar) > $out/foobar diff --git a/tests/dependencies.builder1.sh b/tests/dependencies.builder1.sh index 53cd73916..4b006a17d 100644 --- a/tests/dependencies.builder1.sh +++ b/tests/dependencies.builder1.sh @@ -1,4 +1,2 @@ -export PATH=/bin:/usr/bin:$PATH - mkdir $out echo FOO > $out/foo diff --git a/tests/dependencies.builder2.sh b/tests/dependencies.builder2.sh index baceae756..4f886fdb3 100644 --- a/tests/dependencies.builder2.sh +++ b/tests/dependencies.builder2.sh @@ -1,4 +1,2 @@ -export PATH=/bin:/usr/bin:$PATH - mkdir $out echo BAR > $out/bar diff --git a/tests/dependencies.nix.in b/tests/dependencies.nix.in index aec9ec5b5..3e9f66ad6 100644 --- a/tests/dependencies.nix.in +++ b/tests/dependencies.nix.in @@ -5,6 +5,7 @@ let { system = "@system@"; builder = "@shell@"; args = ["-e" "-x" ./dependencies.builder1.sh]; + PATH = "@testPath@"; }; input2 = derivation { @@ -12,6 +13,7 @@ let { system = "@system@"; builder = "@shell@"; args = ["-e" "-x" ./dependencies.builder2.sh]; + PATH = "@testPath@"; }; body = derivation { @@ -19,6 +21,7 @@ let { system = "@system@"; builder = "@shell@"; args = ["-e" "-x" (./dependencies.builder0.sh + "/FOOBAR/../.")]; + PATH = "@testPath@"; input1 = input1 + "/."; inherit input2; }; diff --git a/tests/dummy b/tests/dummy new file mode 100644 index 000000000..557db03de --- /dev/null +++ b/tests/dummy @@ -0,0 +1 @@ +Hello World diff --git a/tests/fallback.nix.in b/tests/fallback.nix.in index 0575d6940..e47b59823 100644 --- a/tests/fallback.nix.in +++ b/tests/fallback.nix.in @@ -3,4 +3,5 @@ derivation { system = "@system@"; builder = "@shell@"; args = ["-e" "-x" ./simple.builder.sh]; -} \ No newline at end of file + goodPath = "@testPath@"; +} diff --git a/tests/fixed.builder1.sh b/tests/fixed.builder1.sh index 2213841a2..c792f52a5 100644 --- a/tests/fixed.builder1.sh +++ b/tests/fixed.builder1.sh @@ -1,3 +1 @@ -export PATH=/bin:/usr/bin:$PATH - echo "Hello World!" > $out diff --git a/tests/fixed.builder2.sh b/tests/fixed.builder2.sh index af94c22ac..bc1a18d6e 100644 --- a/tests/fixed.builder2.sh +++ b/tests/fixed.builder2.sh @@ -1,5 +1,3 @@ -export PATH=/bin:/usr/bin:$PATH - mkdir $out mkdir $out/bla echo "Hello World!" > $out/foo diff --git a/tests/fixed.nix.in b/tests/fixed.nix.in index 0ce9dd401..ab2448871 100644 --- a/tests/fixed.nix.in +++ b/tests/fixed.nix.in @@ -8,6 +8,7 @@ rec { outputHashMode = mode; outputHashAlgo = algo; outputHash = hash; + PATH = "@testPath@"; }; good = [ diff --git a/tests/gc-concurrent.builder.sh b/tests/gc-concurrent.builder.sh index 2d327f902..6b2177ddf 100644 --- a/tests/gc-concurrent.builder.sh +++ b/tests/gc-concurrent.builder.sh @@ -1,5 +1,3 @@ -export PATH=/bin:/usr/bin:$PATH - mkdir $out echo $(cat $input1/foo)$(cat $input2/bar) > $out/foobar diff --git a/tests/gc-concurrent.nix.in b/tests/gc-concurrent.nix.in index 0d62849bc..cf9f67313 100644 --- a/tests/gc-concurrent.nix.in +++ b/tests/gc-concurrent.nix.in @@ -5,6 +5,7 @@ let { system = "@system@"; builder = "@shell@"; args = ["-e" "-x" ./dependencies.builder1.sh]; + PATH = "@testPath@"; }; input2 = derivation { @@ -12,6 +13,7 @@ let { system = "@system@"; builder = "@shell@"; args = ["-e" "-x" ./dependencies.builder2.sh]; + PATH = "@testPath@"; }; body = derivation { @@ -19,6 +21,7 @@ let { system = "@system@"; builder = "@shell@"; args = ["-e" "-x" ./gc-concurrent.builder.sh]; + PATH = "@testPath@"; inherit input1 input2; }; diff --git a/tests/gc-concurrent2.builder.sh b/tests/gc-concurrent2.builder.sh index d94e46971..f7b6094e8 100644 --- a/tests/gc-concurrent2.builder.sh +++ b/tests/gc-concurrent2.builder.sh @@ -1,5 +1,3 @@ -export PATH=/bin:/usr/bin:$PATH - mkdir $out echo $(cat $input1/foo)$(cat $input2/bar)xyzzy > $out/foobar diff --git a/tests/gc-concurrent2.nix.in b/tests/gc-concurrent2.nix.in index e6050f1bb..d331e9c82 100644 --- a/tests/gc-concurrent2.nix.in +++ b/tests/gc-concurrent2.nix.in @@ -5,6 +5,7 @@ let { system = "@system@"; builder = "@shell@"; args = ["-e" "-x" ./dependencies.builder1.sh]; + PATH = "@testPath@"; }; input2 = derivation { @@ -12,6 +13,7 @@ let { system = "@system@"; builder = "@shell@"; args = ["-e" "-x" ./dependencies.builder2.sh]; + PATH = "@testPath@"; }; body = derivation { @@ -19,6 +21,7 @@ let { system = "@system@"; builder = "@shell@"; args = ["-e" "-x" ./gc-concurrent2.builder.sh]; + PATH = "@testPath@"; inherit input1 input2; }; diff --git a/tests/gc-runtime.nix.in b/tests/gc-runtime.nix.in index e54fcf2d1..aefffa276 100644 --- a/tests/gc-runtime.nix.in +++ b/tests/gc-runtime.nix.in @@ -3,5 +3,5 @@ derivation { system = "@system@"; builder = "@shell@"; args = ["-e" "-x" ./gc-runtime.builder.sh]; - PATH = "@coreutils@"; + PATH = "@testPath@"; } diff --git a/tests/hash-check.nix b/tests/hash-check.nix index bbe4fe247..4a8e9b8a8 100644 --- a/tests/hash-check.nix +++ b/tests/hash-check.nix @@ -4,14 +4,14 @@ let { name = "dependencies-input-1"; system = "i086-msdos"; builder = "/bar/sh"; - args = ["-e" "-x" ./dependencies.builder1.sh]; + args = ["-e" "-x" ./dummy]; }; input2 = derivation { name = "dependencies-input-2"; system = "i086-msdos"; builder = "/bar/sh"; - args = ["-e" "-x" ./dependencies.builder2.sh]; + args = ["-e" "-x" ./dummy]; outputHashMode = "recursive"; outputHashAlgo = "md5"; outputHash = "ffffffffffffffffffffffffffffffff"; @@ -21,7 +21,7 @@ let { name = "dependencies"; system = "i086-msdos"; builder = "/bar/sh"; - args = ["-e" "-x" (./dependencies.builder0.sh + "/FOOBAR/../.")]; + args = ["-e" "-x" (./dummy + "/FOOBAR/../.")]; input1 = input1 + "/."; inherit input2; }; diff --git a/tests/locking.builder.sh b/tests/locking.builder.sh index 5c3dfdafb..7598653b1 100644 --- a/tests/locking.builder.sh +++ b/tests/locking.builder.sh @@ -1,5 +1,3 @@ -export PATH=/bin:/usr/bin:$PATH - sleep 3 touch $out diff --git a/tests/locking.nix.in b/tests/locking.nix.in index 72070678f..a6b6b9101 100644 --- a/tests/locking.nix.in +++ b/tests/locking.nix.in @@ -5,6 +5,7 @@ let { system = "@system@"; builder = "@shell@"; args = ["-e" "-x" ./locking.builder.sh]; + PATH = "@testPath@"; inherit text inputs; }; diff --git a/tests/parallel.builder.sh b/tests/parallel.builder.sh index 23926110f..d9118eff1 100644 --- a/tests/parallel.builder.sh +++ b/tests/parallel.builder.sh @@ -1,9 +1,6 @@ echo "DOING $text" -export PATH=/bin:/usr/bin:$PATH - - # increase counter while ! ln -s x $shared.lock; do sleep 1 diff --git a/tests/parallel.nix.in b/tests/parallel.nix.in index 29eac1752..3b462c4b2 100644 --- a/tests/parallel.nix.in +++ b/tests/parallel.nix.in @@ -5,6 +5,7 @@ let { system = "@system@"; builder = "@shell@"; args = ["-e" "-x" ./parallel.builder.sh]; + PATH = "@testPath@"; shared = "@extra1@"; inherit text inputs; }; diff --git a/tests/simple.builder.sh b/tests/simple.builder.sh index dcd9bdb64..536faec14 100644 --- a/tests/simple.builder.sh +++ b/tests/simple.builder.sh @@ -4,7 +4,7 @@ echo "PATH=$PATH" if mkdir foo; then exit 1; fi # Set a PATH (!!! impure). -export PATH=/bin:/usr/bin:$PATH +export PATH=$goodPath mkdir $out diff --git a/tests/simple.nix.in b/tests/simple.nix.in index c2e944c7b..b49a8ca58 100644 --- a/tests/simple.nix.in +++ b/tests/simple.nix.in @@ -3,4 +3,5 @@ derivation { system = "@system@"; builder = "@shell@"; args = ["-e" "-x" ./simple.builder.sh]; -} \ No newline at end of file + goodPath = "@testPath@"; +} diff --git a/tests/simple.sh b/tests/simple.sh index 4d3377b29..25dd57e03 100644 --- a/tests/simple.sh +++ b/tests/simple.sh @@ -18,6 +18,6 @@ if test "$text" != "Hello World!"; then exit 1; fi $nixstore --delete $outPath if test -e $outPath/hello; then false; fi -if test "$(NIX_STORE_DIR=/foo $nixinstantiate --readonly-mode hash-check.nix)" != "/foo/4hgkkq63lp8x5kmh9cmsyqimq5v42zzl-dependencies.drv"; then +if test "$(NIX_STORE_DIR=/foo $nixinstantiate --readonly-mode hash-check.nix)" != "/foo/bbfambd3ksry4ylik1772pn2qyw1k296-dependencies.drv"; then echo "hashDerivationModulo appears broken" fi diff --git a/tests/user-envs.builder.sh b/tests/user-envs.builder.sh index c84c045e4..c5af9ed8d 100644 --- a/tests/user-envs.builder.sh +++ b/tests/user-envs.builder.sh @@ -1,5 +1,3 @@ -export PATH=/bin:/usr/bin:$PATH - mkdir $out mkdir $out/bin echo "#! $shell" > $out/bin/$progName diff --git a/tests/user-envs.nix.in b/tests/user-envs.nix.in index 6b9bbe86d..7972dfea1 100644 --- a/tests/user-envs.nix.in +++ b/tests/user-envs.nix.in @@ -12,6 +12,7 @@ let { builder = "@shell@"; shell = "@shell@"; args = ["-e" "-x" ./user-envs.builder.sh]; + PATH = "@testPath@"; } // { meta = { description = "A silly test package";