tests: help-version: cross-check PATH in tests
authorJim Meyering <meyering@redhat.com>
Wed, 7 Apr 2010 06:30:51 +0000 (08:30 +0200)
committerJim Meyering <meyering@redhat.com>
Wed, 7 Apr 2010 07:22:43 +0000 (09:22 +0200)
* tests/help-version: Cross-check $VERSION and --version output.
* tests/Makefile.am (TESTS_ENVIRONMENT): Export VERSION=$(VERSION).

tests/Makefile.am
tests/help-version

index 59ea2f2859e0c978da1cd42ee542c7c59b36fea4..03eb4a3d557ebfb3629feca3939dac0c6493c707 100644 (file)
@@ -70,6 +70,7 @@ TESTS_ENVIRONMENT =                           \
   };                                           \
   export                                       \
   LC_ALL=C                                     \
+  VERSION=$(VERSION)                           \
   abs_top_builddir='$(abs_top_builddir)'       \
   abs_top_srcdir='$(abs_top_srcdir)'           \
   abs_srcdir='$(abs_srcdir)'                   \
index 063ad30db98cbc329c889e1d13ad8cb199f2ab1d..5d73f5da516fec9019c80c3b15548e4d5fc43429 100755 (executable)
@@ -59,6 +59,19 @@ expected_failure_status_fgrep=2
 test "$built_programs" \
   || fail_ "built_programs not specified!?!"
 
+test "$VERSION" \
+  || fail_ "set envvar VERSION; it is required for a PATH sanity-check"
+
+# Extract version from --version output of the first program
+for i in $built_programs; do
+  v=$(env $i --version | sed -n '1s/.* //p;q')
+  break
+done
+
+# Ensure that it matches $VERSION.
+test "x$v" = "x$VERSION" \
+  || fail_ "--version-\$VERSION mismatch"
+
 for lang in C fr da; do
   for i in $built_programs; do