summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBernhard Voelker <mail@bernhard-voelker.de>2011-09-07 11:58:52 +0200
committerJim Meyering <meyering@redhat.com>2011-09-07 18:00:55 +0200
commit5eeaca942ab8fc090cd6b0ae2fede698dc9a6f5d (patch)
tree6f08f0384fb441e15a2b606d73362a1e92cce2d1
parentf85ca2c876f6bc087dd1eca692f79f5f5d7f8bb3 (diff)
downloadcoreutils-5eeaca942ab8fc090cd6b0ae2fede698dc9a6f5d.tar.xz
tests: adjust PATH to include /sbin for mkfs-using tests
* tests/init.cfg (require_mkfs_PATH_): New function to test whether mkfs is in PATH, otherwise adding /sbin to PATH. Needed for distributions (OpenSuSE, Solaris) in which sudo does not include /sbin in PATH. * tests/cp/cp-a-selinux: Use require_mkfs_PATH_. * tests/cp/cp-mv-enotsup-xattr: Likewise. * tests/cp/sparse-fiemap: Likewise. * tests/mkdir/writable-under-readonly: Likewise. * tests/rm/read-only: Likewise.
-rwxr-xr-xtests/cp/cp-a-selinux1
-rwxr-xr-xtests/cp/cp-mv-enotsup-xattr1
-rwxr-xr-xtests/cp/sparse-fiemap1
-rw-r--r--tests/init.cfg17
-rwxr-xr-xtests/mkdir/writable-under-readonly1
-rwxr-xr-xtests/rm/read-only1
6 files changed, 22 insertions, 0 deletions
diff --git a/tests/cp/cp-a-selinux b/tests/cp/cp-a-selinux
index 8a8e37415..0f9c14938 100755
--- a/tests/cp/cp-a-selinux
+++ b/tests/cp/cp-a-selinux
@@ -23,6 +23,7 @@
print_ver_ cp
require_root_
require_selinux_
+require_mkfs_PATH_
cwd=`pwd`
cleanup_() { cd /; umount "$cwd/mnt"; }
diff --git a/tests/cp/cp-mv-enotsup-xattr b/tests/cp/cp-mv-enotsup-xattr
index 9857fec41..32798d2fc 100755
--- a/tests/cp/cp-mv-enotsup-xattr
+++ b/tests/cp/cp-mv-enotsup-xattr
@@ -22,6 +22,7 @@
print_ver_ cp mv
require_root_
+require_mkfs_PATH_
cwd=`pwd`
cleanup_() { cd /; umount "$cwd/noxattr"; umount "$cwd/xattr"; }
diff --git a/tests/cp/sparse-fiemap b/tests/cp/sparse-fiemap
index 5eedb4fa7..831bf0bdd 100755
--- a/tests/cp/sparse-fiemap
+++ b/tests/cp/sparse-fiemap
@@ -32,6 +32,7 @@ else
# It's not; we need to create one, hence we need root access.
require_root_
+ require_mkfs_PATH_
cwd=$PWD
cleanup_() { cd /; umount "$cwd/mnt"; }
diff --git a/tests/init.cfg b/tests/init.cfg
index f7615e6ab..0d137ab9b 100644
--- a/tests/init.cfg
+++ b/tests/init.cfg
@@ -180,6 +180,23 @@ uid_is_privileged_()
esac
}
+# Some versions of sudo do not include /sbin in PATH.
+# Test if mkfs is in PATH, otherwise try to adapt PATH.
+require_mkfs_PATH_()
+{
+ type mkfs && return
+
+ case ":$PATH:" in
+ *:/sbin:*) skip_ "no usable mkfs found" ;;
+ esac
+
+ test -x /sbin/mkfs \
+ || skip_ "no usable mkfs found"
+
+ PATH="$PATH:/sbin"
+ export PATH
+}
+
get_process_status_()
{
sed -n '/^State:[ ]*\([[:alpha:]]\).*/s//\1/p' /proc/$1/status
diff --git a/tests/mkdir/writable-under-readonly b/tests/mkdir/writable-under-readonly
index c0f83fb5b..3e42b1d78 100755
--- a/tests/mkdir/writable-under-readonly
+++ b/tests/mkdir/writable-under-readonly
@@ -27,6 +27,7 @@
. "${srcdir=.}/init.sh"; path_prepend_ ../src
print_ver_ mkdir
require_root_
+require_mkfs_PATH_
# FIXME: for now, skip it unconditionally
skip_ temporarily disabled
diff --git a/tests/rm/read-only b/tests/rm/read-only
index c52883b60..489b1bf3d 100755
--- a/tests/rm/read-only
+++ b/tests/rm/read-only
@@ -19,6 +19,7 @@
. "${srcdir=.}/init.sh"; path_prepend_ ../src
print_ver_ rm
require_root_
+require_mkfs_PATH_
cwd=`pwd`
cleanup_() { cd /; umount "$cwd/mnt"; }