From a29c8ac51ca813a34eebb497340807e4b274170c Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 24 Jun 2004 14:35:01 +0000 Subject: [PATCH] * Add a test to check that when we cannot realise a closure expression, we should invalidate it and go back to the derivation for which it is a successor. --- tests/Makefile.am | 9 ++++++--- tests/fall-back.nix.in | 6 ++++++ tests/fall-back.sh | 14 ++++++++++++++ 3 files changed, 26 insertions(+), 3 deletions(-) create mode 100644 tests/fall-back.nix.in create mode 100644 tests/fall-back.sh diff --git a/tests/Makefile.am b/tests/Makefile.am index a42033414..2ad5ad0d9 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -19,9 +19,11 @@ parallel.sh: parallel.nix build-hook.sh: build-hook.nix substitutes.sh: substitutes.nix substituter.nix substitutes2.sh: substitutes2.nix substituter.nix substituter2.nix +fall-back.sh: fall-back.nix -TESTS = init.sh simple.sh dependencies.sh locking.sh parallel.sh \ - build-hook.sh substitutes.sh substitutes2.sh +#TESTS = init.sh simple.sh dependencies.sh locking.sh parallel.sh \ +# build-hook.sh substitutes.sh substitutes2.sh +TESTS = init.sh fall-back.sh XFAIL_TESTS = @@ -34,4 +36,5 @@ EXTRA_DIST = $(TESTS) \ parallel.nix.in parallel.builder.sh \ build-hook.nix.in build-hook.hook.sh \ substitutes.nix.in substituter.nix.in substituter.builder.sh \ - substitutes2.nix.in substituter2.nix.in substituter2.builder.sh + substitutes2.nix.in substituter2.nix.in substituter2.builder.sh \ + fall-back.nix.in diff --git a/tests/fall-back.nix.in b/tests/fall-back.nix.in new file mode 100644 index 000000000..0575d6940 --- /dev/null +++ b/tests/fall-back.nix.in @@ -0,0 +1,6 @@ +derivation { + name = "fall-back"; + system = "@system@"; + builder = "@shell@"; + args = ["-e" "-x" ./simple.builder.sh]; +} \ No newline at end of file diff --git a/tests/fall-back.sh b/tests/fall-back.sh new file mode 100644 index 000000000..a183e12f6 --- /dev/null +++ b/tests/fall-back.sh @@ -0,0 +1,14 @@ +storeExpr=$($TOP/src/nix-instantiate/nix-instantiate fall-back.nix) + +echo "store expr is $storeExpr" + +# Register a non-existant successor. +suc=$NIX_STORE_DIR/deadbeafdeadbeafdeadbeafdeadbeaf-s.store +$TOP/src/nix-store/nix-store --successor $storeExpr $suc + +outPath=$($TOP/src/nix-store/nix-store -qnfvvvvv "$storeExpr") + +echo "output path is $outPath" + +text=$(cat "$outPath"/hello) +if test "$text" != "Hello World!"; then exit 1; fi