tests: prohibit fail=0 initialization
authorJim Meyering <meyering@redhat.com>
Fri, 30 Oct 2009 10:09:50 +0000 (11:09 +0100)
committerJim Meyering <meyering@redhat.com>
Fri, 30 Oct 2009 11:50:31 +0000 (12:50 +0100)
* cfg.mk (sc_prohibit_fail_0): New rule.
* .x-sc_prohibit_fail_0: New file.
* Makefile.am (syntax_check_exceptions): Distribute the new file.

.x-sc_prohibit_fail_0 [new file with mode: 0644]
Makefile.am
cfg.mk

diff --git a/.x-sc_prohibit_fail_0 b/.x-sc_prohibit_fail_0
new file mode 100644 (file)
index 0000000..7fa41fd
--- /dev/null
@@ -0,0 +1,3 @@
+\.mk$
+/Makefile\.am$
+^tests/test-lib\.sh$
index 62efb7d..634ae0f 100644 (file)
@@ -47,6 +47,7 @@ syntax_check_exceptions =             \
   .x-sc_po_check                       \
   .x-sc_program_name                   \
   .x-sc_prohibit_atoi_atof             \
+  .x-sc_prohibit_fail_0                        \
   .x-sc_prohibit_magic_number_exit     \
   .x-sc_prohibit_stat_st_blocks                \
   .x-sc_prohibit_strcmp                        \
diff --git a/cfg.mk b/cfg.mk
index c3a7afe..27349d0 100644 (file)
--- a/cfg.mk
+++ b/cfg.mk
@@ -232,13 +232,9 @@ sc_prohibit_emacs__indent_tabs_mode__setting:
 
 # Ensure that each file that contains fail=1 also contains fail=0.
 # Otherwise, setting file=1 in the environment would make tests fail unexpectedly.
-sc_fail_is_initialized:
-       @files=$$(grep -l -E '\<fail=1$$' $$($(VC_LIST_EXCEPT)));       \
-       if test "$$?" = 0; then                                         \
-         grep -LE '\<fail=0$$' $$files | grep . &&                     \
-           { echo '$(ME): the above files do not set fail=0'           \
-               1>&2; exit 1; } || :;                                   \
-       else :;                                                         \
-       fi
+sc_prohibit_fail_0:
+       @re='\<fail=0\>'                                                \
+       msg='fail=0 initialization'                                     \
+         $(_prohibit_regexp)
 
 include $(srcdir)/dist-check.mk