xfs: force file creation to the data device for certain layout tests
[xfstests-dev.git] / tests / xfs / 285
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2017 Oracle, Inc.  All Rights Reserved.
4 #
5 # FS QA Test No. 285
6 #
7 # Race fio and xfs_scrub for a while to see if we crash or livelock.
8 #
9 seq=`basename $0`
10 seqres=$RESULT_DIR/$seq
11 echo "QA output created by $seq"
12
13 here=`pwd`
14 tmp=/tmp/$$
15 status=1        # failure is the default!
16 trap "_cleanup; exit \$status" 0 1 2 3 7 15
17
18 _cleanup()
19 {
20         cd /
21         rm -rf $tmp.*
22 }
23
24 # get standard environment, filters and checks
25 . ./common/rc
26 . ./common/filter
27 . ./common/fuzzy
28 . ./common/inject
29
30 # real QA test starts here
31 _supported_fs xfs
32 _require_test_program "feature"
33 _require_command "$KILLALL_PROG" killall
34 _require_command "$TIMEOUT_PROG" timeout
35 _require_scrub
36 _require_scratch
37
38 echo "Format and populate"
39 _scratch_mkfs > "$seqres.full" 2>&1
40 _scratch_mount
41
42 STRESS_DIR="$SCRATCH_MNT/testdir"
43 mkdir -p $STRESS_DIR
44
45 cpus=$(( $($here/src/feature -o) * 4 * LOAD_FACTOR))
46 $FSSTRESS_PROG -d $STRESS_DIR -p $cpus -n $((cpus * 100000)) $FSSTRESS_AVOID >/dev/null 2>&1 &
47 $XFS_SCRUB_PROG -d -T -v -n $SCRATCH_MNT >> $seqres.full
48
49 killstress() {
50         sleep $(( 60 * TIME_FACTOR ))
51         $KILLALL_PROG -q $FSSTRESS_PROG
52 }
53
54 echo "Concurrent scrub"
55 start=$(date +%s)
56 end=$((start + (60 * TIME_FACTOR) ))
57 killstress &
58 echo "Scrub started at $(date --date="@${start}"), ending at $(date --date="@${end}")" >> $seqres.full
59 while [ "$(date +%s)" -lt "$end" ]; do
60         $TIMEOUT_PROG -s TERM $(( end - $(date +%s) + 2 )) $XFS_SCRUB_PROG -d -T -v -n $SCRATCH_MNT >> $seqres.full 2>&1
61 done
62
63 echo "Test done"
64 echo "Scrub finished at $(date)" >> $seqres.full
65 $KILLALL_PROG -q $FSSTRESS_PROG
66
67 # success, all done
68 status=0
69 exit