From 87e3d142cce442417b52610652b9d1a4fd7a6b4f Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 19 Jan 2018 13:58:28 +0100 Subject: [PATCH] Add a test for --check / --repeat --- tests/check.nix | 12 ++++++++++++ tests/check.sh | 18 ++++++++++++++++++ tests/local.mk | 3 ++- 3 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 tests/check.nix create mode 100644 tests/check.sh diff --git a/tests/check.nix b/tests/check.nix new file mode 100644 index 000000000..b330ab9c9 --- /dev/null +++ b/tests/check.nix @@ -0,0 +1,12 @@ +with import ./config.nix; + +{ + nondeterministic = mkDerivation { + name = "nondeterministic"; + buildCommand = + '' + mkdir $out + date +%s.%N > $out/date + ''; + }; +} diff --git a/tests/check.sh b/tests/check.sh new file mode 100644 index 000000000..3efcef044 --- /dev/null +++ b/tests/check.sh @@ -0,0 +1,18 @@ +source common.sh + +clearStore + +nix-build dependencies.nix --no-out-link +nix-build dependencies.nix --no-out-link --check + +nix-build check.nix -A nondeterministic --no-out-link +(! nix-build check.nix -A nondeterministic --no-out-link --check 2> $TEST_ROOT/log) +grep 'may not be deterministic' $TEST_ROOT/log + +clearStore + +nix-build dependencies.nix --no-out-link --repeat 3 + +(! nix-build check.nix -A nondeterministic --no-out-link --repeat 1 2> $TEST_ROOT/log) +grep 'differs from previous round' $TEST_ROOT/log + diff --git a/tests/local.mk b/tests/local.mk index 82502a8e5..e90b9f7da 100644 --- a/tests/local.mk +++ b/tests/local.mk @@ -21,7 +21,8 @@ nix_tests = \ signing.sh \ run.sh \ brotli.sh \ - pure-eval.sh + pure-eval.sh \ + check.sh # parallel.sh install-tests += $(foreach x, $(nix_tests), tests/$(x))