about summary refs log tree commit diff
path: root/CONTRIBUTING.md
diff options
context:
space:
mode:
authorVictor Engmark <victor@engmark.name>2023-06-16 11:26:30 +1200
committerVictor Engmark <victor@engmark.name>2023-06-20 08:29:47 +1200
commit96299edd4cac0d5e8d7b653346cd53f683f47a8b (patch)
tree9294afbcd180bade97e70c600df64caa0cc12649 /CONTRIBUTING.md
parenteed76b7f2523c29e1e89c417e1d5076fae5ac60e (diff)
downloadnixlib-96299edd4cac0d5e8d7b653346cd53f683f47a8b.tar
nixlib-96299edd4cac0d5e8d7b653346cd53f683f47a8b.tar.gz
nixlib-96299edd4cac0d5e8d7b653346cd53f683f47a8b.tar.bz2
nixlib-96299edd4cac0d5e8d7b653346cd53f683f47a8b.tar.lz
nixlib-96299edd4cac0d5e8d7b653346cd53f683f47a8b.tar.xz
nixlib-96299edd4cac0d5e8d7b653346cd53f683f47a8b.tar.zst
nixlib-96299edd4cac0d5e8d7b653346cd53f683f47a8b.zip
contributing: Explain how to run common tests
As a beginning contributor, it is far from obvious where to find tests,
how to run individual tests locally for quick development, and which
tests do what. The new "Testing changes" section aims to help with all
of these.

Co-authored-by: Emily <git@emilylange.de>
Diffstat (limited to 'CONTRIBUTING.md')
-rw-r--r--CONTRIBUTING.md9
1 files changed, 9 insertions, 0 deletions
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 2dd9b62cf953..f318f19ead39 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -61,6 +61,15 @@ Pull requests should not be squash merged in order to keep complete commit messa
 This means that, when addressing review comments in order to keep the pull request in an always mergeable status, you will sometimes need to rewrite your branch's history and then force-push it with `git push --force-with-lease`.
 Useful git commands that can help a lot with this are `git commit --patch --amend` and `git rebase --interactive`. For more details consult the git man pages or online resources like [git-rebase.io](https://git-rebase.io/) or [The Pro Git Book](https://git-scm.com/book/en/v2/Git-Tools-Rewriting-History).
 
+## Testing changes
+
+To run the main types of tests locally:
+
+- Run package-internal tests with `nix-build --attr pkgs.PACKAGE.passthru.tests`
+- Run [NixOS tests](https://nixos.org/manual/nixos/unstable/#sec-nixos-tests) with `nix-build --attr nixosTest.NAME`, where `NAME` is the name of the test listed in `nixos/tests/all-tests.nix`
+- Run [global package tests](https://nixos.org/manual/nixpkgs/unstable/#sec-package-tests) with `nix-build --attr tests.PACKAGE`, where `PACKAGE` is the name of the test listed in `pkgs/test/default.nix`
+- See `lib/tests/NAME.nix` for instructions on running specific library tests
+
 ## Rebasing between branches (i.e. from master to staging)
 
 From time to time, changes between branches must be rebased, for example, if the