From cac812c2c28bd55a5f7fe1f608d606d9d63869fd Mon Sep 17 00:00:00 2001 From: brian Date: Fri, 25 Sep 2009 15:42:08 +0000 Subject: [PATCH] b=20877 i=tianzy i=grev A better test that does not make assumptions about performance (i.e. that a given I/O operation will complete in a given amount of time). Per Tian's suggestion, probably this could be functionalized to deal with other situations of the same nature. --- lustre/tests/sanity-quota.sh | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/lustre/tests/sanity-quota.sh b/lustre/tests/sanity-quota.sh index 293b07d..9f627b9 100644 --- a/lustre/tests/sanity-quota.sh +++ b/lustre/tests/sanity-quota.sh @@ -1122,17 +1122,24 @@ test_12() { DDPID=$! echo " step2: testing ......" - count=0 - while [ true ]; do - if ! ps -p ${DDPID1} > /dev/null 2>&1; then break; fi - count=$[count+1] - if [ $count -gt 64 ]; then - lustre_fail ost 0 - quota_error u $TSTUSR2 "dd should be finished!" - fi - sleep 1 - done - echo "(dd_pid=$DDPID1, time=$count)successful" + local last_size=$(stat -c %s $TESTFILE2) + local stall_secs=0 + local start_secs=$SECONDS + while [ -d /proc/${DDPID1} ]; do + local size=$(stat -c %s $TESTFILE2) + if [ $size -eq $last_size ]; then + stall_secs=$[stall_secs+1] + else + stall_secs=0 + fi + if [ $stall_secs -gt 30 ]; then + lustre_fail ost 0 + quota_error u $TSTUSR2 "giving up: dd stalled (i.e. made no progress) for 30 seconds!" + fi + last_size=$size + sleep 1 + done + echo "(dd_pid=$DDPID1, time=$((SECONDS-start_secs)))successful" #Recover fail_loc and dd will finish soon lustre_fail ost 0 -- 1.8.3.1