* Clean up some tests (use nix-build where appropriate).
This commit is contained in:
parent
93b6926054
commit
1dcf208f56
|
@ -77,7 +77,7 @@ EOF
|
||||||
|
|
||||||
elsif ($arg eq "--attr" or $arg eq "-A") {
|
elsif ($arg eq "--attr" or $arg eq "-A") {
|
||||||
$n++;
|
$n++;
|
||||||
die "$0: `--attr' requires an argument\n" unless $n < scalar @ARGV;
|
die "$0: `$arg' requires an argument\n" unless $n < scalar @ARGV;
|
||||||
push @instArgs, ("--attr", $ARGV[$n]);
|
push @instArgs, ("--attr", $ARGV[$n]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,6 +87,13 @@ EOF
|
||||||
$n += 2;
|
$n += 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
elsif ($arg eq "--log-type") {
|
||||||
|
$n++;
|
||||||
|
die "$0: `$arg' requires an argument\n" unless $n < scalar @ARGV;
|
||||||
|
push @instArgs, ($arg, $ARGV[$n]);
|
||||||
|
push @buildArgs, ($arg, $ARGV[$n]);
|
||||||
|
}
|
||||||
|
|
||||||
elsif ($arg eq "--option") {
|
elsif ($arg eq "--option") {
|
||||||
die "$0: `$arg' requires two arguments\n" unless $n + 2 < scalar @ARGV;
|
die "$0: `$arg' requires two arguments\n" unless $n + 2 < scalar @ARGV;
|
||||||
push @instArgs, ($arg, $ARGV[$n + 1], $ARGV[$n + 2]);
|
push @instArgs, ($arg, $ARGV[$n + 1], $ARGV[$n + 2]);
|
||||||
|
|
|
@ -2,11 +2,7 @@ source common.sh
|
||||||
|
|
||||||
export NIX_BUILD_HOOK="build-hook.hook.sh"
|
export NIX_BUILD_HOOK="build-hook.hook.sh"
|
||||||
|
|
||||||
drvPath=$($nixinstantiate build-hook.nix)
|
outPath=$($nixbuild build-hook.nix)
|
||||||
|
|
||||||
echo "derivation is $drvPath"
|
|
||||||
|
|
||||||
outPath=$($nixstore -quf "$drvPath")
|
|
||||||
|
|
||||||
echo "output path is $outPath"
|
echo "output path is $outPath"
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ source common.sh
|
||||||
|
|
||||||
clearStore
|
clearStore
|
||||||
|
|
||||||
outPath=$($nixstore -r $($nixinstantiate dependencies.nix))
|
outPath=$($nixbuild dependencies.nix)
|
||||||
|
|
||||||
$nixstore --export $outPath > $TEST_ROOT/exp
|
$nixstore --export $outPath > $TEST_ROOT/exp
|
||||||
|
|
||||||
|
|
|
@ -6,22 +6,16 @@ export IMPURE_VAR1=foo
|
||||||
export IMPURE_VAR2=bar
|
export IMPURE_VAR2=bar
|
||||||
|
|
||||||
echo 'testing good...'
|
echo 'testing good...'
|
||||||
drvs=$($nixinstantiate fixed.nix -A good)
|
$nixbuild fixed.nix -A good
|
||||||
echo $drvs
|
|
||||||
$nixstore -r $drvs
|
|
||||||
|
|
||||||
echo 'testing good2...'
|
echo 'testing good2...'
|
||||||
drvs=$($nixinstantiate fixed.nix -A good2)
|
$nixbuild fixed.nix -A good2
|
||||||
echo $drvs
|
|
||||||
$nixstore -r $drvs
|
|
||||||
|
|
||||||
echo 'testing bad...'
|
echo 'testing bad...'
|
||||||
drvs=$($nixinstantiate fixed.nix -A bad)
|
$nixbuild fixed.nix -A bad && fail "should fail"
|
||||||
echo $drvs
|
|
||||||
if $nixstore -r $drvs; then false; fi
|
|
||||||
|
|
||||||
echo 'testing reallyBad...'
|
echo 'testing reallyBad...'
|
||||||
if $nixinstantiate fixed.nix -A reallyBad; then false; fi
|
$nixinstantiate fixed.nix -A reallyBad && fail "should fail"
|
||||||
|
|
||||||
# While we're at it, check attribute selection a bit more.
|
# While we're at it, check attribute selection a bit more.
|
||||||
echo 'testing attribute selection...'
|
echo 'testing attribute selection...'
|
||||||
|
@ -31,17 +25,12 @@ test $($nixinstantiate fixed.nix -A good.1 | wc -l) = 1
|
||||||
# Only one should run at the same time.
|
# Only one should run at the same time.
|
||||||
echo 'testing parallelSame...'
|
echo 'testing parallelSame...'
|
||||||
clearStore
|
clearStore
|
||||||
drvs=$($nixinstantiate fixed.nix -A parallelSame)
|
$nixbuild fixed.nix -A parallelSame -j2
|
||||||
echo $drvs
|
|
||||||
$nixstore -r $drvs -j2
|
|
||||||
|
|
||||||
# Fixed-output derivations with a recursive SHA-256 hash should
|
# Fixed-output derivations with a recursive SHA-256 hash should
|
||||||
# produce the same path as "nix-store --add".
|
# produce the same path as "nix-store --add".
|
||||||
echo 'testing sameAsAdd...'
|
echo 'testing sameAsAdd...'
|
||||||
drv=$($nixinstantiate fixed.nix -A sameAsAdd)
|
out=$($nixbuild fixed.nix -A sameAsAdd)
|
||||||
echo $drv
|
|
||||||
out=$($nixstore -r $drv)
|
|
||||||
echo $out
|
|
||||||
|
|
||||||
# This is what fixed.builder2 produces...
|
# This is what fixed.builder2 produces...
|
||||||
rm -rf $TEST_ROOT/fixed
|
rm -rf $TEST_ROOT/fixed
|
||||||
|
|
|
@ -1,16 +1,17 @@
|
||||||
source common.sh
|
source common.sh
|
||||||
|
|
||||||
$nixstore --gc
|
clearStore
|
||||||
|
|
||||||
# Produce an escaped log file.
|
# Produce an escaped log file.
|
||||||
$nixstore --log-type escapes -r -vv $($nixinstantiate dependencies.nix) 2> $TEST_ROOT/log.esc
|
set -x
|
||||||
|
$nixbuild --log-type escapes -vv dependencies.nix 2> $TEST_ROOT/log.esc
|
||||||
|
|
||||||
# Convert it to an XML representation.
|
# Convert it to an XML representation.
|
||||||
$TOP/src/nix-log2xml/nix-log2xml < $TEST_ROOT/log.esc > $TEST_ROOT/log.xml
|
$TOP/src/nix-log2xml/nix-log2xml < $TEST_ROOT/log.esc > $TEST_ROOT/log.xml
|
||||||
|
|
||||||
# Is this well-formed XML?
|
# Is this well-formed XML?
|
||||||
if test "$xmllint" != "false"; then
|
if test "$xmllint" != "false"; then
|
||||||
$xmllint $xmlflags --noout $TEST_ROOT/log.xml
|
$xmllint $xmlflags --noout $TEST_ROOT/log.xml || fail "malformed XML"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Convert to HTML.
|
# Convert to HTML.
|
||||||
|
@ -19,5 +20,5 @@ if test "$xsltproc" != "false"; then
|
||||||
# Ideally we would check that the generated HTML is valid...
|
# Ideally we would check that the generated HTML is valid...
|
||||||
|
|
||||||
# A few checks...
|
# A few checks...
|
||||||
grep "<li>.*<code>.*FOO" $TEST_ROOT/log.html
|
grep "<code>.*FOO" $TEST_ROOT/log.html || fail "bad HTML output"
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
source common.sh
|
source common.sh
|
||||||
|
|
||||||
$nixstore --gc
|
clearStore
|
||||||
|
|
||||||
(cd $TEST_ROOT && $NIX_BIN_DIR/nix-build ../dependencies.nix)
|
(cd $TEST_ROOT && $nixbuild ../dependencies.nix)
|
||||||
test "$(cat $TEST_ROOT/result/foobar)" = FOOBAR
|
test "$(cat $TEST_ROOT/result/foobar)" = FOOBAR
|
||||||
|
|
||||||
# The result should be retained by a GC.
|
# The result should be retained by a GC.
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
source common.sh
|
source common.sh
|
||||||
|
|
||||||
drvPath=$($nixinstantiate parallel.nix)
|
clearStore
|
||||||
|
|
||||||
echo "derivation is $drvPath"
|
outPath=$($nixbuild -vv -j10000 parallel.nix)
|
||||||
|
|
||||||
outPath=$($nixstore -qfvv -j10000 "$drvPath")
|
|
||||||
|
|
||||||
echo "output path is $outPath"
|
echo "output path is $outPath"
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue