3 # Test basic functionality of the filesystem using simple
11 LUSTRE=${LUSTRE:-$(cd $(dirname $0)/..; echo $PWD)}
12 . $LUSTRE/tests/test-framework.sh
14 . ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
17 MAX_THREADS=${MAX_THREADS:-20}
18 RAMKB=`awk '/MemTotal:/ { print $2 }' /proc/meminfo`
19 if [ -z "$THREADS" ]; then
20 THREADS=$((RAMKB / 16384))
21 [ $THREADS -gt $MAX_THREADS ] && THREADS=$MAX_THREADS
23 SIZE=${SIZE:-$((RAMKB * 2))}
26 DEBUG_LVL=${DEBUG_LVL:-0}
27 DEBUG_OFF=${DEBUG_OFF:-"eval lctl set_param debug=\"$DEBUG_LVL\""}
28 DEBUG_ON=${DEBUG_ON:-"eval lctl set_param debug=0x33f0484"}
30 PIOSBIN=${PIOSBIN:-$(which pios 2> /dev/null || true)}
32 pios_THREADCOUNT=${pios_THREADCOUNT:-"1,8,40"}
33 [ "$SLOW" = "no" ] && pios_THREADCOUNT=8
35 pios_REGIONCOUNT=${pios_REGIONCOUNT:-1024}
36 pios_CHUNKSIZE=${pios_CHUNKSIZE:-1M}
37 pios_REGIONSIZE=${pios_REGIONSIZE:-8M}
38 pios_OFFSET=${pios_OFFSET:-16M}
40 [ "$SLOW" = "no" ] && EXCEPT_SLOW="iozone"
43 check_and_setup_lustre
46 rm -rf $DIR/[df][0-9]*
49 if ! which dbench > /dev/null 2>&1 ; then
50 skip_env "No dbench installed"
54 local DBENCHDIR=$DIR/d0.$HOSTNAME
56 local SPACE=`df -P $MOUNT | tail -n 1 | awk '{ print $4 }'`
57 DB_THREADS=$((SPACE / 50000))
58 [ $THREADS -lt $DB_THREADS ] && DB_THREADS=$THREADS
64 FAIL_ON_ERROR=false check_runas_id_ret $myUID $myGID $myRUNAS || \
65 { myRUNAS="" && myUID=$UID && myGID=`id -g $USER`; }
66 chown $myUID:$myGID $DBENCHDIR
68 [ "$SLOW" = "no" ] && duration=" -t 120"
69 if [ "$SLOW" != "no" -o $DB_THREADS -eq 1 ]; then
70 $myRUNAS bash rundbench -D $DBENCHDIR 1 $duration || error "dbench failed!"
73 if [ $DB_THREADS -gt 1 ]; then
75 $myRUNAS bash rundbench -D $DBENCHDIR $DB_THREADS $duration
80 run_test dbench "dbench"
83 if ! which bonnie++ > /dev/null 2>&1; then
84 skip_env "No bonnie++ installed"
87 local BONDIR=$DIR/d0.bonnie
89 $LFS setstripe -c -1 $BONDIR
91 local MIN=`lctl get_param -n osc.*.kbytesavail | sort -n | head -n1`
92 local SPACE=$(( OSTCOUNT * MIN ))
93 [ $SPACE -lt $SIZE ] && SIZE=$((SPACE * 3 / 4))
94 log "min OST has ${MIN}kB available, using ${SIZE}kB file size"
99 FAIL_ON_ERROR=false check_runas_id_ret $myUID $myGID $myRUNAS || \
100 { myRUNAS="" && myUID=$UID && myGID=`id -$USER`; }
101 chown $myUID:$myGID $BONDIR
102 $myRUNAS bonnie++ -f -r 0 -s$((SIZE / 1024)) -n 10 -u$myUID:$myGID -d$BONDIR
105 run_test bonnie "bonnie++"
108 if ! which iozone > /dev/null 2>&1; then
109 skip_env "No iozone installed"
115 local IOZDIR=$DIR/d0.iozone
117 $LFS setstripe -c -1 $IOZDIR
119 local MIN=`lctl get_param -n osc.*.kbytesavail | sort -n | head -n1`
120 local SPACE=$(( OSTCOUNT * MIN ))
121 [ $SPACE -lt $SIZE ] && SIZE=$((SPACE * 3 / 4))
122 log "min OST has ${MIN}kB available, using ${SIZE}kB file size"
123 IOZONE_OPTS="-i 0 -i 1 -i 2 -e -+d -r $RSIZE"
124 IOZFILE="$IOZDIR/iozone"
125 IOZLOG=$TMP/iozone.log
126 # $SPACE was calculated with all OSTs
131 FAIL_ON_ERROR=false check_runas_id_ret $myUID $myGID $myRUNAS || \
132 { myRUNAS="" && myUID=$UID && myGID=`id -g $USER`; }
133 chown $myUID:$myGID $IOZDIR
134 $myRUNAS iozone $IOZONE_OPTS -s $SIZE -f $IOZFILE 2>&1 | tee $IOZLOG
135 tail -1 $IOZLOG | grep -q complete || \
136 { error "iozone (1) failed" && return 1; }
140 # check if O_DIRECT support is implemented in kernel
141 if [ -z "$O_DIRECT" ]; then
143 if ! ./directio write $DIR/f.iozone 0 1; then
144 log "SKIP iozone DIRECT IO test"
149 if [ "$O_DIRECT" != "no" -a "$IOZONE_DIR" != "no" ]; then
151 $myRUNAS iozone -I $IOZONE_OPTS -s $SIZE -f $IOZFILE.odir 2>&1 | tee $IOZLOG
152 tail -1 $IOZLOG | grep -q complete || \
153 { error "iozone (2) failed" && return 1; }
158 SPACE=`df -P $MOUNT | tail -n 1 | awk '{ print $4 }'`
159 IOZ_THREADS=$((SPACE / SIZE * 2 / 3 ))
160 [ $THREADS -lt $IOZ_THREADS ] && IOZ_THREADS=$THREADS
161 IOZVER=`iozone -v | awk '/Revision:/ {print $3}' | tr -d .`
162 if [ "$IOZ_THREADS" -gt 1 -a "$IOZVER" -ge 3145 ]; then
163 $LFS setstripe -c -1 $IOZDIR
167 while [ $THREAD -le $IOZ_THREADS ]; do
168 IOZFILE="$IOZFILE $IOZDIR/iozone.$THREAD"
169 THREAD=$((THREAD + 1))
171 $myRUNAS iozone $IOZONE_OPTS -s $((SIZE / IOZ_THREADS)) -t $IOZ_THREADS -F $IOZFILE 2>&1 | tee $IOZLOG
172 tail -1 $IOZLOG | grep -q complete || \
173 { error "iozone (3) failed" && return 1; }
176 elif [ $IOZVER -lt 3145 ]; then
177 VER=`iozone -v | awk '/Revision:/ { print $3 }'`
178 echo "iozone $VER too old for multi-thread test"
181 run_test iozone "iozone"
184 local testfile=$DIR/f0.fsxfile
187 local SPACE=`df -P $MOUNT | tail -n 1 | awk '{ print $4 }'`
188 [ $SPACE -lt $FSX_SIZE ] && FSX_SIZE=$((SPACE * 3 / 4))
190 FSX_SEED=${FSX_SEED:-$RANDOM}
192 $LFS setstripe -c -1 $testfile
193 echo Using FSX_SEED=$FSX_SEED FSX_SIZE=$FSX_SIZE FSX_COUNT=$FSX_COUNT
194 fsx -c 50 -p 1000 -S $FSX_SEED -P $TMP -l $FSX_SIZE \
195 -N $(($FSX_COUNT * 100)) $DIR/fsxfile
201 ############################################################
207 local num=${str:0:${#str}-1}
208 case ${str:${#str}-1} in
209 k|K ) num=$((num << 10));; #
210 m|M ) num=$((num << 20));; # emacs is confsued by the << and
211 g|G ) num=$((num << 30));; # these comments help it out.
212 t|T ) num=$((num << 40));; #
220 # /* Adding 10% to total test size for filesystem overhead */
221 # size = size + (double)(size) * (double) (0.1);
223 # total_test_size = runarg->stream[n - 1].max_offset +
224 # runarg->regionsize;
226 local space=$(df -P $DIR | tail -n 1 | awk '{ print $4 }')
227 local size=$(($(iterpr_KMGT $pios_REGIONCOUNT) * \
228 $(iterpr_KMGT $pios_OFFSET) + \
229 $(iterpr_KMGT $pios_REGIONSIZE) ))
230 size=$(( size + size / 10 ))
231 if [ $((space * 1024)) -le $size ]; then
232 echo "Need free space atleast $size, have $((space * 1024))"
238 local testdir=$DIR/$tdir
242 [ "$1" == "--stripe" ] && stripes=-1
243 $LFS setstripe $testdir -c $stripes
244 echo "Test directory stripe count: $stripes"
249 local testdir=$DIR/$tdir
250 [ $rc = 0 ] && rm -rf $testdir
254 local testdir=$DIR/$tdir
255 local cmd="$PIOSBIN -t $pios_THREADCOUNT -n $pios_REGIONCOUNT \
256 -c $pios_CHUNKSIZE -s $pios_REGIONSIZE \
257 -o $pios_OFFSET $@ -p $testdir"
259 if [ ! -d $testdir ]; then
260 error "No test directory created, setup_pios must have failed"
274 if [ -z "$PIOSBIN" ]; then
275 skip_env "$0 : pios not found PIOSBIN=$PIOSBIN"
280 space_check || { skip_env "not enough space" && return 0; }
281 pios_setup --stripe || return
283 run_pios --verify || rc=$?
287 run_test pios_ssf "pios shared single file"
290 if [ -z "$PIOSBIN" ]; then
291 skip_env "pios not found PIOSBIN=$PIOSBIN"
296 space_check || { skip_env "not enough space" && return 0; }
298 run_pios -L fpp || return
299 run_pios -L fpp --verify || rc=$?
303 run_test pios_fpp "pios file per process"
305 equals_msg `basename $0`: test complete, cleaning up
306 check_and_cleanup_lustre
307 [ -f "$TESTSUITELOG" ] && cat $TESTSUITELOG && grep -q FAIL $TESTSUITELOG && exit 1 || true