From 8c0b42f857b53993d95c5bc077e8f8a71028c5ac Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 12 May 2004 09:35:51 +0000 Subject: * An quick and dirty hack to support distributed builds. --- tests/Makefile.am | 7 +++++-- tests/build-hook.hook.sh | 17 +++++++++++++++++ tests/build-hook.nix.in | 25 +++++++++++++++++++++++++ tests/build-hook.sh | 12 ++++++++++++ 4 files changed, 59 insertions(+), 2 deletions(-) create mode 100644 tests/build-hook.hook.sh create mode 100644 tests/build-hook.nix.in create mode 100644 tests/build-hook.sh (limited to 'tests') diff --git a/tests/Makefile.am b/tests/Makefile.am index 14662c20d4d1..608ffec19cd2 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -16,8 +16,10 @@ simple.sh: simple.nix dependencies.sh: dependencies.nix locking.sh: locking.nix parallel.sh: parallel.nix +build-hook.sh: build-hook.nix -TESTS = init.sh simple.sh dependencies.sh locking.sh parallel.sh +TESTS = init.sh simple.sh dependencies.sh locking.sh parallel.sh \ + build-hook.sh XFAIL_TESTS = @@ -27,4 +29,5 @@ EXTRA_DIST = $(TESTS) \ simple.nix.in simple.builder.sh \ dependencies.nix.in dependencies.builder*.sh \ locking.nix.in locking.builder.sh \ - parallel.nix.in parallel.builder.sh + parallel.nix.in parallel.builder.sh \ + build-hook.nix.in diff --git a/tests/build-hook.hook.sh b/tests/build-hook.hook.sh new file mode 100644 index 000000000000..7176315d9d11 --- /dev/null +++ b/tests/build-hook.hook.sh @@ -0,0 +1,17 @@ +set -x + +drv=$1 + +echo "HOOK for $drv" + +outPath=$(sed 's/Derive(\[\"\([^\"]*\)\".*/\1/' $drv) + +echo "output path is $outPath" + +if $(echo $outPath | grep -q input-1); then + mkdir $outPath + echo "BAR" > $outPath/foo + exit 100 +fi + +exit 101 \ No newline at end of file diff --git a/tests/build-hook.nix.in b/tests/build-hook.nix.in new file mode 100644 index 000000000000..920564955a53 --- /dev/null +++ b/tests/build-hook.nix.in @@ -0,0 +1,25 @@ +let { + + input1 = derivation { + name = "dependencies-input-1"; + system = "@system@"; + builder = "@shell@"; + args = ["-e" "-x" ./dependencies.builder1.sh]; + }; + + input2 = derivation { + name = "dependencies-input-2"; + system = "@system@"; + builder = "@shell@"; + args = ["-e" "-x" ./dependencies.builder2.sh]; + }; + + body = derivation { + name = "dependencies"; + system = "@system@"; + builder = "@shell@"; + args = ["-e" "-x" ./dependencies.builder0.sh]; + inherit input1 input2; + }; + +} \ No newline at end of file diff --git a/tests/build-hook.sh b/tests/build-hook.sh new file mode 100644 index 000000000000..bd74e42fe366 --- /dev/null +++ b/tests/build-hook.sh @@ -0,0 +1,12 @@ +export NIX_BUILD_HOOK="sh build-hook.hook.sh" + +storeExpr=$($TOP/src/nix-instantiate/nix-instantiate build-hook.nix) + +echo "store expr is $storeExpr" + +outPath=$($TOP/src/nix-store/nix-store -qnfvvvvv "$storeExpr") + +echo "output path is $outPath" + +text=$(cat "$outPath"/foobar) +if test "$text" != "BARBAR"; then exit 1; fi -- cgit 1.4.1