Issue #6161 - Register lib tests as release blockers.
This commit is contained in:
parent
6d15e32536
commit
de0f122b01
@ -12,7 +12,7 @@ evalConfig() {
|
|||||||
local attr=$1
|
local attr=$1
|
||||||
shift;
|
shift;
|
||||||
local script="import ./default.nix { modules = [ $@ ];}"
|
local script="import ./default.nix { modules = [ $@ ];}"
|
||||||
nix-instantiate -E "$script" -A "$attr" --eval-only
|
nix-instantiate --timeout 1 -E "$script" -A "$attr" --eval-only
|
||||||
}
|
}
|
||||||
|
|
||||||
reportFailure() {
|
reportFailure() {
|
||||||
@ -39,31 +39,32 @@ checkConfigOutput() {
|
|||||||
|
|
||||||
checkConfigError() {
|
checkConfigError() {
|
||||||
local errorContains=$1
|
local errorContains=$1
|
||||||
|
local err=""
|
||||||
shift;
|
shift;
|
||||||
if evalConfig "$@" 1>/dev/null 2>&1; then
|
if err==$(evalConfig "$@" 2>&1 >/dev/null); then
|
||||||
echo 2>&1 "error: Expected error code, got exit code 0, while evaluating"
|
echo 2>&1 "error: Expected error code, got exit code 0, while evaluating"
|
||||||
reportFailure "$@"
|
reportFailure "$@"
|
||||||
return 1
|
return 1
|
||||||
fi
|
|
||||||
|
|
||||||
if evalConfig "$@" 2>&1 >/dev/null | grep --silent "$errorContains" ; then
|
|
||||||
pass=$((pass + 1))
|
|
||||||
return 0;
|
|
||||||
else
|
else
|
||||||
echo 2>&1 "error: Expected error matching '$errorContains', while evaluating"
|
if echo "$err" | grep --silent "$errorContains" ; then
|
||||||
reportFailure "$@"
|
pass=$((pass + 1))
|
||||||
return 1
|
return 0;
|
||||||
|
else
|
||||||
|
echo 2>&1 "error: Expected error matching '$errorContains', while evaluating"
|
||||||
|
reportFailure "$@"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
checkConfigOutput "false" config.enable
|
checkConfigOutput "false" config.enable ./declare-enable.nix
|
||||||
checkConfigError 'The option .* defined in .* does not exist.' config.enable ./define-enable.nix
|
checkConfigError 'The option .* defined in .* does not exist.' config.enable ./define-enable.nix
|
||||||
set -- config.enable ./declare-enable.nix ./define-enable.nix
|
set -- config.enable ./declare-enable.nix ./define-enable.nix
|
||||||
checkConfigOutput "true" "$@"
|
checkConfigOutput "true" "$@"
|
||||||
checkConfigOutput "false" "$@" ./define-force-enable.nix
|
checkConfigOutput "false" "$@" ./define-force-enable.nix
|
||||||
checkConfigOutput "false" "$@" ./define-enable-force.nix
|
checkConfigOutput "false" "$@" ./define-enable-force.nix
|
||||||
|
|
||||||
checkConfigError 'attribute .foo. .* not found' config.loaOfSub.foo.enable ./declare-loaOfSub-any-enable.nix
|
checkConfigError 'attribute .*foo.* .* not found' config.loaOfSub.foo.enable ./declare-loaOfSub-any-enable.nix
|
||||||
checkConfigOutput 'false' config.loaOfSub.foo.enable ./declare-loaOfSub-any-enable.nix ./define-loaOfSub-foo.nix
|
checkConfigOutput 'false' config.loaOfSub.foo.enable ./declare-loaOfSub-any-enable.nix ./define-loaOfSub-foo.nix
|
||||||
set -- config.loaOfSub.foo.enable ./declare-loaOfSub-any-enable.nix ./define-loaOfSub-foo-enable.nix
|
set -- config.loaOfSub.foo.enable ./declare-loaOfSub-any-enable.nix ./define-loaOfSub-foo-enable.nix
|
||||||
checkConfigOutput 'true' "$@"
|
checkConfigOutput 'true' "$@"
|
||||||
@ -72,12 +73,12 @@ checkConfigOutput 'false' "$@" ./define-loaOfSub-force-foo-enable.nix
|
|||||||
checkConfigOutput 'false' "$@" ./define-loaOfSub-foo-force-enable.nix
|
checkConfigOutput 'false' "$@" ./define-loaOfSub-foo-force-enable.nix
|
||||||
checkConfigOutput 'false' "$@" ./define-loaOfSub-foo-enable-force.nix
|
checkConfigOutput 'false' "$@" ./define-loaOfSub-foo-enable-force.nix
|
||||||
|
|
||||||
checkConfigError 'attribute .bar. .* not found' config.loaOfSub.bar.enable ./declare-loaOfSub-any-enable.nix ./define-loaOfSub-foo.nix
|
checkConfigError 'attribute .*bar.* .* not found' config.loaOfSub.bar.enable ./declare-loaOfSub-any-enable.nix ./define-loaOfSub-foo.nix
|
||||||
checkConfigOutput 'false' config.loaOfSub.bar.enable ./declare-loaOfSub-any-enable.nix ./define-loaOfSub-foo.nix ./define-loaOfSub-bar.nix
|
checkConfigOutput 'false' config.loaOfSub.bar.enable ./declare-loaOfSub-any-enable.nix ./define-loaOfSub-foo.nix ./define-loaOfSub-bar.nix
|
||||||
set -- config.loaOfSub.bar.enable ./declare-loaOfSub-any-enable.nix ./define-loaOfSub-foo.nix ./define-loaOfSub-bar-enable.nix
|
set -- config.loaOfSub.bar.enable ./declare-loaOfSub-any-enable.nix ./define-loaOfSub-foo.nix ./define-loaOfSub-bar-enable.nix
|
||||||
checkConfigOutput 'true' "$@"
|
checkConfigOutput 'true' "$@"
|
||||||
checkConfigError 'attribute .bar. .* not found' "$@" ./define-force-loaOfSub-foo-enable.nix
|
checkConfigError 'attribute .*bar.* .* not found' "$@" ./define-force-loaOfSub-foo-enable.nix
|
||||||
checkConfigError 'attribute .bar. .* not found' "$@" ./define-loaOfSub-force-foo-enable.nix
|
checkConfigError 'attribute .*bar.* .* not found' "$@" ./define-loaOfSub-force-foo-enable.nix
|
||||||
checkConfigOutput 'true' "$@" ./define-loaOfSub-foo-force-enable.nix
|
checkConfigOutput 'true' "$@" ./define-loaOfSub-foo-force-enable.nix
|
||||||
checkConfigOutput 'true' "$@" ./define-loaOfSub-foo-enable-force.nix
|
checkConfigOutput 'true' "$@" ./define-loaOfSub-foo-enable-force.nix
|
||||||
|
|
||||||
|
31
lib/tests/release.nix
Normal file
31
lib/tests/release.nix
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
{ nixpkgs }:
|
||||||
|
|
||||||
|
with import ./../.. { };
|
||||||
|
with lib;
|
||||||
|
|
||||||
|
stdenv.mkDerivation {
|
||||||
|
name = "nixpkgs-lib-tests";
|
||||||
|
buildInputs = [ nix ];
|
||||||
|
NIX_PATH="nixpkgs=${nixpkgs}";
|
||||||
|
|
||||||
|
buildCommand = ''
|
||||||
|
datadir="${nix}/share"
|
||||||
|
export TEST_ROOT=$(pwd)/test-tmp
|
||||||
|
export NIX_STORE_DIR=$TEST_ROOT/store
|
||||||
|
export NIX_LOCALSTATE_DIR=$TEST_ROOT/var
|
||||||
|
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_MANIFESTS_DIR=$TEST_ROOT/var/nix/manifests
|
||||||
|
export NIX_BUILD_HOOK=
|
||||||
|
export PAGER=cat
|
||||||
|
cacheDir=$TEST_ROOT/binary-cache
|
||||||
|
nix-store --init
|
||||||
|
|
||||||
|
cd ${nixpkgs}/lib/tests
|
||||||
|
./modules.sh
|
||||||
|
|
||||||
|
touch $out
|
||||||
|
'';
|
||||||
|
}
|
@ -23,6 +23,7 @@ let
|
|||||||
{ tarball = import ./make-tarball.nix { inherit nixpkgs officialRelease; };
|
{ tarball = import ./make-tarball.nix { inherit nixpkgs officialRelease; };
|
||||||
|
|
||||||
manual = import ../../doc;
|
manual = import ../../doc;
|
||||||
|
lib.tests = import ../../lib/tests/release.nix { inherit nixpkgs; };
|
||||||
|
|
||||||
unstable = pkgs.releaseTools.aggregate
|
unstable = pkgs.releaseTools.aggregate
|
||||||
{ name = "nixpkgs-${jobs.tarball.version}";
|
{ name = "nixpkgs-${jobs.tarball.version}";
|
||||||
@ -30,6 +31,7 @@ let
|
|||||||
constituents =
|
constituents =
|
||||||
[ jobs.tarball
|
[ jobs.tarball
|
||||||
jobs.manual
|
jobs.manual
|
||||||
|
jobs.lib.tests
|
||||||
jobs.stdenv.x86_64-linux
|
jobs.stdenv.x86_64-linux
|
||||||
jobs.stdenv.i686-linux
|
jobs.stdenv.i686-linux
|
||||||
jobs.stdenv.x86_64-darwin
|
jobs.stdenv.x86_64-darwin
|
||||||
|
Loading…
x
Reference in New Issue
Block a user