From 8a5d402e7662692fe9168c49126191b155b5f4cb Mon Sep 17 00:00:00 2001 From: tv Date: Mon, 30 Nov 2026 19:28:06 +0000 Subject: tests: extra.smoke, extra.only, and extra.bench, instead of smoke.smoke and so on --- pkgs/populate/tests/default.nix | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) (limited to 'pkgs/populate/tests/default.nix') diff --git a/pkgs/populate/tests/default.nix b/pkgs/populate/tests/default.nix index b5dffb0..564c67d 100644 --- a/pkgs/populate/tests/default.nix +++ b/pkgs/populate/tests/default.nix @@ -6,14 +6,15 @@ # nix-build in this directory, or one with, e.g., nix-build -A flake. The # exhaustive tests add the combinations of options that no code path tells # apart from the ones the others cover; build them with nix-build -A -# exhaustive, or one with, e.g., nix-build -A exhaustive.flake. The smoke -# test runs a few scenarios covering each source type and each kind of -# target in a single VM test, for checking changes quickly; build it with -# nix-build -A smoke. nix-build -A only --argstr only REGEX runs the -# scenarios whose names match the regular expression REGEX in a single VM -# test, e.g. --argstr only 'lock-hooks-.*'. nix-build -A bench times -# populate with 100 sources, locally and with 30 ms of delay to the target; -# the log shows how long each run takes. +# exhaustive, or one with, e.g., nix-build -A exhaustive.flake. The tests +# in extra, which nix-build doesn't build either, are for development: the +# smoke test runs a few scenarios covering each source type and each kind +# of target in a single VM test, for checking changes quickly; build it +# with nix-build -A extra.smoke. nix-build -A extra.only --argstr only +# REGEX runs the scenarios whose names match the regular expression REGEX +# in a single VM test, e.g. --argstr only 'lock-hooks-.*'. nix-build -A +# extra.bench times populate with 100 sources, locally and with 30 ms of +# delay to the target; the log shows how long each run takes. { pkgs ? import {}, only ? null }: let @@ -112,7 +113,7 @@ let allScenarios; in if only == null then - throw "tests: -A only needs --argstr only REGEX" + throw "tests: -A extra.only needs --argstr only REGEX" else if selected == [] then throw "tests: no scenario's name matches ${builtins.toJSON only}" else @@ -143,15 +144,16 @@ in assert checkSourceTypes; testsOf false "" - # Not built by nix-build either, which runs these scenarios anyway. + # Attribute sets without recurseForDerivations, so nix-build doesn't build + # them: the tests built only on request, and the exhaustive ones. // { - smoke.smoke = vm "smoke" (named "smoke test" (import ./smoke.nix)) pkgs.rsync; - only.only = vm "only" onlyScenarios pkgs.rsync; - bench.bench = vm "bench" scenarios.bench pkgs.rsync; + extra = { + smoke = vm "smoke" (named "smoke test" (import ./smoke.nix)) pkgs.rsync; + only = vm "only" onlyScenarios pkgs.rsync; + bench = vm "bench" scenarios.bench pkgs.rsync; + }; + exhaustive = testsOf true "exhaustive-"; } - # An attribute set without recurseForDerivations, so nix-build doesn't - # build them. - // { exhaustive = testsOf true "exhaustive-"; } // lib.mapAttrs' (version: rsync: { name = "rsync-${builtins.replaceStrings [ "." ] [ "-" ] version}"; -- cgit v1.3.1