]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
tests: adjust PATH to include /sbin for mkfs-using tests
authorBernhard Voelker <mail@bernhard-voelker.de>
Wed, 7 Sep 2011 09:58:52 +0000 (11:58 +0200)
committerJim Meyering <meyering@redhat.com>
Wed, 7 Sep 2011 16:00:55 +0000 (18:00 +0200)
* 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.

tests/cp/cp-a-selinux
tests/cp/cp-mv-enotsup-xattr
tests/cp/sparse-fiemap
tests/init.cfg
tests/mkdir/writable-under-readonly
tests/rm/read-only

index 8a8e37415c3f4539455b5a657ac1ac36a99ef0c4..0f9c1493848096f9ea260bcdc4d72ec219aecb1b 100755 (executable)
@@ -23,6 +23,7 @@
 print_ver_ cp
 require_root_
 require_selinux_
+require_mkfs_PATH_
 
 cwd=`pwd`
 cleanup_() { cd /; umount "$cwd/mnt"; }
index 9857fec4134df88c64bc2ae6e478357fe0321213..32798d2fc5ac1a0b632fc4e5d08154da3506ff3b 100755 (executable)
@@ -22,6 +22,7 @@
 print_ver_ cp mv
 
 require_root_
+require_mkfs_PATH_
 
 cwd=`pwd`
 cleanup_() { cd /; umount "$cwd/noxattr"; umount "$cwd/xattr"; }
index 5eedb4fa7207b6713ef2158495d6419642de92ea..831bf0bdd4bf43a0a229099946e8a17429236ced 100755 (executable)
@@ -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"; }
index f7615e6abd4d452d37685e1429a6be55d0f93f6f..0d137ab9b0077bd8531499c5f2caefeadff2a147 100644 (file)
@@ -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
index c0f83fb5b2a6b078b15cd52be5d87924eac4d2a5..3e42b1d787f6125cfa6182f875af89447aa2a3e8 100755 (executable)
@@ -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
index c52883b60b4c0fc4776d4e708d4a4ff5733f7ad8..489b1bf3db5a8ca518293cc17b9b43f78106ba63 100755 (executable)
@@ -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"; }