Replace "make check" with "make installcheck"

Ensuring that the tests work from the build tree requires a growing
number of nasty hacks.  The tests also don't verify that the installed
Nix actually works.  Thus, the tests now require "make install" to
have been run.
This commit is contained in:
Eelco Dolstra 2012-03-19 01:20:02 +01:00
parent 4b23900ff1
commit ea402a255f
8 changed files with 25 additions and 46 deletions

View File

@ -79,6 +79,12 @@ let
--with-dbd-sqlite=${perlPackages.DBDSQLite}/lib/perl5/site_perl --with-dbd-sqlite=${perlPackages.DBDSQLite}/lib/perl5/site_perl
--enable-gc --enable-gc
''; '';
installCheckPhase = ''
make installcheck
'';
postPhases = [ "installCheckPhase" ];
}; };
@ -101,6 +107,12 @@ let
--with-dbd-sqlite=${perlPackages.DBDSQLite}/lib/perl5/site_perl --with-dbd-sqlite=${perlPackages.DBDSQLite}/lib/perl5/site_perl
''; '';
installCheckPhase = ''
make installcheck
'';
postPhases = [ "installCheckPhase" ];
lcovFilter = [ "*/boost/*" "*-tab.*" ]; lcovFilter = [ "*/boost/*" "*-tab.*" ];
# We call `dot', and even though we just use it to # We call `dot', and even though we just use it to

View File

@ -5,6 +5,7 @@
-e "s^@extra1\@^$(extra1)^g" \ -e "s^@extra1\@^$(extra1)^g" \
-e "s^@prefix\@^$(prefix)^g" \ -e "s^@prefix\@^$(prefix)^g" \
-e "s^@bindir\@^$(bindir)^g" \ -e "s^@bindir\@^$(bindir)^g" \
-e "s^@datadir\@^$(datadir)^g" \
-e "s^@sysconfdir\@^$(sysconfdir)^g" \ -e "s^@sysconfdir\@^$(sysconfdir)^g" \
-e "s^@localstatedir\@^$(localstatedir)^g" \ -e "s^@localstatedir\@^$(localstatedir)^g" \
-e "s^@datadir\@^$(datadir)^g" \ -e "s^@datadir\@^$(datadir)^g" \

View File

@ -40,3 +40,9 @@ EXTRA_DIST = $(TESTS) \
import-derivation.nix \ import-derivation.nix \
$(wildcard lang/*.nix) $(wildcard lang/*.exp) $(wildcard lang/*.exp.xml) $(wildcard lang/*.flags) $(wildcard lang/dir*/*.nix) \ $(wildcard lang/*.nix) $(wildcard lang/*.exp) $(wildcard lang/*.exp.xml) $(wildcard lang/*.flags) $(wildcard lang/dir*/*.nix) \
common.sh.in common.sh.in
# Hacky.
check-am:
@echo "Warning: Nix has no 'make check'. Please install Nix and run 'make installcheck' instead."
installcheck: check-TESTS

View File

@ -1,9 +1,6 @@
set -e set -e
export top_srcdir="@abs_top_srcdir@" datadir="@datadir@"
export top_builddir="@abs_top_builddir@"
export TOP=$(pwd)/..
export TEST_ROOT=$(pwd)/test-tmp export TEST_ROOT=$(pwd)/test-tmp
export NIX_STORE_DIR export NIX_STORE_DIR
@ -17,18 +14,12 @@ export NIX_LOG_DIR=$TEST_ROOT/var/log/nix
export NIX_STATE_DIR=$TEST_ROOT/var/nix export NIX_STATE_DIR=$TEST_ROOT/var/nix
export NIX_DB_DIR=$TEST_ROOT/db export NIX_DB_DIR=$TEST_ROOT/db
export NIX_CONF_DIR=$TEST_ROOT/etc export NIX_CONF_DIR=$TEST_ROOT/etc
export NIX_BIN_DIR=$TEST_ROOT/bin
export NIX_LIBEXEC_DIR=$TEST_ROOT/bin
export NIX_MANIFESTS_DIR=$TEST_ROOT/var/nix/manifests export NIX_MANIFESTS_DIR=$TEST_ROOT/var/nix/manifests
export NIX_ROOT_FINDER=
export NIX_PATH=nix=$TOP/corepkgs
export SHARED=$TEST_ROOT/shared export SHARED=$TEST_ROOT/shared
export PATH=$NIX_BIN_DIR:$TOP/scripts:$PATH export PATH=@bindir@:$PATH
export NIX_BUILD_HOOK= export NIX_BUILD_HOOK=
export PERL=perl
export PERL5LIB=$TOP/perl/lib:$PERL5LIB
export dot=@dot@ export dot=@dot@
export xmllint="@xmllint@" export xmllint="@xmllint@"
export xmlflags="@xmlflags@" export xmlflags="@xmlflags@"

