aboutsummaryrefslogtreecommitdiffstats
path: root/tests/init.cfg
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 /tests/init.cfg
parenttests: avoid false-positive "make check" failure when perl is missing (diff)
downloadcoreutils-5eeaca942ab8fc090cd6b0ae2fede698dc9a6f5d.tar.gz
coreutils-5eeaca942ab8fc090cd6b0ae2fede698dc9a6f5d.zip
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.
Diffstat (limited to 'tests/init.cfg')
-rw-r--r--tests/init.cfg17
1 files changed, 17 insertions, 0 deletions
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