summaryrefslogtreecommitdiff
path: root/cfg.mk
diff options
context:
space:
mode:
authorJim Meyering <meyering@fb.com>2016-02-20 17:19:44 -0800
committerJim Meyering <meyering@fb.com>2016-02-20 18:57:19 -0800
commit121d63666fed298769a19354e517fd9a7190a3a2 (patch)
treea20acd02ed550f684aef7120672d85a59c51f5e1 /cfg.mk
parent8e791d6e0b178cb0ffd061191b6372ce1ffb59c1 (diff)
downloadgrep-121d63666fed298769a19354e517fd9a7190a3a2.tar.gz
tests: convert "cmd && fail=1" to "returns_ 1 cmd || fail=1"
The latter is robust, while the former can silently ignore failure due to signals. * cfg.mk (sc_prohibit_and_fail_1): New rule, copied from coreutils. * tests/long-pattern-perf: Perform the above substitution. * tests/mb-non-UTF8-performance: Likewise. * tests/help-version: Merge from coreutils.
Diffstat (limited to 'cfg.mk')
-rw-r--r--cfg.mk11
1 files changed, 11 insertions, 0 deletions
diff --git a/cfg.mk b/cfg.mk
index 9c80b2a4..3f4ef327 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -120,6 +120,17 @@ sc_THANKS_in_duplicates:
&& { echo '$(ME): remove the above names from THANKS.in' \
1>&2; exit 1; } || :
+# Ensure that tests don't use `cmd ... && fail=1` as that hides crashes.
+# The "exclude" expression allows common idioms like `test ... && fail=1`
+# and the 2>... portion allows commands that redirect stderr and so probably
+# independently check its contents and thus detect any crash messages.
+sc_prohibit_and_fail_1:
+ @prohibit='&& fail=1' \
+ exclude='(stat|kill|test |EGREP|grep|compare|2> *[^/])' \
+ halt='&& fail=1 detected. Please use: returns_ 1 ... || fail=1' \
+ in_vc_files='^tests/' \
+ $(_sc_search_regexp)
+
update-copyright-env = \
UPDATE_COPYRIGHT_USE_INTERVALS=1 \
UPDATE_COPYRIGHT_MAX_LINE_LENGTH=79