From 6b4702897bd56e29db4db06f8cf896f89df1133c Mon Sep 17 00:00:00 2001 From: Xavier Hernandez Date: Thu, 10 Jul 2014 10:19:06 +0200 Subject: tests: Fixed spurious failure in bug-887098-gmount-crash.t This script was trying to see if the mount process died by doing a 'ps ax' and a grep of the original pid in the results. After that the pid of the first line returned by grep was compared to the original pid. This method can lead to false negatives because it's possible that the original pid appears in some other part of the 'ps ax' list. This patch uses get_mount_process_pid() from volume.rc to check if the process is still alive. Change-Id: I0285366e601a146793c47e9c1156a4bb36d6fcb3 BUG: 1092850 Signed-off-by: Xavier Hernandez Reviewed-on: http://review.gluster.org/8286 Tested-by: Gluster Build System Reviewed-by: Vijay Bellur --- tests/bugs/bug-887098-gmount-crash.t | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/tests/bugs/bug-887098-gmount-crash.t b/tests/bugs/bug-887098-gmount-crash.t index cfe1c97fb0f..5a6a9fdb931 100644 --- a/tests/bugs/bug-887098-gmount-crash.t +++ b/tests/bugs/bug-887098-gmount-crash.t @@ -16,18 +16,12 @@ TEST $CLI volume create $V0 replica 2 $H0:$B0/${V0}{1,2,3,4}; EXPECT "$V0" volinfo_field $V0 'Volume Name'; EXPECT 'Created' volinfo_field $V0 'Status'; -function pidgrep() -{ - ps ax | grep "$1" | grep -v grep | awk '{print $1}' | head -1 -} - - ## Start volume and verify TEST $CLI volume start $V0; EXPECT 'Started' volinfo_field $V0 'Status'; TEST glusterfs -s $H0 --volfile-id=$V0 --acl $M0 -MOUNT_PID=`ps ax |grep "glusterfs -s $H0 --volfile-id=$V0 --acl $M0" | grep -v grep | awk '{print $1}' | head -1` +MOUNT_PID=$(get_mount_process_pid $V0) for i in {1..25}; do @@ -35,7 +29,7 @@ do cp -RPp $M0/tmp_$i $M0/newtmp_$i && cat /etc/hosts > $M0/newtmp_$i/newfile done -EXPECT "$MOUNT_PID" pidgrep $MOUNT_PID +EXPECT "$MOUNT_PID" get_mount_process_pid $V0 TEST rm -rf $M0/* EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" force_umount $M0 -- cgit