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}
18 ALWAYS_EXCEPT="$SANITY_BENCHMARK_EXCEPT"
20 MAX_THREADS=${MAX_THREADS:-20}
21 RAMKB=`awk '/MemTotal:/ { print $2 }' /proc/meminfo`
22 if [ -z "$THREADS" ]; then
23 THREADS=$((RAMKB / 16384))
24 [ $THREADS -gt $MAX_THREADS ] && THREADS=$MAX_THREADS
26 SIZE=${SIZE:-$((RAMKB * 2))}
29 DEBUG_LVL=${DEBUG_LVL:-0}
30 DEBUG_OFF=${DEBUG_OFF:-"eval lctl set_param debug=\"$DEBUG_LVL\""}
31 DEBUG_ON=${DEBUG_ON:-"eval lctl set_param debug=0x33f0484"}
32 DIRECTIO=${DIRECTIO:-directio}
34 [ "$SLOW" = "no" ] && EXCEPT_SLOW="iozone"
37 check_and_setup_lustre
40 rm -rf $DIR/[df][0-9]*
43 if ! which dbench > /dev/null 2>&1 ; then
44 skip_env "No dbench installed"
48 local DBENCHDIR=$DIR/d0.$HOSTNAME
50 local SPACE=`df -P $MOUNT | tail -n 1 | awk '{ print $4 }'`
51 DB_THREADS=$((SPACE / 50000))
52 [ $THREADS -lt $DB_THREADS ] && DB_THREADS=$THREADS
58 FAIL_ON_ERROR=false check_runas_id_ret $myUID $myGID $myRUNAS || \
59 { myRUNAS="" && myUID=$UID && myGID=`id -g $USER`; }
60 chown $myUID:$myGID $DBENCHDIR
62 [ "$SLOW" = "no" ] && duration=" -t 120"
63 if [ "$SLOW" != "no" -o $DB_THREADS -eq 1 ]; then
64 $myRUNAS bash rundbench -D $DBENCHDIR 1 $duration || error "dbench failed!"
67 if [ $DB_THREADS -gt 1 ]; then
69 $myRUNAS bash rundbench -D $DBENCHDIR $DB_THREADS $duration
74 run_test dbench "dbench"
77 if ! which bonnie++ > /dev/null 2>&1; then
78 skip_env "No bonnie++ installed"
81 local BONDIR=$DIR/d0.bonnie
83 $LFS setstripe -c -1 $BONDIR
85 local MIN=`lctl get_param -n osc.*.kbytesavail | sort -n | head -n1`
86 local SPACE=$(( OSTCOUNT * MIN ))
87 [ $SPACE -lt $SIZE ] && SIZE=$((SPACE * 3 / 4))
88 log "min OST has ${MIN}kB available, using ${SIZE}kB file size"
93 FAIL_ON_ERROR=false check_runas_id_ret $myUID $myGID $myRUNAS || \
94 { myRUNAS="" && myUID=$UID && myGID=`id -$USER`; }
95 chown $myUID:$myGID $BONDIR
96 $myRUNAS bonnie++ -f -r 0 -s$((SIZE / 1024)) -n 10 -u$myUID:$myGID -d$BONDIR
99 run_test bonnie "bonnie++"
102 if ! which iozone > /dev/null 2>&1; then
103 skip_env "No iozone installed"
109 local IOZDIR=$DIR/d0.iozone
111 $LFS setstripe -c -1 $IOZDIR
113 local MIN=`lctl get_param -n osc.*.kbytesavail | sort -n | head -n1`
114 local SPACE=$(( OSTCOUNT * MIN ))
115 [ $SPACE -lt $SIZE ] && SIZE=$((SPACE * 3 / 4))
116 log "min OST has ${MIN}kB available, using ${SIZE}kB file size"
117 IOZONE_OPTS="-i 0 -i 1 -i 2 -e -+d -r $RSIZE"
118 IOZFILE="$IOZDIR/iozone"
119 IOZLOG=$TMP/iozone.log
120 # $SPACE was calculated with all OSTs
125 FAIL_ON_ERROR=false check_runas_id_ret $myUID $myGID $myRUNAS || \
126 { myRUNAS="" && myUID=$UID && myGID=`id -g $USER`; }
127 chown $myUID:$myGID $IOZDIR
128 $myRUNAS iozone $IOZONE_OPTS -s $SIZE -f $IOZFILE 2>&1 | tee $IOZLOG
129 tail -1 $IOZLOG | grep -q complete || \
130 { error "iozone (1) failed" && return 1; }
134 # check if O_DIRECT support is implemented in kernel
135 if [ -z "$O_DIRECT" ]; then
137 if ! $DIRECTIO write $DIR/f.iozone 0 1; then
138 log "SKIP iozone DIRECT IO test"
143 if [ "$O_DIRECT" != "no" -a "$IOZONE_DIR" != "no" ]; then
145 $myRUNAS iozone -I $IOZONE_OPTS -s $SIZE -f $IOZFILE.odir 2>&1 | tee $IOZLOG
146 tail -1 $IOZLOG | grep -q complete || \
147 { error "iozone (2) failed" && return 1; }
152 SPACE=`df -P $MOUNT | tail -n 1 | awk '{ print $4 }'`
153 IOZ_THREADS=$((SPACE / SIZE * 2 / 3 ))
154 [ $THREADS -lt $IOZ_THREADS ] && IOZ_THREADS=$THREADS
155 IOZVER=`iozone -v | awk '/Revision:/ {print $3}' | tr -d .`
156 if [ "$IOZ_THREADS" -gt 1 -a "$IOZVER" -ge 3145 ]; then
157 $LFS setstripe -c -1 $IOZDIR
161 while [ $THREAD -le $IOZ_THREADS ]; do
162 IOZFILE="$IOZFILE $IOZDIR/iozone.$THREAD"
163 THREAD=$((THREAD + 1))
165 $myRUNAS iozone $IOZONE_OPTS -s $((SIZE / IOZ_THREADS)) -t $IOZ_THREADS -F $IOZFILE 2>&1 | tee $IOZLOG
166 tail -1 $IOZLOG | grep -q complete || \
167 { error "iozone (3) failed" && return 1; }
170 elif [ $IOZVER -lt 3145 ]; then
171 VER=`iozone -v | awk '/Revision:/ { print $3 }'`
172 echo "iozone $VER too old for multi-thread test"
175 run_test iozone "iozone"
178 local testfile=$DIR/f0.fsxfile
181 local SPACE=`df -P $MOUNT | tail -n 1 | awk '{ print $4 }'`
182 [ $SPACE -lt $FSX_SIZE ] && FSX_SIZE=$((SPACE * 3 / 4))
184 FSX_SEED=${FSX_SEED:-$RANDOM}
186 $LFS setstripe -c -1 $testfile
187 CMD="fsx -c 50 -p 1000 -S $FSX_SEED -P $TMP -l $FSX_SIZE \
188 -N $((FSX_COUNT * 100)) $FSXOPT $testfile"
190 $CMD || error "fsx failed"
197 check_and_cleanup_lustre