diff --git a/doc/build-helpers/testers.chapter.md b/doc/build-helpers/testers.chapter.md index 81e13043e896..74e70162ed3d 100644 --- a/doc/build-helpers/testers.chapter.md +++ b/doc/build-helpers/testers.chapter.md @@ -260,10 +260,14 @@ runCommand "example" { This tester wraps the functionality provided by [`testers.testBuildFailure`](#tester-testBuildFailure) to make writing checks easier by simplifying checking the exit code of the builder and asserting the existence of entries in the builder's log. Additionally, users may specify a script containing additional checks, accessing the result of applying `testers.testBuildFailure` through the variable `failed`. +NOTE: This tester will produce an empty output and exit with success if none of the checks fail; there is no need to `touch "$out"` in `script`. + :::{.example #ex-testBuildFailurePrime-doc-example} # Check that a build fails, and verify the changes made during build +Re-using the example from [`testers.testBuildFailure`](#ex-testBuildFailure-showingenvironmentchanges), we can see how common checks are made easier and remove the need for `runCommand`: + ```nix testers.testBuildFailure' { drv = runCommand "doc-example" { } '' @@ -275,7 +279,6 @@ testers.testBuildFailure' { expectedBuilderLogEntries = [ "failing though" ]; script = '' grep --silent -F 'ok-ish' "$failed/result" - touch "$out" ''; } ``` diff --git a/pkgs/build-support/testers/test/default.nix b/pkgs/build-support/testers/test/default.nix index ac05f95f54a9..a7187a7dbfbf 100644 --- a/pkgs/build-support/testers/test/default.nix +++ b/pkgs/build-support/testers/test/default.nix @@ -234,7 +234,6 @@ lib.recurseIntoAttrs { expectedBuilderLogEntries = [ "failing though" ]; script = '' grep --silent -F 'ok-ish' "$failed/result" - touch "$out" ''; }; @@ -258,7 +257,6 @@ lib.recurseIntoAttrs { ]; script = '' grep --silent -F 'ok-ish' "$failed/result" - touch "$out" ''; }; @@ -293,7 +291,6 @@ lib.recurseIntoAttrs { # Checking our note that dev is the default output echo $failed/_ | grep -- '-dev/_' >/dev/null echo 'All good.' - touch $out ''; }; @@ -326,8 +323,6 @@ lib.recurseIntoAttrs { ]; script = '' [[ ! -e side-effect ]] - - touch $out ''; };