diff options
author | Jim Meyering <meyering@redhat.com> | 2010-04-07 10:51:19 +0200 |
---|---|---|
committer | Jim Meyering <meyering@redhat.com> | 2010-04-07 11:01:31 +0200 |
commit | 46773b6abbfd75432387a6e28579a11c62e897d9 (patch) | |
tree | ff0f7c811ae88fbc3c1e6295f9df534f8ce5f7d2 | |
parent | 55cf264a2bac21ed6b8729bc175df421e35facf4 (diff) | |
download | diffutils-46773b6abbfd75432387a6e28579a11c62e897d9.tar.gz |
tests: add syntax-check rule to verify that tests use proper PATH
* cfg.mk (sc_cross_check_PATH_usage_in_tests): New rule, that is
useful only in conjunction with the help-version script.
-rw-r--r-- | cfg.mk | 20 |
1 files changed, 20 insertions, 0 deletions
@@ -62,3 +62,23 @@ config-save: mkdir -p $(_cf_state_dir)/$(_date_time) ln -nsf $(date_time) $(_cf_state_dir)/latest cp lib/config.h config.status $(_cf_state_dir)/latest + +# If tests/help-version exists and seems to be new enough, assume that its +# use of init.sh and path_prepend_ is correct, and ensure that every other +# use of init.sh is identical. +# This is useful because help-version cross-checks prog --version +# with $(VERSION), which verifies that its path_prepend_ invocation +# 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 +sc_cross_check_PATH_usage_in_tests: + @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 -LF "$$good" \ + $$(grep -lE '$(_hv_regex)' $$($(VC_LIST_EXCEPT))) \ + | grep . && \ + { echo "$(ME): the above files use path_prepend_ inconsistently" \ + 1>&2; exit 1; } || :; \ + fi |