aboutsummaryrefslogtreecommitdiffstats
path: root/pkgs
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-11-30 19:28:06 +0000
committertv <tv@krebsco.de>2026-11-30 22:08:21 +0100
commit8a5d402e7662692fe9168c49126191b155b5f4cb (patch)
treee41a545e0f2e5b95f742c3c62a830d3006c74dca /pkgs
parentc8088839270c8994c0533d2fbfec7e5ade69cb57 (diff)
tests: extra.smoke, extra.only, and extra.bench, instead of smoke.smoke and so on
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/populate/README.md7
-rw-r--r--pkgs/populate/docs/design.md4
-rw-r--r--pkgs/populate/tests/default.nix34
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 <nixpkgs> {}, 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}";