View File

@ -26,9 +26,7 @@ echo PID=$child
nix-env -p $profiles/test -e gc-runtime nix-env -p $profiles/test -e gc-runtime
nix-env -p $profiles/test --delete-generations old nix-env -p $profiles/test --delete-generations old
cp $TOP/scripts/find-runtime-roots.pl $TEST_ROOT/foo.pl nix-store --gc
chmod +x $TEST_ROOT/foo.pl
NIX_ROOT_FINDER=$TEST_ROOT/foo.pl nix-store --gc
kill -- -$child kill -- -$child

View File

@ -46,7 +46,7 @@ chmod +x $TEST_ROOT/hash-path/hello
try2 md5 "20f3ffe011d4cfa7d72bfabef7882836" try2 md5 "20f3ffe011d4cfa7d72bfabef7882836"
# Mtime and other bits don't. # Mtime and other bits don't.
touch -r $TOP $TEST_ROOT/hash-path/hello touch -r . $TEST_ROOT/hash-path/hello
chmod 744 $TEST_ROOT/hash-path/hello chmod 744 $TEST_ROOT/hash-path/hello
try2 md5 "20f3ffe011d4cfa7d72bfabef7882836" try2 md5 "20f3ffe011d4cfa7d72bfabef7882836"

View File

@ -16,20 +16,6 @@ mkdir "$NIX_STATE_DIR"
mkdir "$NIX_DB_DIR" mkdir "$NIX_DB_DIR"
mkdir "$NIX_CONF_DIR" mkdir "$NIX_CONF_DIR"
mkdir $NIX_BIN_DIR
ln -s $TOP/src/nix-store/nix-store $NIX_BIN_DIR/
ln -s $TOP/src/nix-instantiate/nix-instantiate $NIX_BIN_DIR/
ln -s $TOP/src/nix-hash/nix-hash $NIX_BIN_DIR/
ln -s $TOP/src/nix-env/nix-env $NIX_BIN_DIR/
ln -s $TOP/src/nix-worker/nix-worker $NIX_BIN_DIR/
ln -s $TOP/src/bsdiff-*/bsdiff $NIX_BIN_DIR/
ln -s $TOP/src/bsdiff-*/bspatch $NIX_BIN_DIR/
ln -s $TOP/scripts/nix-prefetch-url $NIX_BIN_DIR/
ln -s $TOP/scripts/nix-build $NIX_BIN_DIR/
ln -s $TOP/scripts/nix-pull $NIX_BIN_DIR/
mkdir -p $NIX_BIN_DIR/nix/substituters
ln -s $TOP/scripts/copy-from-other-stores.pl $NIX_BIN_DIR/nix/substituters
cat > "$NIX_CONF_DIR"/nix.conf <<EOF cat > "$NIX_CONF_DIR"/nix.conf <<EOF
gc-keep-outputs = false gc-keep-outputs = false
gc-keep-derivations = false gc-keep-derivations = false
@ -37,21 +23,6 @@ env-keep-derivations = false
fsync-metadata = false fsync-metadata = false
EOF EOF
# An uberhack for Mac OS X 10.5: download-using-manifests uses Perl,
# and Perl links against Darwin's libutil.dylib (in /usr/lib), but
# when running "make check", the libtool wrapper script around the Nix
# binaries sets DYLD_LIBRARY_PATH so that Perl finds Nix's (completely
# different) libutil --- so it barfs. So generate a shell wrapper
# around download-using-manifests that clears DYLD_LIBRARY_PATH.
cat > $NIX_BIN_DIR/nix/substituters/download-using-manifests.pl <<EOF
#! $SHELL -e
export DYLD_LIBRARY_PATH=
exec "$top_builddir/libtool" --mode=execute \
-dlopen "$top_builddir/perl/libNixStore.la" \
"$top_builddir/scripts/download-using-manifests.pl" "\$@"
EOF
chmod +x $NIX_BIN_DIR/nix/substituters/download-using-manifests.pl
# Initialise the database. # Initialise the database.
nix-store --init nix-store --init

View File

@ -7,7 +7,7 @@ set -x
nix-build --log-type escapes -vv dependencies.nix 2> $TEST_ROOT/log.esc nix-build --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 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
@ -16,7 +16,7 @@ fi
# Convert to HTML. # Convert to HTML.
if test "$xsltproc" != "false"; then if test "$xsltproc" != "false"; then
(cd $TOP/src/nix-log2xml && $xsltproc mark-errors.xsl - | $xsltproc log2html.xsl -) < $TEST_ROOT/log.xml > $TEST_ROOT/log.html (cd $datadir/nix/log2html && $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... # Ideally we would check that the generated HTML is valid...
# A few checks... # A few checks...