mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-16 06:45:16 +01:00
b8435108e1
These statements are taken from the `lib/test/release.nix` tests, which previously also worked on darwin. Unblocks https://github.com/NixOS/nix/pull/8569 when backported
42 lines
952 B
Nix
42 lines
952 B
Nix
{
|
|
nixpkgs ? ../../..,
|
|
system ? builtins.currentSystem,
|
|
pkgs ? import nixpkgs {
|
|
config = {};
|
|
overlays = [];
|
|
inherit system;
|
|
},
|
|
libpath ? ../..,
|
|
# Random seed
|
|
seed ? null,
|
|
}:
|
|
pkgs.runCommand "lib-path-tests" {
|
|
nativeBuildInputs = with pkgs; [
|
|
nix
|
|
jq
|
|
bc
|
|
];
|
|
} ''
|
|
# Needed to make Nix evaluation work
|
|
export TEST_ROOT=$(pwd)/test-tmp
|
|
export NIX_BUILD_HOOK=
|
|
export NIX_CONF_DIR=$TEST_ROOT/etc
|
|
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_STORE_DIR=$TEST_ROOT/store
|
|
export PAGER=cat
|
|
|
|
cp -r ${libpath} lib
|
|
export TEST_LIB=$PWD/lib
|
|
|
|
echo "Running unit tests lib/path/tests/unit.nix"
|
|
nix-instantiate --eval --show-trace \
|
|
--argstr libpath "$TEST_LIB" \
|
|
lib/path/tests/unit.nix
|
|
|
|
echo "Running property tests lib/path/tests/prop.sh"
|
|
bash lib/path/tests/prop.sh ${toString seed}
|
|
|
|
touch $out
|
|
''
|