* Test nix-build. This also tests indirect roots.

This commit is contained in:
Eelco Dolstra 2006-03-01 13:49:12 +00:00
parent 8cd646b6af
commit 5cb6c42088
5 changed files with 24 additions and 4 deletions

View file

@ -3,7 +3,7 @@ TESTS_ENVIRONMENT = $(SHELL) -e
extra1 = $(shell pwd)/test-tmp/shared
simple.sh: simple.nix
dependencies.sh gc.sh nix-push.sh nix-pull.in logging.sh: dependencies.nix
dependencies.sh gc.sh nix-push.sh nix-pull.in logging.sh nix-build.sh: dependencies.nix
locking.sh: locking.nix
parallel.sh: parallel.nix
build-hook.sh: build-hook.nix
@ -16,7 +16,7 @@ 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 \
logging.sh misc.sh
logging.sh nix-build.sh misc.sh
XFAIL_TESTS =

View file

@ -23,6 +23,7 @@ ln -s $nixinstantiate $NIX_BIN_DIR/
ln -s $nixhash $NIX_BIN_DIR/
ln -s $TOP/scripts/nix-prefetch-url $NIX_BIN_DIR/
ln -s $TOP/scripts/nix-collect-garbage $NIX_BIN_DIR/
ln -s $TOP/scripts/nix-build $NIX_BIN_DIR/
mkdir $NIX_BIN_DIR/nix
ln -s $TOP/scripts/download-using-manifests.pl $NIX_BIN_DIR/nix/
ln -s $TOP/scripts/readmanifest.pm $NIX_BIN_DIR/nix/
@ -48,6 +49,7 @@ for i in \
$NIX_BIN_DIR/nix/download-using-manifests.pl \
$NIX_BIN_DIR/nix-prefetch-url \
$NIX_BIN_DIR/nix-collect-garbage \
$NIX_BIN_DIR/nix-build \
; do
echo "$REAL_BIN_DIR"
sed < $i > $i.tmp \

View file

@ -1,7 +1,6 @@
source common.sh
$nixstore --gc
$nixstore --clear-substitutes
# Produce an escaped log file.
$nixstore --log-type escapes -r -vv $($nixinstantiate dependencies.nix) 2> $TEST_ROOT/log.esc

17
tests/nix-build.sh Normal file
View file

@ -0,0 +1,17 @@
source common.sh
$nixstore --gc
(cd $TEST_ROOT && $NIX_BIN_DIR/nix-build ../dependencies.nix)
test "$(cat $TEST_ROOT/result/foobar)" = FOOBAR
# The result should be retained by a GC.
target=$(ls -l $TEST_ROOT/result | sed 's/.*->\ //')
echo target is $target
$nixstore --gc
test -e $target/foobar
# But now it should be gone.
rm $TEST_ROOT/result
$nixstore --gc
if test -e $target/foobar; then false; fi

View file

@ -36,4 +36,6 @@ cat $outPath/input-2/bar
# Check that the derivers are set properly.
test $($nixstore -q --deriver "$outPath") = "$drvPath"
$nixstore -q --deriver $(/bin/ls -l $outPath/input-2 | sed 's/.*->\ //') | grep -q -- "-input-2.drv"
$nixstore -q --deriver $(ls -l $outPath/input-2 | sed 's/.*->\ //') | grep -q -- "-input-2.drv"
$nixstore --clear-substitutes