diff options
author | Jim Meyering <meyering@redhat.com> | 2010-05-09 22:30:09 +0200 |
---|---|---|
committer | Jim Meyering <meyering@redhat.com> | 2010-05-09 22:40:34 +0200 |
commit | 9c827e02efc96390ff7b3e2868684bad1e4b2b1d (patch) | |
tree | 45d87af22c9f1c1e63384e4175084e47e94e6c3a /top/maint.mk | |
parent | 190bf61ecbb3727a3dd742498938be9e251f9315 (diff) | |
download | gnulib-9c827e02efc96390ff7b3e2868684bad1e4b2b1d.tar.gz |
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.
Diffstat (limited to 'top/maint.mk')
-rw-r--r-- | top/maint.mk | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/top/maint.mk b/top/maint.mk index 8d3d137d8f..2e11ac1387 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. |