git.iko.soy/typeable/nixpkgs
on master help sign in
Issue #6161 - Register lib tests as release blockers.
commitde0f122b016c88ffdfa092a2acc0d6bd81e32613 authorNicolas B. Pierron <nicolas.b.pierron@gmail.com> dateSun 8 Feb 2015, 22:51 (12 years ago) parent6d15e32
3 files changed+49−15
lib/tests/modules.sh+16−15 lib/tests/release.nix+31 pkgs/top-level/release.nix+2
lib/tests/modules.sh+16−15
@@ -12,7 +12,7 @@ evalConfig() {
1212 local attr=$1
1313 shift;
1414 local script="import ./default.nix { modules = [ $@ ];}"
15− nix-instantiate -E "$script" -A "$attr" --eval-only
15+ nix-instantiate --timeout 1 -E "$script" -A "$attr" --eval-only
1616}
1717
1818reportFailure() {
@@ -39,31 +39,32 @@ checkConfigOutput() {
3939
4040checkConfigError() {
4141 local errorContains=$1
42+ local err=""
4243 shift;
43− if evalConfig "$@" 1>/dev/null 2>&1; then
44+ if err==$(evalConfig "$@" 2>&1 >/dev/null); then
4445 echo 2>&1 "error: Expected error code, got exit code 0, while evaluating"
4546 reportFailure "$@"
4647 return 1
47− fi
48−
49− if evalConfig "$@" 2>&1 >/dev/null | grep --silent "$errorContains" ; then
50− pass=$((pass + 1))
51− return 0;
5248 else
53− echo 2>&1 "error: Expected error matching '$errorContains', while evaluating"
54− reportFailure "$@"
55− return 1
49+ if echo "$err" | grep --silent "$errorContains" ; then
50+ pass=$((pass + 1))
51+ return 0;
52+ else
53+ echo 2>&1 "error: Expected error matching '$errorContains', while evaluating"
54+ reportFailure "$@"
55+ return 1
56+ fi
5657 fi
5758}
5859
59−checkConfigOutput "false" config.enable
60+checkConfigOutput "false" config.enable ./declare-enable.nix
6061checkConfigError 'The option .* defined in .* does not exist.' config.enable ./define-enable.nix
6162set -- config.enable ./declare-enable.nix ./define-enable.nix
6263checkConfigOutput "true" "$@"
6364checkConfigOutput "false" "$@" ./define-force-enable.nix
6465checkConfigOutput "false" "$@" ./define-enable-force.nix
6566
66−checkConfigError 'attribute .foo. .* not found' config.loaOfSub.foo.enable ./declare-loaOfSub-any-enable.nix
67+checkConfigError 'attribute .*foo.* .* not found' config.loaOfSub.foo.enable ./declare-loaOfSub-any-enable.nix
6768checkConfigOutput 'false' config.loaOfSub.foo.enable ./declare-loaOfSub-any-enable.nix ./define-loaOfSub-foo.nix
6869set -- config.loaOfSub.foo.enable ./declare-loaOfSub-any-enable.nix ./define-loaOfSub-foo-enable.nix
6970checkConfigOutput 'true' "$@"
@@ -72,12 +73,12 @@ checkConfigOutput 'false' "$@" ./define-loaOfSub-force-foo-enable.nix
7273checkConfigOutput 'false' "$@" ./define-loaOfSub-foo-force-enable.nix
7374checkConfigOutput 'false' "$@" ./define-loaOfSub-foo-enable-force.nix
7475
75−checkConfigError 'attribute .bar. .* not found' config.loaOfSub.bar.enable ./declare-loaOfSub-any-enable.nix ./define-loaOfSub-foo.nix
76+checkConfigError 'attribute .*bar.* .* not found' config.loaOfSub.bar.enable ./declare-loaOfSub-any-enable.nix ./define-loaOfSub-foo.nix
7677checkConfigOutput 'false' config.loaOfSub.bar.enable ./declare-loaOfSub-any-enable.nix ./define-loaOfSub-foo.nix ./define-loaOfSub-bar.nix
7778set -- config.loaOfSub.bar.enable ./declare-loaOfSub-any-enable.nix ./define-loaOfSub-foo.nix ./define-loaOfSub-bar-enable.nix
7879checkConfigOutput 'true' "$@"
79−checkConfigError 'attribute .bar. .* not found' "$@" ./define-force-loaOfSub-foo-enable.nix
80−checkConfigError 'attribute .bar. .* not found' "$@" ./define-loaOfSub-force-foo-enable.nix
80+checkConfigError 'attribute .*bar.* .* not found' "$@" ./define-force-loaOfSub-foo-enable.nix
81+checkConfigError 'attribute .*bar.* .* not found' "$@" ./define-loaOfSub-force-foo-enable.nix
8182checkConfigOutput 'true' "$@" ./define-loaOfSub-foo-force-enable.nix
8283checkConfigOutput 'true' "$@" ./define-loaOfSub-foo-enable-force.nix
8384
lib/tests/release.nixnew file+31
@@ -0,0 +1,31 @@
1+{ nixpkgs }:
2+
3+with import ./../.. { };
4+with lib;
5+
6+stdenv.mkDerivation {
7+ name = "nixpkgs-lib-tests";
8+ buildInputs = [ nix ];
9+ NIX_PATH="nixpkgs=${nixpkgs}";
10+
11+ buildCommand = ''
12+ datadir="${nix}/share"
13+ export TEST_ROOT=$(pwd)/test-tmp
14+ export NIX_STORE_DIR=$TEST_ROOT/store
15+ export NIX_LOCALSTATE_DIR=$TEST_ROOT/var
16+ export NIX_LOG_DIR=$TEST_ROOT/var/log/nix
17+ export NIX_STATE_DIR=$TEST_ROOT/var/nix
18+ export NIX_DB_DIR=$TEST_ROOT/db
19+ export NIX_CONF_DIR=$TEST_ROOT/etc
20+ export NIX_MANIFESTS_DIR=$TEST_ROOT/var/nix/manifests
21+ export NIX_BUILD_HOOK=
22+ export PAGER=cat
23+ cacheDir=$TEST_ROOT/binary-cache
24+ nix-store --init
25+
26+ cd ${nixpkgs}/lib/tests
27+ ./modules.sh
28+
29+ touch $out
30+ '';
31+}
pkgs/top-level/release.nix+2
@@ -23,6 +23,7 @@ let
2323 { tarball = import ./make-tarball.nix { inherit nixpkgs officialRelease; };
2424
2525 manual = import ../../doc;
26+ lib.tests = import ../../lib/tests/release.nix { inherit nixpkgs; };
2627
2728 unstable = pkgs.releaseTools.aggregate
2829 { name = "nixpkgs-${jobs.tarball.version}";
@@ -30,6 +31,7 @@ let
3031 constituents =
3132 [ jobs.tarball
3233 jobs.manual
34+ jobs.lib.tests
3335 jobs.stdenv.x86_64-linux
3436 jobs.stdenv.i686-linux
3537 jobs.stdenv.x86_64-darwin