common/rc: Add _require_{chown,chmod}()
[xfstests-dev.git] / tests / generic / 095
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2015 Red Hat Inc. All Rights Reserved.
4 #
5 # FS QA Test generic/095
6 #
7 # Concurrent mixed I/O (buffer I/O, aiodio, mmap, splice) on the same files
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 15
17
18 _cleanup()
19 {
20         cd /
21         rm -f $tmp.*
22 }
23
24 # get standard environment, filters and checks
25 . ./common/rc
26 . ./common/filter
27
28 # real QA test starts here
29 _supported_fs generic
30 _require_scratch
31 _require_odirect
32 _require_aio
33
34 iodepth=$((16 * LOAD_FACTOR))
35 iodepth_batch=$((8 * LOAD_FACTOR))
36 numjobs=$((5 * LOAD_FACTOR))
37 fio_config=$tmp.fio
38 fio_out=$tmp.fio.out
39 cat >$fio_config <<EOF
40 [global]
41 bs=8k
42 iodepth=$iodepth
43 iodepth_batch=$iodepth_batch
44 randrepeat=1
45 size=1m
46 directory=$SCRATCH_MNT
47 numjobs=$numjobs
48 [job1]
49 ioengine=sync
50 bs=1k
51 direct=1
52 rw=randread
53 filename=file1:file2
54 [job2]
55 ioengine=libaio
56 rw=randwrite
57 direct=1
58 filename=file1:file2
59 [job3]
60 bs=1k
61 ioengine=posixaio
62 rw=randwrite
63 direct=1
64 filename=file1:file2
65 [job4]
66 ioengine=splice
67 direct=1
68 rw=randwrite
69 filename=file1:file2
70 [job5]
71 bs=1k
72 ioengine=sync
73 rw=randread
74 filename=file1:file2
75 [job6]
76 ioengine=posixaio
77 rw=randwrite
78 filename=file1:file2
79 [job7]
80 ioengine=splice
81 rw=randwrite
82 filename=file1:file2
83 [job8]
84 ioengine=mmap
85 rw=randwrite
86 bs=1k
87 filename=file1:file2
88 [job9]
89 ioengine=mmap
90 rw=randwrite
91 direct=1
92 filename=file1:file2
93 EOF
94 # with ioengine=mmap and direct=1, fio requires bs to be at least pagesize,
95 # which is a fio built-in var.
96 echo 'bs=$pagesize' >> $fio_config
97
98 rm -f $seqres.full
99 _require_fio $fio_config
100 _scratch_mkfs >>$seqres.full 2>&1
101 _scratch_mount
102
103 # There's a known EIO failure to report collisions between directio and buffered
104 # writes to userspace, refer to upstream linux 5a9d929d6e13. So ignore EIO error
105 # at here.
106 $FIO_PROG $fio_config --ignore_error=,EIO --output=$fio_out
107 cat $fio_out >> $seqres.full
108 echo "Silence is golden"
109
110 # xfs generates WARNINGs on purpose when applications mix buffered/mmap IO with
111 # direct IO on the same file. On the other hand, this fio job has been proven
112 # to be potent, we don't want to simply _disable_dmesg_check which could miss
113 # other potential bugs. So filter out the intentional WARNINGs, make sure test
114 # doesn't fail because of this warning and fails on other WARNINGs.
115
116 # umount before checking dmesg in case umount triggers any WARNING or Oops
117 _scratch_unmount
118
119 _check_dmesg _filter_aiodio_dmesg
120
121 status=$?
122 exit