bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

maint.mk: improve sc_cross_check_PATH_usage_in_tests


From: Jim Meyering
Subject: maint.mk: improve sc_cross_check_PATH_usage_in_tests
Date: Sun, 09 May 2010 22:42:33 +0200

FYI,

>From 9c827e02efc96390ff7b3e2868684bad1e4b2b1d Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Sun, 9 May 2010 22:30:09 +0200
Subject: maint.mk: improve sc_cross_check_PATH_usage_in_tests

With my recent change in init.sh from the two-line form:
    -#   : ${srcdir=.}
    -#   . "$srcdir/init.sh"; path_prepend_ .
    +#   . "${srcdir=.}/init.sh"; path_prepend_ .
I noticed that using the one-line form would cause this test
to fail with a false-positive, or to stop working altogether,
depending on whether help-version changed or all the tests did.
* top/maint.mk (_hv_regex): Remove this definition.
(_hv_regex_weak): Use a weak regex to select all init.sh-sourcing files.
(_hv_regex_strong): Use a stronger regex to check for conformance.
(sc_cross_check_PATH_usage_in_tests): Rewrite to use the above.
Give a separate diagnostic for lack of conforming use.
---
 ChangeLog    |   14 ++++++++++++++
 top/maint.mk |   26 ++++++++++++++------------
 2 files changed, 28 insertions(+), 12 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 9c36c82..63d40c3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -9,6 +9,20 @@

 2010-05-09  Jim Meyering  <address@hidden>

+       maint.mk: improve sc_cross_check_PATH_usage_in_tests
+       With my recent change in init.sh from the two-line form:
+           -#   : ${srcdir=.}
+           -#   . "$srcdir/init.sh"; path_prepend_ .
+           +#   . "${srcdir=.}/init.sh"; path_prepend_ .
+       I noticed that using the one-line form would cause this test
+       to fail with a false-positive, or to stop working altogether,
+       depending on whether help-version changed or all the tests did.
+       * top/maint.mk (_hv_regex): Remove this definition.
+       (_hv_regex_weak): Use a weak regex to select all init.sh-sourcing files.
+       (_hv_regex_strong): Use a stronger regex to check for conformance.
+       (sc_cross_check_PATH_usage_in_tests): Rewrite to use the above.
+       Give a separate diagnostic for lack of conforming use.
+
        maint.mk: prohibit definition of symbols defined by gnulib
        * top/maint.mk (sc_prohibit_always-defined_macros): Reject the
        definition of symbols defined by gnulib.
diff --git a/top/maint.mk b/top/maint.mk
index 8d3d137..2e11ac1 100644
--- a/top/maint.mk
+++ b/top/maint.mk
@@ -979,20 +979,22 @@ sc_copyright_check:
 # sets PATH correctly.  This is an inexpensive way to ensure that
 # the other init.sh-using tests also get it right.
 _hv_file ?= $(srcdir)/tests/help-version
-_hv_regex ?= ^ *\. [^ ]*/init\.sh
+_hv_regex_weak ?= ^ *\. .*/init\.sh"
+_hv_regex_strong ?= ^ *\. "\$${srcdir=\.}/init\.sh"
 sc_cross_check_PATH_usage_in_tests:
        @if test -f $(_hv_file); then                                   \
-         if grep -l 'VERSION mismatch' $(_hv_file) >/dev/null          \
-             && grep -lE '$(_hv_regex)' $(_hv_file) >/dev/null; then   \
-           good=$$(grep -E '$(_hv_regex)' < $(_hv_file));              \
-           grep -LFx "$$good"                                          \
-                 $$(grep -lE '$(_hv_regex)' $$($(VC_LIST_EXCEPT)))     \
-               | grep . &&                                             \
-             { echo "$(ME): the above files use path_prepend_ inconsistently" \
-                 1>&2; exit 1; } || :;                                 \
-         fi;                                                           \
-       else                                                            \
-         echo "$@: skipped: no such file: $(_hv_file)";                \
+         grep -l 'VERSION mismatch' $(_hv_file) >/dev/null             \
+           || { echo "$@: skipped: no such file: $(_hv_file)" 1>&2;    \
+                exit 0; };                                             \
+         grep -lE '$(_hv_regex_strong)' $(_hv_file) >/dev/null         \
+           || { echo "$@: $(_hv_file) lacks conforming use of init.sh" 1>&2; \
+                exit 1; };                                             \
+         good=$$(grep -E '$(_hv_regex_strong)' $(_hv_file));           \
+         grep -LFx "$$good"                                            \
+               $$(grep -lE '$(_hv_regex_weak)' $$($(VC_LIST_EXCEPT)))  \
+             | grep . &&                                               \
+           { echo "$(ME): the above files use path_prepend_ inconsistently" \
+               1>&2; exit 1; } || :;                                   \
        fi

 # #if HAVE_... will evaluate to false for any non numeric string.
--
1.7.1.189.g07419




reply via email to

[Prev in Thread] Current Thread [Next in Thread]