Skip to content

Commit 17d08c6

Browse files
committed
CONTRIBUTING.md: add documentation on how to run tests
1 parent 6d06f63 commit 17d08c6

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

CONTRIBUTING.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,43 @@ way to help us fix issues quickly. Check out
1212
For more information on how to run and debug tests, check out
1313
[Running and debugging tests](./docs/testing.md).
1414

15+
## Finding and Running Tests
16+
17+
### Listing All Available Tests
18+
19+
To see all available tests in the project:
20+
21+
```bash
22+
# List all test files
23+
ls tests/*.nix | grep -v default.nix
24+
25+
# List all tests using nix eval
26+
nix eval --apply builtins.attrNames .#checks.x86_64-linux --json | jq -r '.[]' | sort
27+
```
28+
29+
### Running Tests
30+
31+
```bash
32+
# Run all tests and checks
33+
nix-fast-build
34+
35+
# Run a specific test by name
36+
nix build .#checks.x86_64-linux.simple-efi -L
37+
38+
# Run tests matching a pattern
39+
nix eval --apply 'checks: builtins.filter (name: builtins.match ".*luks.*" name != null) (builtins.attrNames checks)' .#checks.x86_64-linux --json | jq -r '.[]' | xargs -I {} echo nix build .#checks.x86_64-linux.{} -L
40+
```
41+
42+
### Understanding Test Structure
43+
44+
Each test file in `tests/` corresponds to an example configuration in `example/`:
45+
- `tests/simple-efi.nix` tests `example/simple-efi.nix`
46+
- `tests/luks-lvm.nix` tests `example/luks-lvm.nix`
47+
- etc.
48+
49+
Tests use NixOS's `make-test-python.nix` framework to create VMs that actually partition disks and verify the configurations work correctly.
50+
51+
1552
## How to find issues to work on
1653

1754
If you're looking for a low-hanging fruit, check out

0 commit comments

Comments
 (0)