* Another test.

This commit is contained in:
Eelco Dolstra 2004-05-04 13:22:33 +00:00
parent ef093aac8f
commit a7bbe73971
6 changed files with 66 additions and 2 deletions

View file

@ -10,10 +10,12 @@ TESTS_ENVIRONMENT = TEST_ROOT=$(TEST_ROOT) \
$(SHELL) -e -x
simple.sh: simple.nix
dependencies.sh: dependencies.nix
TESTS = init.sh simple.sh
TESTS = init.sh simple.sh dependencies.sh
include ../substitute.mk
EXTRA_DIST = $(TESTS) \
simple.nix.in simple.builder.sh
simple.nix.in simple.builder.sh \
dependencies.nix.in dependencies.builder*.sh

View file

@ -0,0 +1,6 @@
export PATH=/bin:/usr/bin:$PATH
mkdir $out
echo $(cat $input1/foo)$(cat $input2/bar) > $out/foobar
ln -s $input2 $out/input-2

View file

@ -0,0 +1,4 @@
export PATH=/bin:/usr/bin:$PATH
mkdir $out
echo FOO > $out/foo

View file

@ -0,0 +1,4 @@
export PATH=/bin:/usr/bin:$PATH
mkdir $out
echo BAR > $out/bar

25
tests/dependencies.nix.in Normal file
View file

@ -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;
};
}

23
tests/dependencies.sh Normal file
View file

@ -0,0 +1,23 @@
storeExpr=$($TOP/src/nix-instantiate/nix-instantiate dependencies.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" != "FOOBAR"; then exit 1; fi
deps=$($TOP/src/nix-store/nix-store -qnR "$storeExpr")
echo "output closures are $deps"
# The output path should be in the closure.
echo "$deps" | grep -q "$outPath"
# Input-1 is not retained.
if echo "$deps" | grep -q "dependencies-input-1"; then exit 1; fi
# Input-2 is retained.
echo "$deps" | grep -q "dependencies-input-2"