Fix three problems in generic/299

1. Use $XFS_IO_PROG instead of fallocate/truncate, old distros like
RHEL5 don't have these commands.

2. Remove $seqres.full before test, otherwise the file is growing all
the time.

3. Make sure fio really exits, otherwise fio would block umount. $pid is
the pid of function run_check not fio, sometimes fio is still there when
$pid is dead and blocking umount.

Signed-off-by: Eryu Guan <[email protected]>
---
 tests/generic/299 | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/tests/generic/299 b/tests/generic/299
index e8685a4..ae1bf74 100755
--- a/tests/generic/299
+++ b/tests/generic/299
@@ -125,20 +125,23 @@ _workout()
        do
            for ((k=1; k <= NUM_JOBS; k++))
            do
-               fallocate -l $FILE_SIZE $SCRATCH_MNT/direct_aio.$k.0 \
+               $XFS_IO_PROG -f -c "falloc 0 $FILE_SIZE" 
$SCRATCH_MNT/direct_aio.$k.0 \
                        >> $seqres.full 2>&1
            done
            for ((k=1; k <= NUM_JOBS; k++))
            do
-               truncate -s 0 $SCRATCH_MNT/direct_aio.$k.0 >> $seqres.full 2>&1
+               $XFS_IO_PROG -f -c "truncate 0" $SCRATCH_MNT/direct_aio.$k.0 \
+                       >>$seqres.full 2>&1
            done
            # Following like will check that pid is still run.
            # Once fio exit we can stop fallocate/truncate loop
-           kill -0 $pid > /dev/null 2>&1 || break
+           pgrep fio >/dev/null 2>&1 || break
        done
        wait $pid
 }
 
+rm -f $seqres.full
+
 _scratch_mkfs >> $seqres.full 2>&1
 _scratch_mount
 
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe fstests" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to