3 # Test basic functionality of the filesystem using simple
9 LUSTRE=${LUSTRE:-$(cd $(dirname $0)/..; echo $PWD)}
10 . $LUSTRE/tests/test-framework.sh
12 . ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
14 MAX_THREADS=${MAX_THREADS:-20}
15 RAMKB=`awk '/MemTotal:/ { print $2 }' /proc/meminfo`
16 if [ -z "$THREADS" ]; then
17 THREADS=$((RAMKB / 16384))
18 [ $THREADS -gt $MAX_THREADS ] && THREADS=$MAX_THREADS
20 SIZE=${SIZE:-$((RAMKB * 2))}
23 DEBUG_LVL=${DEBUG_LVL:-0}
24 DEBUG_OFF=${DEBUG_OFF:-"eval lctl set_param debug=\"$DEBUG_LVL\""}
25 DEBUG_ON=${DEBUG_ON:-"eval lctl set_param debug=0x33f0484"}
27 [ "$SLOW" = "no" ] && EXCEPT_SLOW="iozone"
31 check_and_setup_lustre
34 if ! which dbench > /dev/null 2>&1 ; then
35 skip "No dbench installed"
39 DBENCHDIR=$MOUNT/d0.$HOSTNAME
41 local SPACE=`df -P $MOUNT | tail -n 1 | awk '{ print $4 }'`
42 DB_THREADS=$((SPACE / 50000))
43 [ $THREADS -lt $DB_THREADS ] && DB_THREADS=$THREADS
48 FAIL_ON_ERROR=false check_runas_id_ret $myUID $myUID $myRUNAS || { myRUNAS="" && myUID=$UID; }
49 chown $myUID:$myUID $DBENCHDIR
51 [ "$SLOW" = "no" ] && duration=" -t 120"
52 if [ "$SLOW" != "no" -o $DB_THREADS -eq 1 ]; then
53 $myRUNAS bash rundbench -D $DBENCHDIR 1 $duration || error "dbench failed!"
56 if [ $DB_THREADS -gt 1 ]; then
58 $myRUNAS bash rundbench -D $DBENCHDIR $DB_THREADS $duration
63 run_test dbench "dbench"
66 if ! which bonnie++ > /dev/null 2>&1; then
67 skip "No bonnie++ installed"
70 BONDIR=$MOUNT/d0.bonnie
72 $LFS setstripe -c -1 $BONDIR
74 local MIN=`lctl get_param -n osc.*.kbytesavail | sort -n | head -n1`
75 local SPACE=$(( OSTCOUNT * MIN ))
76 [ $SPACE -lt $SIZE ] && SIZE=$((SPACE * 3 / 4))
77 log "min OST has ${MIN}kB available, using ${SIZE}kB file size"
81 FAIL_ON_ERROR=false check_runas_id_ret $myUID $myUID $myRUNAS || { myRUNAS="" && myUID=$UID; }
82 chown $myUID:$myUID $BONDIR
83 $myRUNAS bonnie++ -f -r 0 -s$((SIZE / 1024)) -n 10 -u$myUID:$myUID -d$BONDIR
86 run_test bonnie "bonnie++"
89 if ! which iozone > /dev/null 2>&1; then
90 skip "No iozone installed"
96 IOZDIR=$MOUNT/d0.iozone
98 $LFS setstripe -c -1 $IOZDIR
100 local MIN=`lctl get_param -n osc.*.kbytesavail | sort -n | head -n1`
101 local SPACE=$(( OSTCOUNT * MIN ))
102 [ $SPACE -lt $SIZE ] && SIZE=$((SPACE * 3 / 4))
103 log "min OST has ${MIN}kB available, using ${SIZE}kB file size"
104 IOZONE_OPTS="-i 0 -i 1 -i 2 -e -+d -r $RSIZE"
105 IOZFILE="$IOZDIR/iozone"
106 IOZLOG=$TMP/iozone.log
107 # $SPACE was calculated with all OSTs
111 FAIL_ON_ERROR=false check_runas_id_ret $myUID $myUID $myRUNAS || { myRUNAS="" && myUID=$UID; }
112 chown $myUID:$myUID $IOZDIR
113 $myRUNAS iozone $IOZONE_OPTS -s $SIZE -f $IOZFILE 2>&1 | tee $IOZLOG
114 tail -1 $IOZLOG | grep -q complete || \
115 { error "iozone (1) failed" && return 1; }
119 # check if O_DIRECT support is implemented in kernel
120 if [ -z "$O_DIRECT" ]; then
121 touch $MOUNT/f.iozone
122 if ! ./directio write $MOUNT/f.iozone 0 1; then
123 log "SKIP iozone DIRECT IO test"
126 rm -f $MOUNT/f.iozone
128 if [ "$O_DIRECT" != "no" -a "$IOZONE_DIR" != "no" ]; then
130 $myRUNAS iozone -I $IOZONE_OPTS -s $SIZE -f $IOZFILE.odir 2>&1 | tee $IOZLOG
131 tail -1 $IOZLOG | grep -q complete || \
132 { error "iozone (2) failed" && return 1; }
137 SPACE=`df -P $MOUNT | tail -n 1 | awk '{ print $4 }'`
138 IOZ_THREADS=$((SPACE / SIZE * 2 / 3 ))
139 [ $THREADS -lt $IOZ_THREADS ] && IOZ_THREADS=$THREADS
140 IOZVER=`iozone -v | awk '/Revision:/ {print $3}' | tr -d .`
141 if [ "$IOZ_THREADS" -gt 1 -a "$IOZVER" -ge 3145 ]; then
142 $LFS setstripe -c -1 $IOZDIR
146 while [ $THREAD -le $IOZ_THREADS ]; do
147 IOZFILE="$IOZFILE $IOZDIR/iozone.$THREAD"
148 THREAD=$((THREAD + 1))
150 $myRUNAS iozone $IOZONE_OPTS -s $((SIZE / IOZ_THREADS)) -t $IOZ_THREADS -F $IOZFILE 2>&1 | tee $IOZLOG
151 tail -1 $IOZLOG | grep -q complete || \
152 { error "iozone (3) failed" && return 1; }
155 elif [ $IOZVER -lt 3145 ]; then
156 VER=`iozone -v | awk '/Revision:/ { print $3 }'`
157 echo "iozone $VER too old for multi-thread test"
160 run_test iozone "iozone"
165 local SPACE=`df -P $MOUNT | tail -n 1 | awk '{ print $4 }'`
166 [ $SPACE -lt $FSX_SIZE ] && FSX_SIZE=$((SPACE * 3 / 4))
168 FSX_SEED=${FSX_SEED:-$RANDOM}
170 $LFS setstripe -c -1 $MOUNT/fsxfile
171 echo Using FSX_SEED=$FSX_SEED FSX_SIZE=$FSX_SIZE FSX_COUNT=$FSX_COUNT
172 fsx -c 50 -p 1000 -S $FSX_SEED -P $TMP -l $FSX_SIZE \
173 -N $(($FSX_COUNT * 100)) $MOUNT/fsxfile
178 equals_msg `basename $0`: test complete, cleaning up
179 check_and_cleanup_lustre
180 [ -f "$TESTSUITELOG" ] && cat $TESTSUITELOG && grep -q FAIL $TESTSUITELOG && exit 1 || true