Conditionally gate nextest tests with multiple partitions

This commit is contained in:
Ivan Petkov 2022-07-23 16:50:49 -07:00
parent 3c65d924ec
commit 52568d052b
No known key found for this signature in database
GPG Key ID: BB6F9EFC065832B6
2 changed files with 45 additions and 22 deletions

View File

@ -104,6 +104,8 @@ myPkgs // {
mkDummySrcTests = callPackage ./mkDummySrcTests { };
nextest = callPackage ./nextest.nix { };
simple = myLib.buildPackage {
src = ./simple;
};
@ -189,27 +191,5 @@ myPkgs // {
src = ./workspace-git;
pname = "workspace-git";
};
nextestSimple = myLib.cargoNextest {
src = ./simple;
pname = "nextest-simple";
cargoArtifacts = null;
};
nextestPartitionsCount = myLib.cargoNextest {
src = ./simple;
pname = "nextest-partitions-count";
partitions = 4;
partitionType = "count";
cargoArtifacts = null;
};
nextestPartitionsHash = myLib.cargoNextest {
src = ./simple;
pname = "nextest-partitions-hash";
partitions = 4;
partitionType = "hash";
cargoArtifacts = null;
};
})
)

43
checks/nextest.nix Normal file
View File

@ -0,0 +1,43 @@
{ cargo-nextest
, cargoNextest
, lib
, linkFarmFromDrvs
, runCommand
}:
let
# cargo-nextest version in the stable-22.05 branch is too old
nextestSupportsArchives = lib.versionAtLeast
cargo-nextest.version
"0.9.15";
nextestSimple = cargoNextest {
src = ./simple;
pname = "nextest-simple";
cargoArtifacts = null;
};
nextestPartitionsCount = cargoNextest {
src = ./simple;
pname = "nextest-partitions-count";
partitions = 4;
partitionType = "count";
cargoArtifacts = null;
};
nextestPartitionsHash = cargoNextest {
src = ./simple;
pname = "nextest-partitions-hash";
partitions = 4;
partitionType = "hash";
cargoArtifacts = null;
};
in
runCommand "nextestTests" {
buildInputs = [ nextestSimple ] ++ (lib.optionals nextestSupportsArchives [
nextestPartitionsCount
nextestPartitionsHash
]);
} ''
mkdir -p $out
''