From 14a26b29306c2ff534ebdec91d9f821a86f72c78 Mon Sep 17 00:00:00 2001 From: brian Date: Wed, 30 Sep 2009 13:57:51 +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 | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/lustre/tests/sanity-quota.sh b/lustre/tests/sanity-quota.sh index 5b8cf28..63ceda2 100644 --- a/lustre/tests/sanity-quota.sh +++ b/lustre/tests/sanity-quota.sh @@ -1065,17 +1065,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 + 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 "dd should be finished!" + 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=$count)successful" + 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