summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2010-04-07 11:47:28 +0200
committerJim Meyering <meyering@redhat.com>2010-04-07 11:47:28 +0200
commitf6b2f46714c7aab9f1402008f12f8c83487a5761 (patch)
tree98eaf61aff3ecc1c90fde5dd0f8e2c0efabc00dc /tests
parentf267926f2d3e51756a21b772b017f698c0a10f41 (diff)
downloadcoreutils-f6b2f46714c7aab9f1402008f12f8c83487a5761.tar.xz
tests: add a PATH-sanity-check to help-version
* tests/misc/help-version: Sync from gzip's version. * tests/check.mk (TESTS_ENVIRONMENT): Export VERSION, as required for new help-version test.
Diffstat (limited to 'tests')
-rw-r--r--tests/check.mk1
-rwxr-xr-xtests/misc/help-version15
2 files changed, 15 insertions, 1 deletions
diff --git a/tests/check.mk b/tests/check.mk
index d3b08e095..df0c92467 100644
--- a/tests/check.mk
+++ b/tests/check.mk
@@ -69,6 +69,7 @@ TESTS_ENVIRONMENT = \
fi; \
}; \
export \
+ VERSION='$(VERSION)' \
LOCALE_FR='$(LOCALE_FR)' \
LOCALE_FR_UTF8='$(LOCALE_FR_UTF8)' \
abs_top_builddir='$(abs_top_builddir)' \
diff --git a/tests/misc/help-version b/tests/misc/help-version
index 976d18a31..ea16516c9 100755
--- a/tests/misc/help-version
+++ b/tests/misc/help-version
@@ -58,7 +58,20 @@ expected_failure_status_egrep=2
expected_failure_status_fgrep=2
test "$built_programs" \
- || { echo "$this_test: no programs built!?!" 1>&2; Exit 1; }
+ || 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