Fix unexpected 32 bit sign extension for linux time. It was fine for Irix.
[xfstests-dev.git] / 112
1 #! /bin/sh
2 # FS QA Test No. 112
3 #
4 # fsx (AIO variant, based on 075)
5 #
6 #-----------------------------------------------------------------------
7 # Copyright (c) 2005 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     # This cd and use of -P gets full debug on $here (not TEST_DEV)
56     cd $out
57     if ! $here/ltp/fsx $_param -P $here $seq.$_n >/dev/null
58     then
59         echo "    fsx ($_param) returned $? - see $seq.$_n.full"
60         mv $seq.$_n.fsxlog $here/$seq.$_n.full
61         status=1
62         exit
63     fi
64
65     cd $here
66     _check_test_fs
67 }
68
69 _usage()
70 {
71     echo "$0: [-l filelen] [-n numops1] [-N numops2]"
72 }
73
74 _process_args()
75 {
76     while getopts "l:n:N:?" c $@
77     do
78         case $c
79         in
80             l)
81                 filelen=$OPTARG
82                 param_type="$param_type, overidde -l"
83                 ;;
84             N)
85                 numops2=$OPTARG
86                 param_type="$param_type, overidde -N"
87                 ;;
88             n)
89                 numops1=$OPTARG
90                 param_type="$param_type, overidde -n"
91                 ;;
92             ?)
93                 _usage
94                 exit    
95                 ;;
96         esac
97     done
98 }
99
100
101 # real QA test starts here
102 _supported_fs xfs
103 _supported_os Linux
104
105 [ -x $here/ltp/aio-stress ] || \
106         _notrun "fsx not built with AIO for this platform"
107
108 size10=`expr 10 \* 1024 \* 1024`        # 10 megabytes
109 filelen=$size10
110 numops1=1000
111 numops2=10000
112
113 # can override the params here
114 _process_args "$@"
115
116 echo "Params are for $param_type" >>$seq.full
117 echo "Params: n = $numops1 N = $numops2 l = $filelen" >>$seq.full
118
119 _setup_testdir
120
121 rm -f $here/$seq.full
122 echo "brevity is wit..."
123
124 _check_test_fs
125
126 # Options:
127 # -d: debug output for all operations
128 # -l flen: the upper bound on file size (default 262144)
129 # -o oplen: the upper bound on operation size
130 # -N numops: total # operations to do (default infinity)
131 # -P: save .fsxlog and .fsxgood files in dirpath (default ./)
132 # -S seed: for random # generator (default 1) 0 gets timestamp
133 # -x: pre-allocate file space, exercising unwritten extents
134 # -A: use the AIO system calls
135
136 _do_test 0 "-A -d -N $numops1 -S 0"
137 _do_test 1 "-A -d -N $numops1 -S 0 -x"
138 _do_test 2 "-A -d -N $numops2 -l $filelen -S 0"
139 _do_test 3 "-A -d -N $numops2 -l $filelen -S 0 -x"
140
141 rm -f $seq.*.fsx{good,log}
142 exit 0