From: Jim Meyering Date: Wed, 7 Apr 2010 06:30:51 +0000 (+0200) Subject: tests: help-version: cross-check PATH in tests X-Git-Tag: v1.5~78 X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=354630a002ef8ab5b9f70d98baf7a441d87b0629;p=debian%2Fgzip tests: help-version: cross-check PATH in tests * tests/help-version: Cross-check $VERSION and --version output. * tests/Makefile.am (TESTS_ENVIRONMENT): Export VERSION=$(VERSION). --- diff --git a/tests/Makefile.am b/tests/Makefile.am index 59ea2f2..03eb4a3 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -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)' \ diff --git a/tests/help-version b/tests/help-version index 063ad30..5d73f5d 100755 --- a/tests/help-version +++ b/tests/help-version @@ -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