diff options
author | Bernhard Voelker <mail@bernhard-voelker.de> | 2011-12-01 01:04:34 +0100 |
---|---|---|
committer | Jim Meyering <meyering@redhat.com> | 2011-12-01 09:07:13 +0100 |
commit | 8df7652cfaf3286477c8c451e6a3b2ed977886bb (patch) | |
tree | a1165bb1fcd29f8fd09c7987189b7597c8339ed8 /tests/init.cfg | |
parent | 92b7b7708e3767050a433e7e443861e1ecc3a150 (diff) | |
download | coreutils-8df7652cfaf3286477c8c451e6a3b2ed977886bb.tar.xz |
tests: adjust PATH to generally include /sbin and /usr/sbin
Commit 5eeaca94 added /sbin to the PATH for tests using mkfs. For other
tests, e.g. tests/cp-fiemap-perf using filefrag, we need /usr/sbin also.
Add both directories generally for the tests, "since many of us always
augment our PATH with all of the sbin paths all of the time anyway" (Bob
in http://lists.gnu.org/archive/html/coreutils/2011-11/msg00107.html).
The previous commit is hereby obsolete.
* tests/init.cfg (sanitize_path_): Add /sbin and /usr/sbin to PATH
unless already included. Needed for tests using admin tools like mkfs
and filefrag on systems where the user's environment does not have
these directories in the PATH.
* tests/init.cfg (require_mkfs_PATH_): Remove obsolete function.
* tests/cp/cp-a-selinux: Remove require_mkfs_PATH_ call.
* 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.cfg | 25 |
1 files changed, 8 insertions, 17 deletions
diff --git a/tests/init.cfg b/tests/init.cfg index 9b05b3418..938d1bbab 100644 --- a/tests/init.cfg +++ b/tests/init.cfg @@ -23,6 +23,7 @@ stderr_fileno_=9 # Having an unsearchable directory in PATH causes execve to fail with EACCES # when applied to an unresolvable program name, contrary to the desired ENOENT. # Avoid the problem by rewriting PATH to exclude unsearchable directories. +# Also, if PATH lacks /sbin and/or /usr/sbin, append it/them. sanitize_path_() { # FIXME: remove double quotes around $IFS when all tests use init.sh. @@ -43,6 +44,13 @@ sanitize_path_() fi done + for d in /sbin /usr/sbin ; do + case ":$new_path:" in + *:$d:*) ;; + *) new_path="$new_path:$d" ;; + esac + done + PATH=$new_path export PATH } @@ -195,23 +203,6 @@ 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 |