summaryrefslogtreecommitdiff
path: root/pkgs/test/systemd (follow)
Commit message (Expand)AuthorAgeFilesLines
* lib.debug.throwTestFailures: init•••`lib.debug.runTests` provides a unit test evaluator for Nix, but its results are returned in a raw and difficult-to-read form. Currently, different callers output the results in various ways: `builtins.throw (builtins.toJSON failures)` and `builtins.throw ("Tests failed: " + lib.generators.toPretty { } failures)` are both used. This change adds a new `lib.debug.throwTestFailures` function which displays the results nicely before throwing an exception (or returns `null` if no failures are given), unifying these disparate call-sites. First, each failing test is pretty-printed in a `trace` message: ``` trace: FAIL testDerivation: Expected: <derivation a> Result: <derivation b> ``` Then, an exception is thrown containing the number of tests that failed (and their names), followed by the raw JSON of the results (for parity with previous usage, and because `lib.generators.toPretty` sometimes omits information that `builins.toJSON` includes): ``` error: … while evaluating the file '...': … caused by explicit throw at /nix/store/.../lib/debug.nix:528:7: 527| in 528| throw ( | ^ 529| builtins.seq traceFailures ( error: 1 tests failed: - testDerivation [{"expected":"/nix/store/xh7kyqp69mxkwspmi81a94m9xx74r8dr-a","name":"testDerivation","result":"/nix/store/503l84nir4zw57d1shfhai25bxxn16c6-b"}] ``` Rebecca Turner2025-11-101-3/+4
* treewide: format all inactive Nix files•••After final improvements to the official formatter implementation, this commit now performs the first treewide reformat of Nix files using it. This is part of the implementation of RFC 166. Only "inactive" files are reformatted, meaning only files that aren't being touched by any PR with activity in the past 2 months. This is to avoid conflicts for PRs that might soon be merged. Later we can do a full treewide reformat to get the rest, which should not cause as many conflicts. A CI check has already been running for some time to ensure that new and already-formatted files are formatted, so the files being reformatted here should also stay formatted. This commit was automatically created and can be verified using nix-build https://github.com/infinisil/treewide-nixpkgs-reformat-script/archive/a08b3a4d199c6124ac5b36a889d9099b4383463f.tar.gz \ --argstr baseRev b32a0943687d2a5094a6d92f25a4b6e16a76b5b7 result/bin/apply-formatting $NIXPKGS_PATH Silvan Mosberger2024-12-101-14/+29
* pkgs/test: fix silent failures when using runTestsJulien Moutinho2024-06-041-31/+36
* nixos/systemd: merge unit options as lists when at least one value is a listJulien Moutinho2024-02-252-0/+42