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.
This commit is contained in:
Bernhard Voelker authored and Jim Meyering committed 2011-09-07 18:00:55 +02:00
1 parent f85ca2c876
commit 5eeaca942a
6 files changed
+22

No files matched your search

+1
View File
@@ -23,6 +23,7 @@
print_ver_ cp print_ver_ cp
require_root_ require_root_
require_selinux_ require_selinux_
require_mkfs_PATH_
cwd=`pwd` cwd=`pwd`
cleanup_() { cd /; umount "$cwd/mnt"; } cleanup_() { cd /; umount "$cwd/mnt"; }
+1
View File
@@ -22,6 +22,7 @@
print_ver_ cp mv print_ver_ cp mv
require_root_ require_root_
require_mkfs_PATH_
cwd=`pwd` cwd=`pwd`
cleanup_() { cd /; umount "$cwd/noxattr"; umount "$cwd/xattr"; } cleanup_() { cd /; umount "$cwd/noxattr"; umount "$cwd/xattr"; }
+1
View File
@@ -32,6 +32,7 @@ else
# It's not; we need to create one, hence we need root access. # It's not; we need to create one, hence we need root access.
require_root_ require_root_
require_mkfs_PATH_
cwd=$PWD cwd=$PWD
cleanup_() { cd /; umount "$cwd/mnt"; } cleanup_() { cd /; umount "$cwd/mnt"; }
+17
View File
@@ -180,6 +180,23 @@ uid_is_privileged_()
esac 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_() get_process_status_()
{ {
sed -n '/^State:[ ]*\([[:alpha:]]\).*/s//\1/p' /proc/$1/status sed -n '/^State:[ ]*\([[:alpha:]]\).*/s//\1/p' /proc/$1/status
+1
View File
@@ -27,6 +27,7 @@
. "${srcdir=.}/init.sh"; path_prepend_ ../src . "${srcdir=.}/init.sh"; path_prepend_ ../src
print_ver_ mkdir print_ver_ mkdir
require_root_ require_root_
require_mkfs_PATH_
# FIXME: for now, skip it unconditionally # FIXME: for now, skip it unconditionally
skip_ temporarily disabled skip_ temporarily disabled
+1
View File
@@ -19,6 +19,7 @@
. "${srcdir=.}/init.sh"; path_prepend_ ../src . "${srcdir=.}/init.sh"; path_prepend_ ../src
print_ver_ rm print_ver_ rm
require_root_ require_root_
require_mkfs_PATH_
cwd=`pwd` cwd=`pwd`
cleanup_() { cd /; umount "$cwd/mnt"; } cleanup_() { cd /; umount "$cwd/mnt"; }