[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 1/6] maint: add sc_prohibit_or_fail syntax-check
From: |
Bernhard Voelker |
Subject: |
[PATCH 1/6] maint: add sc_prohibit_or_fail syntax-check |
Date: |
Wed, 18 Mar 2020 08:10:03 +0100 |
The shell tests should use `cmd ... || fail=1` for detecting errors.
Add a syntax-check to ensure they don't use `cmd ... || fail` which
is a noop.
* cfg.mk (sc_prohibit_or_fail): Add syntax-check, borrowed from coreutils.
---
cfg.mk | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/cfg.mk b/cfg.mk
index 30a7296a..cd7acced 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -171,6 +171,14 @@ sc_prohibit_and_fail_1:
in_vc_files='^tests/' \
$(_sc_search_regexp)
+# Ensure that tests don't use `cmd ... || fail` as that's a noop.
+sc_prohibit_or_fail:
+ @prohibit='\|\| fail$$' \
+ exclude=':#' \
+ halt='|| fail detected. Please use: || fail=1' \
+ in_vc_files='^tests/' \
+ $(_sc_search_regexp)
+
# Ensure that env vars are not passed through returns_ as
# that was seen to fail on FreeBSD /bin/sh at least
sc_prohibit_env_returns:
--
2.25.1
- [PATCH 1/6] maint: add sc_prohibit_or_fail syntax-check,
Bernhard Voelker <=
- [PATCH 2/6] maint: fix issue in syntax-check, Bernhard Voelker, 2020/03/18
- [PATCH 5/6] maint: ensure .deps/ in the project root is ignored by git, Bernhard Voelker, 2020/03/18
- [PATCH 6/6] maint: fix clean rule in doc/ directory, Bernhard Voelker, 2020/03/18
- [PATCH 3/6] doc: prefer https:// over http:// in more places, Bernhard Voelker, 2020/03/18
- [PATCH 4/6] build: remove --without-fts configure option, Bernhard Voelker, 2020/03/18