* Add a test for nix-log2xml.

This commit is contained in:
Eelco Dolstra 2006-03-01 13:25:08 +00:00
parent 458820df6c
commit e48bd8c8b5
7 changed files with 41 additions and 8 deletions

View file

@ -17,6 +17,9 @@
-e "s^@coreutils\@^$(coreutils)^g" \ -e "s^@coreutils\@^$(coreutils)^g" \
-e "s^@tar\@^$(tar)^g" \ -e "s^@tar\@^$(tar)^g" \
-e "s^@dot\@^$(dot)^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^@aterm_bin\@^$(aterm_bin)^g" \
-e "s^@version\@^$(VERSION)^g" \ -e "s^@version\@^$(VERSION)^g" \
< $< > $@ || rm $@ < $< > $@ || rm $@

View file

@ -3,22 +3,20 @@ TESTS_ENVIRONMENT = $(SHELL) -e
extra1 = $(shell pwd)/test-tmp/shared extra1 = $(shell pwd)/test-tmp/shared
simple.sh: simple.nix 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 locking.sh: locking.nix
parallel.sh: parallel.nix parallel.sh: parallel.nix
build-hook.sh: build-hook.nix build-hook.sh: build-hook.nix
substitutes.sh: substitutes.nix substitutes.sh: substitutes.nix
substitutes2.sh: substitutes2.nix substitutes2.sh: substitutes2.nix
fallback.sh: fallback.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 gc-concurrent.sh: gc-concurrent.nix gc-concurrent2.nix
user-envs.sh: user-envs.nix user-envs.sh: user-envs.nix
TESTS = init.sh hash.sh lang.sh simple.sh dependencies.sh locking.sh parallel.sh \ 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 \ 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 = XFAIL_TESTS =

View file

@ -22,6 +22,8 @@ export PERL=perl
export TOP=$(pwd)/.. export TOP=$(pwd)/..
export aterm_bin=@aterm_bin@ export aterm_bin=@aterm_bin@
export dot=@dot@ export dot=@dot@
export xmllint="@xmllint@ @xmlflags@"
export xsltproc="@xsltproc@"
export version=@version@ export version=@version@

View file

@ -4,7 +4,7 @@ drvPath=$($nixinstantiate dependencies.nix)
echo "derivation is $drvPath" 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. # Test Graphviz graph generation.
$nixstore -q --graph "$drvPath" > $TEST_ROOT/graph $nixstore -q --graph "$drvPath" > $TEST_ROOT/graph

View file

@ -6,7 +6,8 @@ outPath1=$($nixstore -q $drvPath1)
drvPath2=$($nixinstantiate gc-concurrent2.nix) drvPath2=$($nixinstantiate gc-concurrent2.nix)
outPath2=$($nixstore -q $drvPath2) 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. # Start build #1 in the background. It starts immediately.
$nixstore -rvv "$drvPath1" & $nixstore -rvv "$drvPath1" &
@ -35,3 +36,5 @@ cat $outPath1/input-2/bar
# Build #2 should have failed because its derivation got garbage collected. # Build #2 should have failed because its derivation got garbage collected.
cat $outPath2/foobar cat $outPath2/foobar
rm "$NIX_STATE_DIR"/gcroots/foo

View file

@ -4,7 +4,8 @@ drvPath=$($nixinstantiate dependencies.nix)
outPath=$($nixstore -rvv "$drvPath") outPath=$($nixstore -rvv "$drvPath")
# Set a GC root. # 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 $NIX_BIN_DIR/nix-collect-garbage
@ -14,3 +15,5 @@ cat $outPath/input-2/bar
# Check that the derivation has been GC'd. # Check that the derivation has been GC'd.
if cat $drvPath > /dev/null; then false; fi if cat $drvPath > /dev/null; then false; fi
rm "$NIX_STATE_DIR"/gcroots/foo

24
tests/logging.sh Normal file
View file

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