From 52568d052ba855ba677bc562d88f28fb5a108f72 Mon Sep 17 00:00:00 2001 From: Ivan Petkov Date: Sat, 23 Jul 2022 16:50:49 -0700 Subject: [PATCH] Conditionally gate nextest tests with multiple partitions --- checks/default.nix | 24 ++---------------------- checks/nextest.nix | 43 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 22 deletions(-) create mode 100644 checks/nextest.nix diff --git a/checks/default.nix b/checks/default.nix index c50ca7f..7ab6475 100644 --- a/checks/default.nix +++ b/checks/default.nix @@ -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; - }; }) ) diff --git a/checks/nextest.nix b/checks/nextest.nix new file mode 100644 index 0000000..f28627a --- /dev/null +++ b/checks/nextest.nix @@ -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 +''