xfs/{263,106}: erase max warnings printout
[xfstests-dev.git] / tests / generic / 451
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2017 Red Hat Inc.  All Rights Reserved.
4 #
5 # FS QA Test No. 451
6 #
7 # Test data integrity when mixing buffered reads and asynchronous
8 # direct writes a file.
9 #
10 seq=`basename $0`
11 seqres=$RESULT_DIR/$seq
12 echo "QA output created by $seq"
13
14 here=`pwd`
15 tmp=/tmp/$$
16 status=1        # failure is the default!
17 trap "_cleanup; exit \$status" 0 1 2 3 15
18
19 _cleanup()
20 {
21         cd /
22         rm -f $tmp.*
23 }
24
25 # get standard environment, filters and checks
26 . ./common/rc
27
28 # remove previous $seqres.full before test
29 rm -f $seqres.full
30
31 # real QA test starts here
32 _supported_fs generic
33 _supported_os Linux
34 _require_test
35 _require_test_program "feature"
36 _require_aiodio aio-dio-cycle-write
37 _require_command "$TIMEOUT_PROG" timeout
38
39 TESTFILE=$TEST_DIR/tst-aio-dio-cycle-write.$seq
40 FSIZE=655360    # bytes
41
42 # More read processes can help to reproduce the bug easier, so run
43 # 2 ~ 20 readers according to the number of CPUs
44 nr_cpu=`$here/src/feature -o`
45 loops=$((nr_cpu / 2))
46 if [ $loops -lt 2 ]; then
47         loops=2
48 elif [ $loops -gt 20 ]; then
49         loops=20
50 fi
51
52 keep_reading=$tmp.reading
53 touch $keep_reading
54 # buffered reads the file frequently
55 for ((i=0; i<loops; i++)); do
56         while [ -e $keep_reading ]; do
57                 $XFS_IO_PROG -f -c "pread 0 $FSIZE" $TESTFILE >/dev/null 2>&1
58         done &
59         reader_pid="$reader_pid $!"
60 done
61
62 # start an aio writer, which does writing loops internally and check
63 # data integrality.
64 # For reproduce the original bug, keep testing about 30s will be better,
65 # So let the AIO_TEST run as many loops as it can, then kill it in 30s.
66 $TIMEOUT_PROG -s TERM 30s $AIO_TEST -c 999999 -b $FSIZE $TESTFILE >/dev/null
67
68 # Remove $keep_reading file to stop the reader cycle
69 rm -f $keep_reading
70 wait $reader_pid
71
72 echo "Silence is golden"
73
74 status=0
75 exit