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