bug-gnulib
[Top][All Lists]
Advanced

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

[PATCH] maint.mk: add a PATH crosschecking syntax-check rule


From: Jim Meyering
Subject: [PATCH] maint.mk: add a PATH crosschecking syntax-check rule
Date: Wed, 07 Apr 2010 13:47:48 +0200

Just pushed:
Here's a new syntax-check.
It has spotted inconsistencies in at least two projects already.

>From bfffe408f8b375fd0989266bd8c01580be26d1a8 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Wed, 7 Apr 2010 13:45:59 +0200
Subject: [PATCH] maint.mk: add a PATH crosschecking syntax-check rule

* top/maint.mk (sc_cross_check_PATH_usage_in_tests): New rule.
Useful if you use a test like the one in help-version (coreutils,
diffutils, grep, gzip) that ensures $(VERSION) matches what is
printed by prog --version.
---
 ChangeLog    |    8 ++++++++
 top/maint.mk |   20 ++++++++++++++++++++
 2 files changed, 28 insertions(+), 0 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index f382fb6..9098f73 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2010-04-07  Jim Meyering  <address@hidden>
+
+       maint.mk: add a PATH crosschecking syntax-check rule
+       * top/maint.mk (sc_cross_check_PATH_usage_in_tests): New rule.
+       Useful if you use a test like the one in help-version (coreutils,
+       diffutils, grep, gzip) that ensures $(VERSION) matches what is
+       printed by prog --version.
+
 2010-04-06  Bruno Haible  <address@hidden>

        Fix link error on mingw.
diff --git a/top/maint.mk b/top/maint.mk
index 3038680..5854f9a 100644
--- a/top/maint.mk
+++ b/top/maint.mk
@@ -849,6 +849,26 @@ sc_copyright_check:
        halt='out of date copyright in $(texi); update it'              \
          $(_sc_search_regexp)

+# 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 -LFx "$$good"                                            \
+               $$(grep -lE '$(_hv_regex)' $$($(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.
 # That would be flagged by using -Wundef, however gnulib currently
 # tests many undefined macros, and so we can't enable that option.
--
1.7.1.rc0.212.gbd88f




reply via email to

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