From 91dc023665e22eb5637bf08c405e91ac9060c357 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 28 Jun 2004 10:42:57 +0000 Subject: * Added a switch `--fallback'. From the manual: Whenever Nix attempts to realise a derivation for which a closure is already known, but this closure cannot be realised, fall back on normalising the derivation. The most common scenario in which this is useful is when we have registered substitutes in order to perform binary distribution from, say, a network repository. If the repository is down, the realisation of the derivation will fail. When this option is specified, Nix will build the derivation instead. Thus, binary installation falls back on a source installation. This option is not the default since it is generally not desirable for a transient failure in obtaining the substitutes to lead to a full build from source (with the related consumption of resources). --- tests/Makefile.am | 6 +++--- tests/fall-back.nix.in | 6 ------ tests/fall-back.sh | 15 --------------- tests/fallback.nix.in | 6 ++++++ tests/fallback.sh | 15 +++++++++++++++ tests/verify.sh | 1 + 6 files changed, 25 insertions(+), 24 deletions(-) delete mode 100644 tests/fall-back.nix.in delete mode 100644 tests/fall-back.sh create mode 100644 tests/fallback.nix.in create mode 100644 tests/fallback.sh create mode 100644 tests/verify.sh (limited to 'tests') diff --git a/tests/Makefile.am b/tests/Makefile.am index 19122cd9556e..9e1d6a19836a 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -19,10 +19,10 @@ 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 +fallback.sh: fallback.nix TESTS = init.sh simple.sh dependencies.sh locking.sh parallel.sh \ - build-hook.sh substitutes.sh substitutes2.sh + build-hook.sh substitutes.sh substitutes2.sh fallback.sh verify.sh XFAIL_TESTS = @@ -36,4 +36,4 @@ EXTRA_DIST = $(TESTS) \ 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 \ - fall-back.nix.in + fallback.nix.in diff --git a/tests/fall-back.nix.in b/tests/fall-back.nix.in deleted file mode 100644 index 0575d6940d11..000000000000 --- a/tests/fall-back.nix.in +++ /dev/null @@ -1,6 +0,0 @@ -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 deleted file mode 100644 index e4a39421772b..000000000000 --- a/tests/fall-back.sh +++ /dev/null @@ -1,15 +0,0 @@ -storeExpr=$($TOP/src/nix-instantiate/nix-instantiate fall-back.nix) - -echo "store expr is $storeExpr" - -# Register a non-existant successor (and a nox-existant substitute). -suc=$NIX_STORE_DIR/deadbeafdeadbeafdeadbeafdeadbeaf-s.store -(echo $suc && echo $NIX_STORE_DIR/ffffffffffffffffffffffffffffffff.store && echo "/bla" && echo 0) | $TOP/src/nix-store/nix-store --substitute -$TOP/src/nix-store/nix-store --successor $storeExpr $suc - -outPath=$($TOP/src/nix-store/nix-store -qnf "$storeExpr") - -echo "output path is $outPath" - -text=$(cat "$outPath"/hello) -if test "$text" != "Hello World!"; then exit 1; fi diff --git a/tests/fallback.nix.in b/tests/fallback.nix.in new file mode 100644 index 000000000000..0575d6940d11 --- /dev/null +++ b/tests/fallback.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/fallback.sh b/tests/fallback.sh new file mode 100644 index 000000000000..5799775eb2f8 --- /dev/null +++ b/tests/fallback.sh @@ -0,0 +1,15 @@ +storeExpr=$($TOP/src/nix-instantiate/nix-instantiate fall-back.nix) + +echo "store expr is $storeExpr" + +# Register a non-existant successor (and a nox-existant substitute). +suc=$NIX_STORE_DIR/deadbeafdeadbeafdeadbeafdeadbeaf-s.store +(echo $suc && echo $NIX_STORE_DIR/ffffffffffffffffffffffffffffffff.store && echo "/bla" && echo 0) | $TOP/src/nix-store/nix-store --substitute +$TOP/src/nix-store/nix-store --successor $storeExpr $suc + +outPath=$($TOP/src/nix-store/nix-store -qnf --fallback "$storeExpr") + +echo "output path is $outPath" + +text=$(cat "$outPath"/hello) +if test "$text" != "Hello World!"; then exit 1; fi diff --git a/tests/verify.sh b/tests/verify.sh new file mode 100644 index 000000000000..ede3e7d74bea --- /dev/null +++ b/tests/verify.sh @@ -0,0 +1 @@ +$TOP/src/nix-store/nix-store --verify -- cgit 1.4.1