diff options
author | Harshavardhana <harsha@harshavardhana.net> | 2014-08-19 16:14:03 -0700 |
---|---|---|
committer | Harshavardhana <harsha@harshavardhana.net> | 2014-08-26 15:27:29 -0700 |
commit | 74cf4e1920db1edae6728cfe632e4ca7aea5be59 (patch) | |
tree | 33f116ca794e57979ceccd340f8151995e51569a /tests/include.rc | |
parent | 77ce88681c15e711e87d23b891a488b2fd825eb0 (diff) |
porting: `pidof` portability for OSX/FreeBSD
- Provide a portable `pidof` just to be used specifically with
glusterfs regression tests on OSX and FreeBSD. This was
written after countless hrs of effort to get a sane `pidof`
working on either of the environments.
`pidof` comes at the wake of lack of proper procfs support
and also incompatible way of handling process names since
glusterd/glusterfs are symbolic links to 'glusterfsd'
- tests/utils/* directory should be part of 'PATH' to avoid
abspath calculation using $(dirname)
- cleanup() - rpcinfo command prints error on FreeBSD/OSX fix it
Change-Id: I35f86273624cb279da1c8fae056ca27669e251d8
BUG: 1131713
Signed-off-by: Harshavardhana <harsha@harshavardhana.net>
Reviewed-on: http://review.gluster.org/8499
Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Diffstat (limited to 'tests/include.rc')
-rw-r--r-- | tests/include.rc | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/tests/include.rc b/tests/include.rc index 6b933b036f7..38f713ae73a 100644 --- a/tests/include.rc +++ b/tests/include.rc @@ -25,6 +25,8 @@ MOUNT_TYPE_FUSE="fuse.glusterfs" GREP_MOUNT_OPT_RO="grep (ro" GREP_MOUNT_OPT_RW="grep (rw" +PATH=$PATH:${PWD}/tests/utils + case $OSTYPE in Linux) H0=${H0:=`hostname --fqdn`}; # hostname @@ -256,6 +258,12 @@ which killall > /dev/null || { } } +which pidof > /dev/null || { + pidof() { + pidof.py $1 + } +} + stat -c %s /dev/null > /dev/null 2>&1 || { stat() { local format="" @@ -322,17 +330,17 @@ function cleanup() # unregister nfs and related services from portmapper/rpcbind ## nfs - rpcinfo -d 100003 3 + rpcinfo -d 100003 3 2>/dev/null || true; ## mountd - rpcinfo -d 100005 1 - rpcinfo -d 100005 3 + rpcinfo -d 100005 1 2>/dev/null || true; + rpcinfo -d 100005 3 2>/dev/null || true; ## nlockmgr - rpcinfo -d 100021 1 - rpcinfo -d 100021 4 + rpcinfo -d 100021 1 2>/dev/null || true; + rpcinfo -d 100021 4 2>/dev/null || true; ## nfs_acl - rpcinfo -d 100227 3 + rpcinfo -d 100227 3 2>/dev/null || true; - type cleanup_lvm &>/dev/null && cleanup_lvm + type cleanup_lvm &>/dev/null && cleanup_lvm || true; case `uname -s` in Linux) |