From 1a4170003fafc1e164c702885307a0767657f8f9 Mon Sep 17 00:00:00 2001 From: Jean-Paul Calderone Date: Wed, 15 Mar 2023 10:47:39 -0400 Subject: [PATCH] adjust the shape of the test-related parameters a bit --- nix/integrationtests.nix | 8 ++++++-- nix/tahoe-lafs.nix | 32 +++++++++++++++++++++++++------- 2 files changed, 31 insertions(+), 9 deletions(-) diff --git a/nix/integrationtests.nix b/nix/integrationtests.nix index 183fbb684..087b50ef8 100644 --- a/nix/integrationtests.nix +++ b/nix/integrationtests.nix @@ -1,5 +1,9 @@ # Build the package with the integration test suite enabled. -args@{...}: -(import ./tests.nix args).override { +args@{ forceFoolscap, runSlow, ...}: +(import ./tests.nix (builtins.removeAttrs args [ "forceFoolscap" "runSlow" ])).override { checks = [ "integration" ]; + integrationFeatures = ( + (if forceFoolscap then [ "force-foolscap" ] else []) ++ + (if runSlow then [ "runslow" ] else []) + ); } diff --git a/nix/tahoe-lafs.nix b/nix/tahoe-lafs.nix index b83278228..59072608d 100644 --- a/nix/tahoe-lafs.nix +++ b/nix/tahoe-lafs.nix @@ -4,8 +4,21 @@ , tahoe-lafs-src , extrasNames -# control how the test suite is run +# control which test suites run +# may contain: +# +# "unit" - run the unit tests +# +# "integration" - run the integration tests , checks ? [] + +# for the integration tests, feature flags to control certain settings +# may contain: +# +# "forceFoolscap" - Configure nodes to use Foolscap even if GBS is available +# +# "runslow" - Run integration tests even if they are marked slow +, integrationFeatures ? [ ] }: let pname = "tahoe-lafs"; @@ -122,12 +135,17 @@ buildPythonPackage rec { # Define how the tests are run. Include commands for whichever test # suites are enabled. Also be sure to let check hooks run. - checkPhase = '' - runHook preCheck - ${lib.optionalString doUnit "python -m twisted.trial -j $NIX_BUILD_CORES allmydata"} - ${lib.optionalString doIntegration "python -m pytest --timeout=1800 -s -v integration"} - runHook postCheck - ''; + checkPhase = + let + feature = name: lib.optionalString (builtins.elem name integrationFeatures); + pytestFlags = "${feature "forceFoolscap" "--force-foolscap"} ${feature "runslow" "--runslow"}"; + in + '' + runHook preCheck + ${lib.optionalString doUnit "python -m twisted.trial -j $NIX_BUILD_CORES allmydata"} + ${lib.optionalString doIntegration "python -m pytest --timeout=1800 -s -v ${pytestFlags} integration"} + runHook postCheck + ''; meta = with lib; { homepage = "https://tahoe-lafs.org/";