coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: coreutils-8.12.193-d8dc8: 2 tests skipped: failed to create ext2 fil


From: Jim Meyering
Subject: Re: coreutils-8.12.193-d8dc8: 2 tests skipped: failed to create ext2 file system
Date: Wed, 07 Sep 2011 18:03:54 +0200

Bernhard Voelker wrote:

> On 09/07/2011 12:42 PM, Jim Meyering wrote:
>> Jim Meyering wrote:
>>> Here are some minor changes I expect to merge into your commit.
>>> I'll post a complete patch for your ACK before I push it.
>>>
>>> (btw, your patch did not apply via "git am FILE"
>>> due to fuzz in the init.cfg patch, but I managed
>>> by applying with patch, pasting your log into ChangeLog
>>> and running vc-dwim --commit.  However that failed
>>> due to a typo fixed via s/writeable/writable.)
>>>
>>> diff --git a/tests/init.cfg b/tests/init.cfg
>>> index bbd576c..4565907 100644
>>> --- a/tests/init.cfg
>>> +++ b/tests/init.cfg
>>> @@ -180,18 +180,17 @@ uid_is_privileged_()
>>>     esac
>>>   }
>>>
>>> -# Some distributions do not add /sbin to PATH for non-root users.
>>> +# Some distributions do not include /sbin in the sudo-to-root PATH.
>>>   # Test if mkfs is in PATH, otherwise try to adapt PATH.
>>>   require_mkfs_PATH_()
>>>   {
>>> -  which mkfs>/dev/null 2>&1 \
>>> -&&  return
>>> +  type mkfs&&  return
>>>
>>>     case ":$PATH:" in
>>>       *:/sbin:*) skip_ "no usable mkfs found" ;;
>>>     esac
>>>
>>> -  [ -x /sbin/mkfs ] \
>>> +  test -x /sbin/mkfs \
>>>       || skip_ "no usable mkfs found"
>>
>> Explaining the code changes above:
>>
>>      "which" is not portable, so we use the "type" built-in instead.
>>
>>      coreutils tests consistently use "test ARGS..." rather
>>      than "[ ARGS... ]" because I prefer the former syntax.
>>      With it, there is no need to ensure that there is a matching "]".

Here's what I'd like to push:

>From 5eeaca942ab8fc090cd6b0ae2fede698dc9a6f5d Mon Sep 17 00:00:00 2001
From: Bernhard Voelker <address@hidden>
Date: Wed, 7 Sep 2011 11:58:52 +0200
Subject: [PATCH] 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.
---
 tests/cp/cp-a-selinux               |    1 +
 tests/cp/cp-mv-enotsup-xattr        |    1 +
 tests/cp/sparse-fiemap              |    1 +
 tests/init.cfg                      |   17 +++++++++++++++++
 tests/mkdir/writable-under-readonly |    1 +
 tests/rm/read-only                  |    1 +
 6 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/tests/cp/cp-a-selinux b/tests/cp/cp-a-selinux
index 8a8e374..0f9c149 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 9857fec..32798d2 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 5eedb4f..831bf0b 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 f7615e6..0d137ab 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 c0f83fb..3e42b1d 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 c52883b..489b1bf 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"; }
--
1.7.7.rc0.362.g5a14



reply via email to

[Prev in Thread] Current Thread [Next in Thread]