diff options
-rw-r--r-- | substitute.mk | 3 | ||||
-rw-r--r-- | tests/Makefile.am | 8 | ||||
-rw-r--r-- | tests/common.sh.in | 2 | ||||
-rw-r--r-- | tests/dependencies.sh | 2 | ||||
-rw-r--r-- | tests/gc-concurrent.sh | 5 | ||||
-rw-r--r-- | tests/gc.sh | 5 | ||||
-rw-r--r-- | tests/logging.sh | 24 |
7 files changed, 41 insertions, 8 deletions
diff --git a/substitute.mk b/substitute.mk index 2e28e5867..9e3123a14 100644 --- a/substitute.mk +++ b/substitute.mk @@ -17,6 +17,9 @@ -e "s^@coreutils\@^$(coreutils)^g" \ -e "s^@tar\@^$(tar)^g" \ -e "s^@dot\@^$(dot)^g" \ + -e "s^@xmllint\@^$(xmllint)^g" \ + -e "s^@xmlflags\@^$(xmlflags)^g" \ + -e "s^@xsltproc\@^$(xsltproc)^g" \ -e "s^@aterm_bin\@^$(aterm_bin)^g" \ -e "s^@version\@^$(VERSION)^g" \ < $< > $@ || rm $@ diff --git a/tests/Makefile.am b/tests/Makefile.am index dc753e781..540665ea9 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -3,22 +3,20 @@ TESTS_ENVIRONMENT = $(SHELL) -e extra1 = $(shell pwd)/test-tmp/shared simple.sh: simple.nix -dependencies.sh: dependencies.nix +dependencies.sh gc.sh nix-push.sh nix-pull.in logging.sh: dependencies.nix locking.sh: locking.nix parallel.sh: parallel.nix build-hook.sh: build-hook.nix substitutes.sh: substitutes.nix substitutes2.sh: substitutes2.nix fallback.sh: fallback.nix -nix-push.sh: dependencies.nix -nix-pull.sh: dependencies.nix -gc.sh: dependencies.nix gc-concurrent.sh: gc-concurrent.nix gc-concurrent2.nix user-envs.sh: user-envs.nix TESTS = init.sh hash.sh lang.sh simple.sh dependencies.sh locking.sh parallel.sh \ build-hook.sh substitutes.sh substitutes2.sh fallback.sh nix-push.sh gc.sh \ - gc-concurrent.sh verify.sh nix-pull.sh referrers.sh user-envs.sh misc.sh + gc-concurrent.sh verify.sh nix-pull.sh referrers.sh user-envs.sh \ + logging.sh misc.sh XFAIL_TESTS = diff --git a/tests/common.sh.in b/tests/common.sh.in index ca5ef5ecc..cd0ebf2cf 100644 --- a/tests/common.sh.in +++ b/tests/common.sh.in @@ -22,6 +22,8 @@ export PERL=perl export TOP=$(pwd)/.. export aterm_bin=@aterm_bin@ export dot=@dot@ +export xmllint="@xmllint@ @xmlflags@" +export xsltproc="@xsltproc@" export version=@version@ diff --git a/tests/dependencies.sh b/tests/dependencies.sh index cc912f8ef..434027e46 100644 --- a/tests/dependencies.sh +++ b/tests/dependencies.sh @@ -4,7 +4,7 @@ drvPath=$($nixinstantiate dependencies.nix) echo "derivation is $drvPath" -$TOP/src/nix-store/nix-store -q --tree "$drvPath" | grep ' +---.*builder1.sh' +$nixstore -q --tree "$drvPath" | grep ' +---.*builder1.sh' # Test Graphviz graph generation. $nixstore -q --graph "$drvPath" > $TEST_ROOT/graph diff --git a/tests/gc-concurrent.sh b/tests/gc-concurrent.sh index 5004a6e4e..446e79f13 100644 --- a/tests/gc-concurrent.sh +++ b/tests/gc-concurrent.sh @@ -6,7 +6,8 @@ outPath1=$($nixstore -q $drvPath1) drvPath2=$($nixinstantiate gc-concurrent2.nix) outPath2=$($nixstore -q $drvPath2) -ln -s $drvPath2 "$NIX_STATE_DIR"/gcroots/foo2 +rm -f "$NIX_STATE_DIR"/gcroots/foo +ln -s $drvPath2 "$NIX_STATE_DIR"/gcroots/foo # Start build #1 in the background. It starts immediately. $nixstore -rvv "$drvPath1" & @@ -35,3 +36,5 @@ cat $outPath1/input-2/bar # Build #2 should have failed because its derivation got garbage collected. cat $outPath2/foobar + +rm "$NIX_STATE_DIR"/gcroots/foo diff --git a/tests/gc.sh b/tests/gc.sh index afbda953e..36b09593d 100644 --- a/tests/gc.sh +++ b/tests/gc.sh @@ -4,7 +4,8 @@ drvPath=$($nixinstantiate dependencies.nix) outPath=$($nixstore -rvv "$drvPath") # Set a GC root. -ln -s $outPath "$NIX_STATE_DIR"/gcroots/foo +rm -f "$NIX_STATE_DIR"/gcroots/foo +ln -sf $outPath "$NIX_STATE_DIR"/gcroots/foo $NIX_BIN_DIR/nix-collect-garbage @@ -14,3 +15,5 @@ cat $outPath/input-2/bar # Check that the derivation has been GC'd. if cat $drvPath > /dev/null; then false; fi + +rm "$NIX_STATE_DIR"/gcroots/foo diff --git a/tests/logging.sh b/tests/logging.sh new file mode 100644 index 000000000..096c743fd --- /dev/null +++ b/tests/logging.sh @@ -0,0 +1,24 @@ +source common.sh + +rm -f $NIX_STATE_DIR/var/nix/ +$nixstore --gc + +# Produce an escaped log file. +$nixstore --log-type escapes -r -vv $($nixinstantiate dependencies.nix) 2> $TEST_ROOT/log.esc + +# Convert it to an XML representation. +$TOP/src/nix-log2xml/nix-log2xml < $TEST_ROOT/log.esc > $TEST_ROOT/log.xml + +# Is this well-formed XML? +if test -n "$xmllint"; then + $xmllint --noout $TEST_ROOT/log.xml +fi + +# Convert to HTML. +if test -n "$xsltproc"; then + (cd $TOP/src/nix-log2xml && $xsltproc mark-errors.xsl - | $xsltproc log2html.xsl -) < $TEST_ROOT/log.xml > $TEST_ROOT/log.html + # Ideally we would check that the generated HTML is valid... + + # A few checks... + grep "<li>.*<code>.*echo FOO" $TEST_ROOT/log.html +fi |