# HG changeset patch # User Jim Meyering # Date 1273437009 -7200 # Node ID dc2c7e3048ec6b5aebe69000811a132f809d0ebf # Parent fbf6aad1d20d4bae5c2ae22a7d3a25fb859c0bdd 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. diff --git a/ChangeLog b/ChangeLog --- a/ChangeLog +++ b/ChangeLog @@ -9,6 +9,20 @@ 2010-05-09 Jim Meyering + 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 --- a/top/maint.mk +++ b/top/maint.mk @@ -979,20 +979,22 @@ # 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.