diff options
author | Jim Meyering <meyering@fb.com> | 2016-02-20 17:19:44 -0800 |
---|---|---|
committer | Jim Meyering <meyering@fb.com> | 2016-02-20 18:57:19 -0800 |
commit | 121d63666fed298769a19354e517fd9a7190a3a2 (patch) | |
tree | a20acd02ed550f684aef7120672d85a59c51f5e1 /cfg.mk | |
parent | 8e791d6e0b178cb0ffd061191b6372ce1ffb59c1 (diff) | |
download | grep-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.mk | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -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 |