summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/Makefile.am1
-rwxr-xr-xtests/chgrp/basic2
-rwxr-xr-xtests/chgrp/default-no-deref2
-rwxr-xr-xtests/chgrp/deref2
-rwxr-xr-xtests/chgrp/no-x2
-rwxr-xr-xtests/chgrp/posix-H2
-rwxr-xr-xtests/chgrp/recurse2
-rwxr-xr-xtests/cp/existing-perm-race2
-rw-r--r--tests/group-names35
-rw-r--r--tests/test-lib.sh23
10 files changed, 30 insertions, 43 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 515cfe6fe..62defa25a 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -12,7 +12,6 @@ EXTRA_DIST = \
README \
check.mk \
envvar-check \
- group-names \
input-tty \
lang-default \
mk-script \
diff --git a/tests/chgrp/basic b/tests/chgrp/basic
index c21aec04f..889a62c9a 100755
--- a/tests/chgrp/basic
+++ b/tests/chgrp/basic
@@ -21,8 +21,8 @@ if test "$VERBOSE" = yes; then
chgrp --version
fi
-. $top_srcdir/tests/group-names
. $top_srcdir/tests/test-lib.sh
+require_membership_in_two_groups_
fail=0
diff --git a/tests/chgrp/default-no-deref b/tests/chgrp/default-no-deref
index e1f711d7c..ff484ed00 100755
--- a/tests/chgrp/default-no-deref
+++ b/tests/chgrp/default-no-deref
@@ -21,8 +21,8 @@ if test "$VERBOSE" = yes; then
chgrp --version
fi
-. $top_srcdir/tests/group-names
. $top_srcdir/tests/test-lib.sh
+require_membership_in_two_groups_
set _ $groups; shift
g2=$2
diff --git a/tests/chgrp/deref b/tests/chgrp/deref
index f3453fb7a..ce70b9d2f 100755
--- a/tests/chgrp/deref
+++ b/tests/chgrp/deref
@@ -21,8 +21,8 @@ if test "$VERBOSE" = yes; then
chgrp --version
fi
-. $top_srcdir/tests/group-names
. $top_srcdir/tests/test-lib.sh
+require_membership_in_two_groups_
set _ $groups; shift
g1=$1
diff --git a/tests/chgrp/no-x b/tests/chgrp/no-x
index fbe100265..93dd520c3 100755
--- a/tests/chgrp/no-x
+++ b/tests/chgrp/no-x
@@ -22,8 +22,8 @@ if test "$VERBOSE" = yes; then
chgrp --version
fi
-. $top_srcdir/tests/group-names
. $top_srcdir/tests/test-lib.sh
+require_membership_in_two_groups_
skip_if_root_
set _ $groups; shift
diff --git a/tests/chgrp/posix-H b/tests/chgrp/posix-H
index 88345767b..0b18b44ce 100755
--- a/tests/chgrp/posix-H
+++ b/tests/chgrp/posix-H
@@ -21,8 +21,8 @@ if test "$VERBOSE" = yes; then
chgrp --version
fi
-. $top_srcdir/tests/group-names
. $top_srcdir/tests/test-lib.sh
+require_membership_in_two_groups_
set _ $groups; shift
g1=$1
diff --git a/tests/chgrp/recurse b/tests/chgrp/recurse
index 4ae30f969..52b0e1973 100755
--- a/tests/chgrp/recurse
+++ b/tests/chgrp/recurse
@@ -21,8 +21,8 @@ if test "$VERBOSE" = yes; then
chgrp --version
fi
-. $top_srcdir/tests/group-names
. $top_srcdir/tests/test-lib.sh
+require_membership_in_two_groups_
set _ $groups; shift
g1=$1
diff --git a/tests/cp/existing-perm-race b/tests/cp/existing-perm-race
index aa6d7c99a..f2a328723 100755
--- a/tests/cp/existing-perm-race
+++ b/tests/cp/existing-perm-race
@@ -21,8 +21,8 @@ if test "$VERBOSE" = yes; then
cp --version
fi
-. $top_srcdir/tests/group-names
. $top_srcdir/tests/test-lib.sh
+require_membership_in_two_groups_
set _ $groups; shift
g1=$1
diff --git a/tests/group-names b/tests/group-names
deleted file mode 100644
index f9e063861..000000000
--- a/tests/group-names
+++ /dev/null
@@ -1,35 +0,0 @@
-# -*- sh -*-
-# Set `groups' to a space-separated list of at least two groups of which
-# the user is a member.
-
-# Copyright (C) 2000, 2004, 2005 Free Software Foundation, Inc.
-
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-groups=${COREUTILS_GROUPS-`(id -G || /usr/xpg4/bin/id -G) 2>/dev/null`}
-case "$groups" in
- *' '*) ;;
- *) cat <<EOF 1>&2
-$0: this test requires that you be a member of more than one group,
-but running \`id -G' either failed or found just one. If you really
-are a member of at least two groups, then rerun this test with
-COREUTILS_GROUPS set in your environment to the space-separated list
-of group names or numbers. E.g.,
-
- env COREUTILS_GROUPS='users cdrom' make check
-
-EOF
- (exit 77); exit 77
- ;;
-esac
diff --git a/tests/test-lib.sh b/tests/test-lib.sh
index acdcbfb9c..bd6be422b 100644
--- a/tests/test-lib.sh
+++ b/tests/test-lib.sh
@@ -174,6 +174,29 @@ skip_if_root_() { uid_is_privileged_ && skip_test_ "must be run as non-root"; }
error_() { echo "$0: $@" 1>&2; (exit 1); exit 1; }
framework_failure() { error_ 'failure in testing framework'; }
+# Set `groups' to a space-separated list of at least two groups
+# of which the user is a member.
+require_membership_in_two_groups_()
+{
+ test $# = 0 || framework_failure
+
+ groups=${COREUTILS_GROUPS-`(id -G || /usr/xpg4/bin/id -G) 2>/dev/null`}
+ case "$groups" in
+ *' '*) ;;
+ *) skip_test_ '
+$0: this test requires that you be a member of more than one group,
+but running `id -G'\'' either failed or found just one. If you really
+are a member of at least two groups, then rerun this test with
+COREUTILS_GROUPS set in your environment to the space-separated list
+of group names or numbers. E.g.,
+
+ env COREUTILS_GROUPS='users cdrom' make check
+
+'
+ ;;
+ esac
+}
+
mkfifo_or_skip_()
{
test $# = 1 || framework_failure