diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2014-02-01T15·41+0100 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2014-02-01T15·41+0100 |
commit | 2f9bb5c7e744ddca3fbe5576e520a3e80c106c55 (patch) | |
tree | 7a3d5d57a460aa87a8f8b58d46102ca339e97770 /tests | |
parent | c5ba08133370f98de722c978bda3b446721985de (diff) | |
parent | 6dca72006aa9b1cf2f226bb5b538e744fcab976f (diff) |
Merge branch 'make'
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Makefile.am | 52 | ||||
-rw-r--r-- | tests/common.sh.in | 8 | ||||
-rw-r--r-- | tests/config.nix (renamed from tests/config.nix.in) | 12 | ||||
-rw-r--r-- | tests/local.mk | 21 | ||||
-rw-r--r-- | tests/logging.sh | 2 | ||||
-rw-r--r-- | tests/nix-profile.sh | 4 | ||||
-rw-r--r-- | tests/parallel.sh | 12 |
7 files changed, 40 insertions, 71 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am deleted file mode 100644 index 38cf7b1bda1f..000000000000 --- a/tests/Makefile.am +++ /dev/null @@ -1,52 +0,0 @@ -TESTS_ENVIRONMENT = NIX_REMOTE= $(bash) -e - -extra1 = $(shell pwd)/test-tmp/shared - -TESTS = init.sh hash.sh lang.sh add.sh simple.sh dependencies.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 nix-build.sh misc.sh fixed.sh \ - gc-runtime.sh install-package.sh check-refs.sh filter-source.sh \ - remote-store.sh export.sh export-graph.sh negative-caching.sh \ - binary-patching.sh timeout.sh secure-drv-outputs.sh nix-channel.sh \ - multiple-outputs.sh import-derivation.sh fetchurl.sh optimise-store.sh \ - binary-cache.sh nix-profile.sh - -XFAIL_TESTS = - -profiledir = $(sysconfdir)/profile.d - -include ../substitute.mk - -$(TESTS): common.sh config.nix - -EXTRA_DIST = $(TESTS) \ - config.nix.in \ - simple.nix simple.builder.sh \ - hash-check.nix \ - dependencies.nix dependencies.builder*.sh \ - parallel.nix parallel.builder.sh \ - build-hook.nix build-hook.hook.sh \ - substituter.sh substituter2.sh \ - gc-concurrent.nix gc-concurrent.builder.sh gc-concurrent2.builder.sh \ - user-envs.nix user-envs.builder.sh \ - fixed.nix fixed.builder1.sh fixed.builder2.sh \ - gc-runtime.nix \ - check-refs.nix \ - filter-source.nix \ - export-graph.nix \ - negative-caching.nix \ - binary-patching.nix \ - timeout.nix timeout.builder.sh \ - secure-drv-outputs.nix \ - multiple-outputs.nix \ - import-derivation.nix \ - fetchurl.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 2ae34603fcb5..0c4df7119204 100644 --- a/tests/common.sh.in +++ b/tests/common.sh.in @@ -1,7 +1,6 @@ set -e datadir="@datadir@" -profiledir="@profiledir@" export TEST_ROOT=$(pwd)/test-tmp export NIX_STORE_DIR @@ -16,7 +15,7 @@ export NIX_STATE_DIR=$TEST_ROOT/var/nix export NIX_DB_DIR=$TEST_ROOT/db export NIX_CONF_DIR=$TEST_ROOT/etc export NIX_MANIFESTS_DIR=$TEST_ROOT/var/nix/manifests -export SHARED=$TEST_ROOT/shared +export _NIX_TEST_SHARED=$TEST_ROOT/shared export NIX_REMOTE=$NIX_REMOTE_ export PATH=@bindir@:$PATH @@ -24,11 +23,10 @@ export PATH=@bindir@:$PATH export NIX_BUILD_HOOK= export dot=@dot@ export xmllint="@xmllint@" -export xmlflags="@xmlflags@" export xsltproc="@xsltproc@" -export SHELL="@shell@" +export SHELL="@bash@" -export version=@version@ +export version=@PACKAGE_VERSION@ export system=@system@ readLink() { diff --git a/tests/config.nix.in b/tests/config.nix index db3da145135c..6244a15fa48a 100644 --- a/tests/config.nix.in +++ b/tests/config.nix @@ -1,12 +1,14 @@ +with import <nix/config.nix>; + rec { - shell = "@shell@"; + inherit shell; + + path = coreutils; - path = "@testPath@"; + system = builtins.currentSystem; - system = "@system@"; + shared = builtins.getEnv "_NIX_TEST_SHARED"; - shared = "@extra1@"; - mkDerivation = args: derivation ({ inherit system; diff --git a/tests/local.mk b/tests/local.mk new file mode 100644 index 000000000000..87f4e25e6024 --- /dev/null +++ b/tests/local.mk @@ -0,0 +1,21 @@ +check: + @echo "Warning: Nix has no 'make check'. Please install Nix and run 'make installcheck' instead." + +nix_tests = \ + init.sh hash.sh lang.sh add.sh simple.sh dependencies.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 nix-build.sh misc.sh fixed.sh \ + gc-runtime.sh install-package.sh check-refs.sh filter-source.sh \ + remote-store.sh export.sh export-graph.sh negative-caching.sh \ + binary-patching.sh timeout.sh secure-drv-outputs.sh nix-channel.sh \ + multiple-outputs.sh import-derivation.sh fetchurl.sh optimise-store.sh \ + binary-cache.sh nix-profile.sh + +install-tests += $(foreach x, $(nix_tests), tests/$(x)) + +tests-environment = NIX_REMOTE= $(bash) -e + +clean-files += $(d)/common.sh + +installcheck: $(d)/common.sh diff --git a/tests/logging.sh b/tests/logging.sh index 117d483716a6..764999327c46 100644 --- a/tests/logging.sh +++ b/tests/logging.sh @@ -11,7 +11,7 @@ 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 || fail "malformed XML" + $xmllint --noout $TEST_ROOT/log.xml || fail "malformed XML" fi # Convert to HTML. diff --git a/tests/nix-profile.sh b/tests/nix-profile.sh index a00864c97708..3586a7efc3c8 100644 --- a/tests/nix-profile.sh +++ b/tests/nix-profile.sh @@ -3,8 +3,8 @@ source common.sh home=$TEST_ROOT/home rm -rf $home mkdir -p $home -HOME=$home $SHELL -e -c ". $profiledir/nix.sh" -HOME=$home $SHELL -e -c ". $profiledir/nix.sh" # test idempotency +HOME=$home $SHELL -e -c ". ../scripts/nix-profile.sh" +HOME=$home $SHELL -e -c ". ../scripts/nix-profile.sh" # test idempotency [ -L $home/.nix-profile ] [ -e $home/.nix-channels ] diff --git a/tests/parallel.sh b/tests/parallel.sh index 9b150263a59d..3b7bbe5a2251 100644 --- a/tests/parallel.sh +++ b/tests/parallel.sh @@ -6,7 +6,7 @@ echo "testing nix-build -j..." clearStore -rm -f $SHARED.cur $SHARED.max +rm -f $_NIX_TEST_SHARED.cur $_NIX_TEST_SHARED.max outPath=$(nix-build -j10000 parallel.nix --no-out-link) @@ -15,8 +15,8 @@ echo "output path is $outPath" text=$(cat "$outPath") if test "$text" != "abacade"; then exit 1; fi -if test "$(cat $SHARED.cur)" != 0; then fail "wrong current process count"; fi -if test "$(cat $SHARED.max)" != 3; then fail "not enough parallelism"; fi +if test "$(cat $_NIX_TEST_SHARED.cur)" != 0; then fail "wrong current process count"; fi +if test "$(cat $_NIX_TEST_SHARED.max)" != 3; then fail "not enough parallelism"; fi # Second, test that parallel invocations of nix-build perform builds @@ -25,7 +25,7 @@ echo "testing multiple nix-build -j1..." clearStore -rm -f $SHARED.cur $SHARED.max +rm -f $_NIX_TEST_SHARED.cur $_NIX_TEST_SHARED.max drvPath=$(nix-instantiate parallel.nix --argstr sleepTime 15) @@ -52,5 +52,5 @@ wait $pid2 || fail "instance 2 failed: $?" wait $pid3 || fail "instance 3 failed: $?" wait $pid4 || fail "instance 4 failed: $?" -if test "$(cat $SHARED.cur)" != 0; then fail "wrong current process count"; fi -if test "$(cat $SHARED.max)" != 3; then fail "not enough parallelism"; fi +if test "$(cat $_NIX_TEST_SHARED.cur)" != 0; then fail "wrong current process count"; fi +if test "$(cat $_NIX_TEST_SHARED.max)" != 3; then fail "not enough parallelism"; fi |