summary refs log tree commit diff
path: root/lib/tests/sources.sh
diff options
context:
space:
mode:
authorVictor Engmark <vengmark@linz.govt.nz>2021-11-26 09:53:57 +1300
committerVictor Engmark <vengmark@linz.govt.nz>2021-11-26 10:55:14 +1300
commit989f034ff1f8f5f3287074d4569cfd199e857ea1 (patch)
treef187f091205175eb6763e00a8a560b70ab0f3a8c /lib/tests/sources.sh
parentbfc580f54fb90295f7375ae166446e334e6ebd17 (diff)
downloadnixpkgs-989f034ff1f8f5f3287074d4569cfd199e857ea1.tar
nixpkgs-989f034ff1f8f5f3287074d4569cfd199e857ea1.tar.gz
nixpkgs-989f034ff1f8f5f3287074d4569cfd199e857ea1.tar.bz2
nixpkgs-989f034ff1f8f5f3287074d4569cfd199e857ea1.tar.lz
nixpkgs-989f034ff1f8f5f3287074d4569cfd199e857ea1.tar.xz
nixpkgs-989f034ff1f8f5f3287074d4569cfd199e857ea1.tar.zst
nixpkgs-989f034ff1f8f5f3287074d4569cfd199e857ea1.zip
lib/tests: Set hardening pragmas
Makes any programming errors more likely to show up early.

Non-obvious changes because of this:

- Ignore the `evalConfig` result in `reportFailure`; we're not checking
  it at that point.
- Pre-increment `$fail` and `$pass` to make sure the arithmetic doesn't
  result in a zero, which would result in a non-zero exit code for the
  expression.
Diffstat (limited to 'lib/tests/sources.sh')
-rwxr-xr-xlib/tests/sources.sh1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/tests/sources.sh b/lib/tests/sources.sh
index 68d21d2aa6d..a7f490a79d7 100755
--- a/lib/tests/sources.sh
+++ b/lib/tests/sources.sh
@@ -1,5 +1,6 @@
 #!/usr/bin/env bash
 set -euo pipefail
+shopt -s inherit_errexit
 
 # Use
 #     || die