2022-12-23 20:04:14 +00:00
|
|
|
{
|
|
|
|
nixpkgs ? ../../..,
|
|
|
|
system ? builtins.currentSystem,
|
|
|
|
pkgs ? import nixpkgs {
|
|
|
|
config = {};
|
|
|
|
overlays = [];
|
|
|
|
inherit system;
|
|
|
|
},
|
2023-11-09 10:08:44 +00:00
|
|
|
nixVersions ? import ../../tests/nix-for-tests.nix { inherit pkgs; },
|
2022-12-23 20:04:14 +00:00
|
|
|
libpath ? ../..,
|
2022-12-23 20:08:09 +00:00
|
|
|
# Random seed
|
|
|
|
seed ? null,
|
2022-12-23 20:04:14 +00:00
|
|
|
}:
|
2023-11-09 10:08:44 +00:00
|
|
|
|
2022-12-23 20:04:14 +00:00
|
|
|
pkgs.runCommand "lib-path-tests" {
|
2023-11-09 10:08:44 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
nixVersions.stable
|
|
|
|
] ++ (with pkgs; [
|
2022-12-23 20:08:09 +00:00
|
|
|
jq
|
|
|
|
bc
|
2023-11-09 10:08:44 +00:00
|
|
|
]);
|
2022-12-23 20:04:14 +00:00
|
|
|
} ''
|
|
|
|
# Needed to make Nix evaluation work
|
2023-08-11 15:08:16 +00:00
|
|
|
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
|
2022-12-23 20:04:14 +00:00
|
|
|
|
|
|
|
cp -r ${libpath} lib
|
|
|
|
export TEST_LIB=$PWD/lib
|
|
|
|
|
|
|
|
echo "Running unit tests lib/path/tests/unit.nix"
|
2023-06-26 10:12:34 +00:00
|
|
|
nix-instantiate --eval --show-trace \
|
|
|
|
--argstr libpath "$TEST_LIB" \
|
|
|
|
lib/path/tests/unit.nix
|
2022-12-23 20:04:14 +00:00
|
|
|
|
2022-12-23 20:08:09 +00:00
|
|
|
echo "Running property tests lib/path/tests/prop.sh"
|
|
|
|
bash lib/path/tests/prop.sh ${toString seed}
|
|
|
|
|
2022-12-23 20:04:14 +00:00
|
|
|
touch $out
|
|
|
|
''
|