aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2012-03-19 01:20:02 +0100
committerEelco Dolstra <eelco.dolstra@logicblox.com>2012-03-19 01:20:02 +0100
commitea402a255f9c03a644d256b0d1443a986a2bbebb (patch)
tree027c3f75e32377b1fc725e245b56330046150ae8
parent4b23900ff1568270c9a03ccadc1cbd0b872e4ef7 (diff)
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.
-rw-r--r--release.nix12
-rw-r--r--substitute.mk1
-rw-r--r--tests/Makefile.am6
-rw-r--r--tests/common.sh.in13
-rw-r--r--tests/gc-runtime.sh4
-rw-r--r--tests/hash.sh2
-rw-r--r--tests/init.sh29
-rw-r--r--tests/logging.sh4
8 files changed, 25 insertions, 46 deletions
diff --git a/release.nix b/release.nix
index cc17bf552..1e72f8046 100644
--- a/release.nix
+++ b/release.nix
@@ -79,6 +79,12 @@ let
--with-dbd-sqlite=${perlPackages.DBDSQLite}/lib/perl5/site_perl
--enable-gc
'';
+
+ installCheckPhase = ''
+ make installcheck
+ '';
+
+ postPhases = [ "installCheckPhase" ];
};
@@ -101,6 +107,12 @@ let
--with-dbd-sqlite=${perlPackages.DBDSQLite}/lib/perl5/site_perl
'';
+ installCheckPhase = ''
+ make installcheck
+ '';
+
+ postPhases = [ "installCheckPhase" ];
+
lcovFilter = [ "*/boost/*" "*-tab.*" ];
# We call `dot', and even though we just use it to
diff --git a/substitute.mk b/substitute.mk
index 3f2f367ff..9009b4249 100644
--- a/substitute.mk
+++ b/substitute.mk
@@ -5,6 +5,7 @@
-e "s^@extra1\@^$(extra1)^g" \
-e "s^@prefix\@^$(prefix)^g" \
-e "s^@bindir\@^$(bindir)^g" \
+ -e "s^@datadir\@^$(datadir)^g" \
-e "s^@sysconfdir\@^$(sysconfdir)^g" \
-e "s^@localstatedir\@^$(localstatedir)^g" \
-e "s^@datadir\@^$(datadir)^g" \
diff --git a/tests/Makefile.am b/tests/Makefile.am
index d60226fd2..f44caa4b3 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -40,3 +40,9 @@ EXTRA_DIST = $(TESTS) \
import-derivation.nix \
$(wildcard lang/*.nix) $(wildcard lang/*.exp) $(wildcard lang/*.exp.xml) $(wildcard lang/*.flags) $(wildcard lang/dir*/*.nix) \
common.sh.in
+
+# Hacky.
+check-am:
+ @echo "Warning: Nix has no 'make check'. Please install Nix and run 'make installcheck' instead."
+
+installcheck: check-TESTS
diff --git a/tests/common.sh.in b/tests/common.sh.in
index 316562f67..0f46e5f4e 100644
--- a/tests/common.sh.in
+++ b/tests/common.sh.in
@@ -1,9 +1,6 @@
set -e
-export top_srcdir="@abs_top_srcdir@"
-export top_builddir="@abs_top_builddir@"
-
-export TOP=$(pwd)/..
+datadir="@datadir@"
export TEST_ROOT=$(pwd)/test-tmp
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_DB_DIR=$TEST_ROOT/db
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_ROOT_FINDER=
-export NIX_PATH=nix=$TOP/corepkgs
export SHARED=$TEST_ROOT/shared
-export PATH=$NIX_BIN_DIR:$TOP/scripts:$PATH
+export PATH=@bindir@:$PATH
export NIX_BUILD_HOOK=
-export PERL=perl
-export PERL5LIB=$TOP/perl/lib:$PERL5LIB
export dot=@dot@
export xmllint="@xmllint@"
export xmlflags="@xmlflags@"
diff --git a/tests/gc-runtime.sh b/tests/gc-runtime.sh
index df662bd0e..a44195756 100644
--- a/tests/gc-runtime.sh
+++ b/tests/gc-runtime.sh
@@ -26,9 +26,7 @@ echo PID=$child
nix-env -p $profiles/test -e gc-runtime
nix-env -p $profiles/test --delete-generations old
-cp $TOP/scripts/find-runtime-roots.pl $TEST_ROOT/foo.pl
-chmod +x $TEST_ROOT/foo.pl
-NIX_ROOT_FINDER=$TEST_ROOT/foo.pl nix-store --gc
+nix-store --gc
kill -- -$child
diff --git a/tests/hash.sh b/tests/hash.sh
index de18028ea..d659bbe34 100644
--- a/tests/hash.sh
+++ b/tests/hash.sh
@@ -46,7 +46,7 @@ chmod +x $TEST_ROOT/hash-path/hello
try2 md5 "20f3ffe011d4cfa7d72bfabef7882836"
# 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
try2 md5 "20f3ffe011d4cfa7d72bfabef7882836"
diff --git a/tests/init.sh b/tests/init.sh
index 777f95f77..37480f52b 100644
--- a/tests/init.sh
+++ b/tests/init.sh
@@ -16,20 +16,6 @@ mkdir "$NIX_STATE_DIR"
mkdir "$NIX_DB_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
gc-keep-outputs = false
gc-keep-derivations = false
@@ -37,21 +23,6 @@ env-keep-derivations = false
fsync-metadata = false
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.
nix-store --init
diff --git a/tests/logging.sh b/tests/logging.sh
index 8cedb4706..2879354cb 100644
--- a/tests/logging.sh
+++ b/tests/logging.sh
@@ -7,7 +7,7 @@ set -x
nix-build --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
+nix-log2xml < $TEST_ROOT/log.esc > $TEST_ROOT/log.xml
# Is this well-formed XML?
if test "$xmllint" != "false"; then
@@ -16,7 +16,7 @@ fi
# Convert to HTML.
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...
# A few checks...