QA script update
[xfstests-dev.git] / 075
1 #! /bin/sh
2 # FS QA Test No. 075
3 #
4 # fsx (non-AIO variant)
5 #
6 #-----------------------------------------------------------------------
7 # Copyright (c) 2000-2003 Silicon Graphics, Inc.  All Rights Reserved.
8 #-----------------------------------------------------------------------
9 #
10 # creator
11 owner=nathans@sgi.com
12
13 seq=`basename $0`
14 echo "QA output created by $seq"
15
16 here=`pwd`
17 tmp=/tmp/$$
18 status=0        # success is the default!
19 trap "_cleanup; exit \$status" 0 1 2 3 15
20
21 _cleanup()
22 {
23     cd /
24     rm -rf $testdir/fsx.* $tmp.*
25     _cleanup_testdir
26 }
27
28 # get standard environment, filters and checks
29 . ./common.rc
30 . ./common.filter
31
32 _do_test()
33 {
34     _n="$1"
35     _param="$2"
36
37     out=$testdir/fsx
38     rm -rf $out
39     if ! mkdir $out
40     then
41         echo "    failed to mkdir $out"
42         status=1
43         exit
44     fi
45
46     _filter_param=`echo "$_param" | sed\
47         -e 's/-N [0-9][0-9]*/-N numops/' \
48         -e 's/-l [0-9][0-9]*/-l filelen/'`
49
50     echo ""
51     echo "-----------------------------------------------"
52     echo "fsx.$_n : $_filter_param"
53     echo "-----------------------------------------------"
54
55     if [ "$FSTYP" = "nfs" ]
56     then
57         if [ "$_n" = "1" -o "$_n" = "3" ]
58         then
59             # HACK: nfs don't handle preallocation (-x) so just skip this test
60             return
61         fi
62     fi
63
64     # This cd and use of -P gets full debug on $here (not TEST_DEV)
65     cd $out
66     if ! $here/ltp/fsx $_param -P $here $seq.$_n >/dev/null
67     then
68         echo "    fsx ($_param) returned $? - see $seq.$_n.full"
69         mv $seq.$_n.fsxlog $here/$seq.$_n.full
70         status=1
71         exit
72     fi
73
74     cd $here
75     _check_test_fs
76 }
77
78 _usage()
79 {
80     echo "$0: [-l filelen] [-n numops1] [-N numops2]"
81 }
82
83 _process_args()
84 {
85     while getopts "l:n:N:?" c $@
86     do
87         case $c
88         in
89             l)
90                 filelen=$OPTARG
91                 param_type="$param_type, overidde -l"
92                 ;;
93             N)
94                 numops2=$OPTARG
95                 param_type="$param_type, overidde -N"
96                 ;;
97             n)
98                 numops1=$OPTARG
99                 param_type="$param_type, overidde -n"
100                 ;;
101             ?)
102                 _usage
103                 exit    
104                 ;;
105         esac
106     done
107 }
108
109
110 # real QA test starts here
111 _supported_fs xfs udf nfs
112 _supported_os IRIX Linux
113
114 size10=`expr 10 \* 1024 \* 1024`        # 10 megabytes
115 filelen=$size10
116 numops1=1000
117 numops2=10000
118
119 # can override the params here
120 _process_args "$@"
121
122 echo "Params are for $param_type" >>$seq.full
123 echo "Params: n = $numops1 N = $numops2 l = $filelen" >>$seq.full
124
125 _setup_testdir
126
127 rm -f $here/$seq.full
128 echo "brevity is wit..."
129
130 _check_test_fs
131
132 # Options:
133 # -d: debug output for all operations
134 # -l flen: the upper bound on file size (default 262144)
135 # -o oplen: the upper bound on operation size
136 # -N numops: total # operations to do (default infinity)
137 # -P: save .fsxlog and .fsxgood files in dirpath (default ./)
138 # -S seed: for random # generator (default 1) 0 gets timestamp
139 # -x: pre-allocate file space, exercising unwritten extents
140
141 _do_test 0 "-d -N $numops1 -S 0"
142 _do_test 1 "-d -N $numops1 -S 0 -x"
143 _do_test 2 "-d -N $numops2 -l $filelen -S 0"
144 _do_test 3 "-d -N $numops2 -l $filelen -S 0 -x"
145
146 rm -f $seq.*.fsx{good,log}
147 exit 0