From 88e54153dce2cdba9a075d9dbc81ad81e7e73435 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 19 Jul 2006 15:49:29 +0000 Subject: [PATCH] * Add a precise test for hashDerivatioModulo. --- tests/Makefile.am | 1 + tests/hash-check.nix | 29 +++++++++++++++++++++++++++++ tests/simple.sh | 4 ++++ 3 files changed, 34 insertions(+) create mode 100644 tests/hash-check.nix diff --git a/tests/Makefile.am b/tests/Makefile.am index 9a718f190..b04f725c1 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -27,6 +27,7 @@ $(TESTS): common.sh EXTRA_DIST = $(TESTS) \ simple.nix.in simple.builder.sh \ + hash-check.nix.in \ dependencies.nix.in dependencies.builder*.sh \ locking.nix.in locking.builder.sh \ parallel.nix.in parallel.builder.sh \ diff --git a/tests/hash-check.nix b/tests/hash-check.nix new file mode 100644 index 000000000..bbe4fe247 --- /dev/null +++ b/tests/hash-check.nix @@ -0,0 +1,29 @@ +let { + + input1 = derivation { + name = "dependencies-input-1"; + system = "i086-msdos"; + builder = "/bar/sh"; + args = ["-e" "-x" ./dependencies.builder1.sh]; + }; + + input2 = derivation { + name = "dependencies-input-2"; + system = "i086-msdos"; + builder = "/bar/sh"; + args = ["-e" "-x" ./dependencies.builder2.sh]; + outputHashMode = "recursive"; + outputHashAlgo = "md5"; + outputHash = "ffffffffffffffffffffffffffffffff"; + }; + + body = derivation { + name = "dependencies"; + system = "i086-msdos"; + builder = "/bar/sh"; + args = ["-e" "-x" (./dependencies.builder0.sh + "/FOOBAR/../.")]; + input1 = input1 + "/."; + inherit input2; + }; + +} \ No newline at end of file diff --git a/tests/simple.sh b/tests/simple.sh index 7f7b48f2d..4d3377b29 100644 --- a/tests/simple.sh +++ b/tests/simple.sh @@ -17,3 +17,7 @@ if test "$text" != "Hello World!"; then exit 1; fi # be deleteable. $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 + echo "hashDerivationModulo appears broken" +fi