From: Zorro Lang Date: Mon, 13 May 2019 01:49:04 +0000 (+0800) Subject: generic: aio random write and verify stress test X-Git-Tag: v2022.05.01~1147 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=d6f88082b4df0c3ae3bb4a18fee16f1451e868d9;p=users%2Fhch%2Fxfstests-dev.git generic: aio random write and verify stress test We found some AIO write related bugs recently, so I think a AIO random write test is needed. By the new aio-aio-write-verify.c tool, we can do this easily. Signed-off-by: Zorro Lang Reviewed-by: Eryu Guan Signed-off-by: Eryu Guan --- diff --git a/tests/generic/551 b/tests/generic/551 new file mode 100755 index 000000000..a2a5b51d6 --- /dev/null +++ b/tests/generic/551 @@ -0,0 +1,87 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2019 Red Hat, Inc. All Rights Reserved. +# +# FS QA Test No. 551 +# +# Randomly direct AIO write&verify stress test +# +seq=`basename $0` +seqres=$RESULT_DIR/$seq +echo "QA output created by $seq" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + cd / + rm -f $tmp.* +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter + +# remove previous $seqres.full before test +rm -f $seqres.full + +# real QA test starts here +_supported_fs generic +_supported_os Linux +_require_scratch +_require_aiodio aio-dio-write-verify + +_scratch_mkfs > $seqres.full 2>&1 +_scratch_mount + +localfile=$SCRATCH_MNT/testfile +diosize=`_min_dio_alignment $SCRATCH_DEV` + +# The maximum write size and offset are both 32k diosize. So the maximum +# file size will be (32 * 2)k +free_size_k=`df -kP $SCRATCH_MNT | grep -v Filesystem | awk '{print $4}'` +max_io_size_b=$((32 * 1024)) +if [ $max_io_size_b -gt $((free_size_k * 1024 / 2 / diosize)) ]; then + max_io_size_b=$((free_size_k * 1024 / 2 / diosize)) +fi + +do_test() +{ + local num_oper + local oper_list="" + local size + local off + local truncsize + + # the number of AIO write operation + num_oper=$((RANDOM % 64 + 1)) + + for ((i=0; i $localfile + do_test + ((testimes--)) +done + +echo "Silence is golden" + +# success, all done +status=0 +exit diff --git a/tests/generic/551.out b/tests/generic/551.out new file mode 100644 index 000000000..c5c77e612 --- /dev/null +++ b/tests/generic/551.out @@ -0,0 +1,2 @@ +QA output created by 551 +Silence is golden diff --git a/tests/generic/group b/tests/generic/group index 8de703486..35f981243 100644 --- a/tests/generic/group +++ b/tests/generic/group @@ -553,3 +553,4 @@ 548 auto quick encrypt 549 auto quick encrypt 550 auto quick encrypt +551 auto stress aio