fstests: use _require_symlinks on all necessary tests
[xfstests-dev.git] / tests / generic / 072
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2015 Fujitsu.  All Rights Reserved.
4 #
5 # FS QA Test No. 072
6 #
7 # Test truncate/collapse range race.
8 # And this test is also a regression test for kernel commit 23fffa9,
9 #    fs: move falloc collapse range check into the filesystem methods
10 # If the race occurs, it will trigger a BUG_ON().
11 #
12 seq=`basename $0`
13 seqres=$RESULT_DIR/$seq
14 echo "QA output created by $seq"
15
16 here=`pwd`
17 tmp=/tmp/$$
18 status=1        # failure is the default!
19
20 _cleanup()
21 {
22         rm -f $tmp.*
23 }
24
25 trap "_cleanup; exit \$status" 0 1 2 3 15
26
27 # get standard environment, filters and checks
28 . ./common/rc
29 . ./common/filter
30
31 # real QA test starts here
32 _supported_os Linux
33 _supported_fs generic
34 _require_test
35 _require_xfs_io_command "fcollapse"
36
37 testfile=$TEST_DIR/testfile.$seq
38 NCPUS=`$here/src/feature -o`
39 # cap NCPUS to 8 at maximum to avoid long run time on hosts with many cpus
40 if [ $NCPUS -gt 8 ]; then
41         NCPUS=8
42 fi
43 OUTER_LOOPS=$((10 * $NCPUS * $LOAD_FACTOR))
44 INNER_LOOPS=$((50 * $NCPUS * $LOAD_FACTOR))
45 # fcollapse/truncate continuously and simultaneously a same file
46 for ((i=1; i <= OUTER_LOOPS; i++)); do
47         for ((i=1; i <= INNER_LOOPS; i++)); do
48                 $XFS_IO_PROG -f -c 'truncate 100k' \
49                         -c 'fcollapse 0 16k' $testfile > /dev/null 2>&1
50         done &
51         for ((i=1; i <= INNER_LOOPS; i++)); do
52                 $XFS_IO_PROG -f -c 'truncate 0' $testfile > /dev/null 2>&1
53         done &
54 done
55 wait
56
57 echo "Silence is golden"
58 status=0
59 exit