xfs/{263,106}: erase max warnings printout
[xfstests-dev.git] / tests / generic / 075
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2000-2003 Silicon Graphics, Inc.  All Rights Reserved.
4 #
5 # FS QA Test No. 075
6 #
7 # fsx (non-AIO variant)
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=0        # success is the default!
16 trap "_cleanup; exit \$status" 0 1 2 3 15
17
18 _cleanup()
19 {
20     cd /
21     rm -rf $TEST_DIR/fsx.* $tmp.*
22 }
23
24 # get standard environment, filters and checks
25 . ./common/rc
26 . ./common/filter
27
28 _do_test()
29 {
30     _n="$1"
31     _param="$2"
32
33     out=$TEST_DIR/fsx
34     rm -rf $out
35     if ! mkdir $out
36     then
37         echo "    failed to mkdir $out"
38         status=1
39         exit
40     fi
41
42     _filter_param=`echo "$_param" | sed\
43         -e 's/-N [0-9][0-9]*/-N numops/' \
44         -e 's/-l [0-9][0-9]*/-l filelen/'`
45
46     echo ""
47     echo "-----------------------------------------------"
48     echo "fsx.$_n : $_filter_param"
49     echo "-----------------------------------------------"
50
51     # Skip the prealloc runs if the file system does not support preallocation
52     if [ "$_n" = "1" -o "$_n" = "3" ]; then
53         if [ -n "$testio" ]; then
54             return
55         fi
56     fi
57
58     # This cd and use of -P gets full debug on "$RESULT_DIR" (not TEST_DEV)
59     cd $out
60     if ! $here/ltp/fsx $_param -P "$RESULT_DIR" $seq.$_n $FSX_AVOID &>/dev/null
61     then
62         echo "    fsx ($_param) failed, $? - compare $seqres.$_n.{good,bad,fsxlog}"
63         mv $out/$seq.$_n $seqres.$_n.full
64         mv "$RESULT_DIR"/$seq.$_n.fsxlog $seqres.$_n.fsxlog
65         od -xAx $seqres.$_n.full > $seqres.$_n.bad
66         od -xAx "$RESULT_DIR"/$seq.$_n.fsxgood > $seqres.$_n.good
67         rm -f "$RESULT_DIR"/$seq.$_n.fsxgood
68         status=1
69         exit
70     fi
71
72     cd $here
73     _check_test_fs
74 }
75
76 _usage()
77 {
78     echo "$0: [-l filelen] [-n numops1] [-N numops2]"
79 }
80
81 _process_args()
82 {
83     OPTIND=1
84     while getopts "l:n:N:?" c $@
85     do
86         case $c
87         in
88             l)
89                 filelen=$OPTARG
90                 param_type="$param_type, overidde -l"
91                 ;;
92             N)
93                 numops2=$OPTARG
94                 param_type="$param_type, overidde -N"
95                 ;;
96             n)
97                 numops1=$OPTARG
98                 param_type="$param_type, overidde -n"
99                 ;;
100             ?)
101                 _usage
102                 exit    
103                 ;;
104         esac
105     done
106 }
107
108 # real QA test starts here
109 _supported_fs generic
110 _supported_os Linux
111 _require_test
112
113 size10=`expr 10 \* 1024 \* 1024`        # 10 megabytes
114 filelen=$size10
115 numops1=1000
116 numops2=10000
117
118 # can override the params here
119 _process_args "$@"
120
121 echo "Params are for $param_type" >>$seqres.full
122 echo "Params: n = $numops1 N = $numops2 l = $filelen" >>$seqres.full
123
124 rm -f $seqres.full
125 echo "brevity is wit..."
126
127 _check_test_fs
128
129 # check if preallocation is supported, xfs_io resvsp command only prints out
130 # messages on failure.
131 testfile=$TEST_DIR/$$.xfs_io
132 testio=`$XFS_IO_PROG -f -c "resvsp 0 1" $testfile 2>&1`
133 rm -f $testfile 2>&1 > /dev/null
134
135 # Options:
136 # -d: debug output for all operations
137 # -l flen: the upper bound on file size (default 262144)
138 # -o oplen: the upper bound on operation size
139 # -N numops: total # operations to do (default infinity)
140 # -P: save .fsxlog and .fsxgood files in dirpath (default ./)
141 # -S seed: for random # generator (default 1) 0 gets timestamp
142 # -x: pre-allocate file space, exercising unwritten extents
143
144 _do_test 0 "-d -N $numops1 -S 0"
145 _do_test 1 "-d -N $numops1 -S 0 -x"
146 _do_test 2 "-d -N $numops2 -l $filelen -S 0"
147 _do_test 3 "-d -N $numops2 -l $filelen -S 0 -x"
148
149 rm -f $seq.*.fsx{good,log}
150 exit 0