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/README.md | 7 ++++--- pkgs/populate/docs/design.md | 4 ++-- pkgs/populate/tests/default.nix | 34 ++++++++++++++++++---------------- 3 files changed, 24 insertions(+), 21 deletions(-) diff --git a/pkgs/populate/README.md b/pkgs/populate/README.md index f28598a..0bd1ac1 100644 --- a/pkgs/populate/README.md +++ b/pkgs/populate/README.md @@ -758,13 +758,14 @@ nixpkgs has. The tests require KVM and nixpkgs with default. ```sh -nix-build tests # all tests, except the exhaustive ones +nix-build tests # all tests, except exhaustive and extra nix-build tests -A flake # the test for one source type nix-build tests -A exhaustive # all exhaustive tests nix-build tests -A exhaustive.git # the remaining combinations of one test nix-build tests -A rsync-3-5-0 # the scenarios depending on rsync's version -nix-build tests -A smoke # a few scenarios of each kind, in one VM -nix-build tests -A only --argstr only 'lock-hooks-.*' # scenarios by name +nix-build tests -A extra.smoke # a few scenarios of each kind, in one VM +nix-build tests -A extra.only --argstr only 'lock-hooks-.*' # by name +nix-build tests -A extra.bench # timing populate with 100 sources cargo test # the unit tests, without VMs ``` diff --git a/pkgs/populate/docs/design.md b/pkgs/populate/docs/design.md index abb85e7..7d12c55 100644 --- a/pkgs/populate/docs/design.md +++ b/pkgs/populate/docs/design.md @@ -125,8 +125,8 @@ paths with control characters, devices, or a source that needs ## Development - `cargo test` in this directory runs the program's unit tests. -- `nix-build tests -A smoke` runs the smoke test, a few scenarios covering - each source type and each kind of target. +- `nix-build tests -A extra.smoke` runs the smoke test, a few scenarios + covering each source type and each kind of target. - `nix-build tests` runs all scenarios but the exhaustive ones. - krops' tests run populate's scenarios that expect refusals, and those of the smoke test, through krops' `pkgs.populate`, with `tests/builder.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