2024-05-01 22:14:04 +00:00
|
|
|
{
|
|
|
|
nixpkgs ? ../../..,
|
|
|
|
system ? builtins.currentSystem,
|
|
|
|
pkgs ? import nixpkgs {
|
2024-06-30 08:16:52 +00:00
|
|
|
config = { };
|
|
|
|
overlays = [ ];
|
2024-05-01 22:14:04 +00:00
|
|
|
inherit system;
|
|
|
|
},
|
|
|
|
nixVersions ? import ../../tests/nix-for-tests.nix { inherit pkgs; },
|
|
|
|
libpath ? ../..,
|
|
|
|
# Random seed
|
|
|
|
seed ? null,
|
|
|
|
}:
|
|
|
|
|
2024-06-30 08:16:52 +00:00
|
|
|
pkgs.runCommand "lib-path-tests"
|
|
|
|
{
|
|
|
|
nativeBuildInputs =
|
|
|
|
[ nixVersions.stable ]
|
|
|
|
++ (with pkgs; [
|
|
|
|
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
|
2024-05-01 22:14:04 +00:00
|
|
|
|
2024-06-30 08:16:52 +00:00
|
|
|
cp -r ${libpath} lib
|
|
|
|
export TEST_LIB=$PWD/lib
|
2024-05-01 22:14:04 +00:00
|
|
|
|
2024-06-30 08:16:52 +00:00
|
|
|
echo "Running unit tests lib/path/tests/unit.nix"
|
|
|
|
nix-instantiate --eval --show-trace \
|
|
|
|
--argstr libpath "$TEST_LIB" \
|
|
|
|
lib/path/tests/unit.nix
|
2024-05-01 22:14:04 +00:00
|
|
|
|
2024-06-30 08:16:52 +00:00
|
|
|
echo "Running property tests lib/path/tests/prop.sh"
|
|
|
|
bash lib/path/tests/prop.sh ${toString seed}
|
2024-05-01 22:14:04 +00:00
|
|
|
|
2024-06-30 08:16:52 +00:00
|
|
|
touch $out
|
|
|
|
''
|