summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2009-03-27 09:23:35 +0100
committerJim Meyering <meyering@redhat.com>2009-03-27 09:28:08 +0100
commite65d0d0525159f963b3b859706dc920bcae0a636 (patch)
tree1932498e87117e6c870f7cabaa0e919b854d1cc4 /tests
parent9b6538aa8dbac7ac310487a14d031dce1191921b (diff)
downloadcoreutils-e65d0d0525159f963b3b859706dc920bcae0a636.tar.xz
tests: migrate setgid-check into test-lib.sh
* tests/test-lib.sh (skip_if_setgid_): New function. * tests/setgid-check: Remove file. * tests/Makefile.am (EXTRA_DIST): Remove setgid-check. * tests/chmod/c-option: Use the new function rather than sourcing the separate file. * tests/cp/cp-parents: Likewise. * tests/install/install-C: Likewise. * tests/mkdir/parents: Likewise. * tests/mkdir/perm: Likewise.
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile.am1
-rwxr-xr-xtests/chmod/c-option2
-rwxr-xr-xtests/cp/cp-parents2
-rwxr-xr-xtests/install/install-C2
-rwxr-xr-xtests/mkdir/parents2
-rwxr-xr-xtests/mkdir/perm2
-rw-r--r--tests/setgid-check36
-rw-r--r--tests/test-lib.sh15
8 files changed, 20 insertions, 42 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 5f150ad50..6356eaab6 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -15,7 +15,6 @@ EXTRA_DIST = \
other-fs-tmpdir \
require-perl \
sample-test \
- setgid-check \
test-lib.sh \
$(pr_data)
diff --git a/tests/chmod/c-option b/tests/chmod/c-option
index eb8530a52..7bf9e781f 100755
--- a/tests/chmod/c-option
+++ b/tests/chmod/c-option
@@ -28,7 +28,7 @@ file=f
touch $file || framework_failure
chmod 444 $file || framework_failure
-. "$abs_srcdir/setgid-check"
+skip_if_setgid_
fail=0
diff --git a/tests/cp/cp-parents b/tests/cp/cp-parents
index bfaf747a0..f4130e668 100755
--- a/tests/cp/cp-parents
+++ b/tests/cp/cp-parents
@@ -28,7 +28,7 @@ fi
working_umask_or_skip_
# Run the setgid check from the just-created directory.
-. "$abs_srcdir/setgid-check"
+skip_if_setgid_
mkdir foo bar || framework_failure
mkdir -p a/b/c d e g || framework_failure
diff --git a/tests/install/install-C b/tests/install/install-C
index 3bf0c7beb..9d0ec9016 100755
--- a/tests/install/install-C
+++ b/tests/install/install-C
@@ -22,7 +22,7 @@ if test "$VERBOSE" = yes; then
fi
. $srcdir/test-lib.sh
-. "$abs_srcdir/setgid-check"
+skip_if_setgid_
mode1=0644
mode2=0755
diff --git a/tests/mkdir/parents b/tests/mkdir/parents
index 46f5867d3..3ae35a951 100755
--- a/tests/mkdir/parents
+++ b/tests/mkdir/parents
@@ -22,7 +22,7 @@ if test "$VERBOSE" = yes; then
fi
. $srcdir/test-lib.sh
-. "$abs_srcdir/setgid-check"
+skip_if_setgid_
mkdir -m 700 e-dir || framework_failure
diff --git a/tests/mkdir/perm b/tests/mkdir/perm
index 2f12d073f..146a88e29 100755
--- a/tests/mkdir/perm
+++ b/tests/mkdir/perm
@@ -23,7 +23,7 @@ if test "$VERBOSE" = yes; then
fi
. $srcdir/test-lib.sh
-. "$abs_srcdir/setgid-check"
+skip_if_setgid_
working_umask_or_skip_
diff --git a/tests/setgid-check b/tests/setgid-check
deleted file mode 100644
index cf2618458..000000000
--- a/tests/setgid-check
+++ /dev/null
@@ -1,36 +0,0 @@
-# -*- sh -*-
-# Disable the current test if the working directory seems to have
-# the setgid bit set.
-
-# Copyright (C) 2000, 2002, 2004, 2005, 2007, 2009 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/>.
-
-# This test should be run in the temporary directory that ends
-# up being removed via the trap commands.
-
-cwd_is_setgid=no
-
-setgid_tmpdir=setgid-$$
-(umask 77; mkdir $setgid_tmpdir)
-perms=$(stat --printf %A $setgid_tmpdir)
-rmdir $setgid_tmpdir
-case $perms in
- drwx------);;
- drwxr-xr-x);; # Windows98 + DJGPP 2.03
- *) cwd_is_setgid=yes;;
-esac
-if test $cwd_is_setgid = yes; then
- skip_test_ 'this directory has the setgid bit set'
-fi
diff --git a/tests/test-lib.sh b/tests/test-lib.sh
index 45026f13d..17a35389b 100644
--- a/tests/test-lib.sh
+++ b/tests/test-lib.sh
@@ -262,6 +262,21 @@ mkfifo_or_skip_()
fi
}
+# Disable the current test if the working directory seems to have
+# the setgid bit set.
+skip_if_setgid_()
+{
+ setgid_tmpdir=setgid-$$
+ (umask 77; mkdir $setgid_tmpdir)
+ perms=$(stat --printf %A $setgid_tmpdir)
+ rmdir $setgid_tmpdir
+ case $perms in
+ drwx------);;
+ drwxr-xr-x);; # Windows98 + DJGPP 2.03
+ *) skip_test_ 'this directory has the setgid bit set';;
+ esac
+}
+
skip_if_mcstransd_is_running_()
{
test $# = 0 || framework_failure