aboutsummaryrefslogtreecommitdiff
path: root/doc/manual/src/contributing/testing.md
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2023-07-09 22:24:51 -0400
committerJohn Ericson <John.Ericson@Obsidian.Systems>2023-07-18 09:31:13 -0400
commit259e328de81a91cf824efb0603f57fcde94ad3ff (patch)
tree32b19be7a40cdec1d35ab936978f9ee999d577af /doc/manual/src/contributing/testing.md
parenta8d5bb5e7e4400d89ff49ff00e7b5634b24834c3 (diff)
Introduce notion of a test group, use for CA tests
Grouping our tests should make it easier to understand the intent than one long poorly-arranged list. It also is convenient for running just the tests for a specific component when working on that component. We need at least one test group so this isn't dead code; I decided to collect the tests for the `ca-derivations` and `dynamic-derivations` experimental features in groups. Do ```bash make ca.test-group -jN ``` and ```bash make dyn-drv.test-group -jN ``` to try running just them. I originally did this as part of #8397 for being able to just the local overlay store alone. I am PRing it separately now so we can separate general infra from new features. Co-authored-by: Valentin Gagarin <valentin.gagarin@tweag.io>
Diffstat (limited to 'doc/manual/src/contributing/testing.md')
-rw-r--r--doc/manual/src/contributing/testing.md29
1 files changed, 29 insertions, 0 deletions
diff --git a/doc/manual/src/contributing/testing.md b/doc/manual/src/contributing/testing.md
index a5253997d..c3c82e3c0 100644
--- a/doc/manual/src/contributing/testing.md
+++ b/doc/manual/src/contributing/testing.md
@@ -14,6 +14,8 @@ You can run the whole testsuite with `make check`, or the tests for a specific c
The functional tests reside under the `tests` directory and are listed in `tests/local.mk`.
Each test is a bash script.
+### Running the whole test suite
+
The whole test suite can be run with:
```shell-session
@@ -23,6 +25,33 @@ ran test tests/bar.sh... [PASS]
...
```
+### Grouping tests
+
+Sometimes it is useful to group related tests so they can be easily run together without running the entire test suite.
+Each test group is in a subdirectory of `tests`.
+For example, `tests/ca/local.mk` defines a `ca` test group for content-addressed derivation outputs.
+
+That test group can be run like this:
+
+```shell-session
+$ make ca.test-group -j50
+ran test tests/ca/nix-run.sh... [PASS]
+ran test tests/ca/import-derivation.sh... [PASS]
+...
+```
+
+The test group is defined in Make like this:
+```makefile
+$(test-group-name)-tests := \
+ $(d)/test0.sh \
+ $(d)/test1.sh \
+ ...
+
+install-tests-groups += $(test-group-name)
+```
+
+### Running individual tests
+
Individual tests can be run with `make`:
```shell-session