summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2007-10-09 09:58:27 +0200
committerJim Meyering <meyering@redhat.com>2007-10-09 10:13:39 +0200
commit4597f40b7fa6f93ec798a6f0143b51c1e555a837 (patch)
treed455f2ab3f9aca9f9f8652eadd8d57df6c04d859
parent91bef1af623fc76d767ffb0af5c6d61c6f6383c5 (diff)
downloadcoreutils-4597f40b7fa6f93ec798a6f0143b51c1e555a837.tar.xz
Skip the chcon test on a system with no SELinux support.
* tests/test-lib.sh (require_selinux_): New function. * tests/misc/chcon: Use it. * tests/misc/selinux: Use it here, too. * tests/cp/cp-a-selinux: and here. * tests/selinux: Remove file. * tests/Makefile.am (EXTRA_DIST): Remove selinux. Reported by Mike Frysinger and Bauke Jan Douma.
-rw-r--r--ChangeLog9
-rw-r--r--tests/Makefile.am1
-rwxr-xr-xtests/cp/cp-a-selinux2
-rwxr-xr-xtests/misc/chcon2
-rwxr-xr-xtests/misc/selinux2
-rw-r--r--tests/selinux23
-rw-r--r--tests/test-lib.sh14
7 files changed, 27 insertions, 26 deletions
diff --git a/ChangeLog b/ChangeLog
index 21c17c937..792be8312 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
2007-10-09 Jim Meyering <meyering@redhat.com>
+ Skip the chcon test on a system with no SELinux support.
+ * tests/test-lib.sh (require_selinux_): New function.
+ * tests/misc/chcon: Use it.
+ * tests/misc/selinux: Use it here, too.
+ * tests/cp/cp-a-selinux: and here.
+ * tests/selinux: Remove file.
+ * tests/Makefile.am (EXTRA_DIST): Remove selinux.
+ Reported by Mike Frysinger and Bauke Jan Douma.
+
* src/dircolors.hin: Recognize .lzma as a compressed-file suffix.
* configure.ac (AM_INIT_AUTOMAKE): Use dist-lzma, rather than dist-bzip2.
diff --git a/tests/Makefile.am b/tests/Makefile.am
index af9328de2..25b77fce0 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -33,7 +33,6 @@ EXTRA_DIST = \
priv-check \
rwx-to-mode \
sample-test \
- selinux \
setgid-check \
sparse-file \
strace \
diff --git a/tests/cp/cp-a-selinux b/tests/cp/cp-a-selinux
index 8cb5a456c..c0d98bdac 100755
--- a/tests/cp/cp-a-selinux
+++ b/tests/cp/cp-a-selinux
@@ -23,9 +23,9 @@ if test "$VERBOSE" = yes; then
fi
. $srcdir/../lang-default
-. $srcdir/../selinux
PRIV_CHECK_ARG=require-root . $srcdir/../priv-check
. $srcdir/../test-lib.sh
+require_selinux_
cwd=`pwd`
cleanup_() { cd /; umount "$cwd/mnt"; }
diff --git a/tests/misc/chcon b/tests/misc/chcon
index 46aaf87e3..3307bc970 100755
--- a/tests/misc/chcon
+++ b/tests/misc/chcon
@@ -9,6 +9,8 @@ fi
. $srcdir/../lang-default
PRIV_CHECK_ARG=require-root . $srcdir/../priv-check
. $srcdir/../test-lib.sh
+require_selinux_
+
mkdir -p d/sub/s2 || framework_failure
touch f g d/sub/1 d/sub/2 || framework_failure
diff --git a/tests/misc/selinux b/tests/misc/selinux
index 67de51ea3..847ccac2c 100755
--- a/tests/misc/selinux
+++ b/tests/misc/selinux
@@ -11,9 +11,9 @@ if test "$VERBOSE" = yes; then
fi
. $srcdir/../lang-default
-. $srcdir/../selinux
. $srcdir/../test-lib.sh
skip_if_root_
+require_selinux_
# Create a regular file, dir, fifo.
touch f || framework_failure
diff --git a/tests/selinux b/tests/selinux
deleted file mode 100644
index 2026a6a98..000000000
--- a/tests/selinux
+++ /dev/null
@@ -1,23 +0,0 @@
-# Skip this test if there is insufficient SELinux support.
-# Copyright (C) 2007 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/>.
-
-case `ls -Zd .` in
- '? .'|'unlabeled .')
- echo "$0: skipping this test; this system (or maybe just" 1>&2
- echo " the current file system) lacks SELinux support" 1>&2
- (exit 77); exit 77
- ;;
-esac
diff --git a/tests/test-lib.sh b/tests/test-lib.sh
index 9d47242e4..66fbc1dc4 100644
--- a/tests/test-lib.sh
+++ b/tests/test-lib.sh
@@ -39,6 +39,16 @@ skip_if_()
esac
}
+require_selinux_()
+{
+ case `ls -Zd .` in
+ '? .'|'unlabeled .')
+ skip_test_ "this system (or maybe just" \
+ "the current file system) lacks SELinux support"
+ ;;
+ esac
+}
+
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'; }
@@ -73,3 +83,7 @@ elif ( cmp --version < /dev/null 2>&1 | grep GNU ) 2>&1 > /dev/null; then
else
compare() { cmp "$@"; }
fi
+
+# Local Variables:
+# indent-tabs-mode: nil
+# End: