From 2fc00bda8c6aaab5d0478cc54cf78260090ba74c Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Thu, 20 Dec 2007 14:19:56 +0100 Subject: Avoid another "make check" failure due to omitted programs. * tests/test-lib.sh (require_built_): New function. * tests/misc/groups-version: Use it to skip this test if either groups or id is not built. --- tests/misc/groups-version | 1 + tests/test-lib.sh | 13 +++++++++++++ 2 files changed, 14 insertions(+) (limited to 'tests') diff --git a/tests/misc/groups-version b/tests/misc/groups-version index 15327be32..e7050c30f 100755 --- a/tests/misc/groups-version +++ b/tests/misc/groups-version @@ -23,6 +23,7 @@ fi . $srcdir/../lang-default . $srcdir/../test-lib.sh +require_built_ groups id fail=0 groups --version | sed 's/^groups/id/; /^$/q' > out || fail=1 diff --git a/tests/test-lib.sh b/tests/test-lib.sh index 8872b27b1..a3afba0bf 100644 --- a/tests/test-lib.sh +++ b/tests/test-lib.sh @@ -29,6 +29,19 @@ require_ulimit_() && skip_test_ "this shell lacks ulimit support" } +require_built_() +{ + skip_=no + for i in "$@"; do + case " $built_programs " in + *" $i "*) ;; + *) echo "$i: not built" 1>&2; skip_=yes ;; + esac + done + + test $skip_ = yes && skip_test_ "required program(s) not built" +} + uid_is_privileged_() { # Make sure id -u succeeds. -- cgit v1.2.3-70-g09d2