Whamcloud - gitweb
b=1719
[fs/lustre-release.git] / lustre / tests / acceptance-small.sh
1 #!/bin/sh
2 # script which _must_ complete successfully (at minimum) before checkins to
3 # the CVS HEAD are allowed.
4 set -vxe
5
6 [ "$CONFIGS" -a -z "$SANITYN" ] && SANITYN=no
7 [ "$CONFIGS" ] || CONFIGS="local-large-inode local lov"
8 [ "$MAX_THREADS" ] || MAX_THREADS=10
9 if [ -z "$THREADS" ]; then
10         KB=`awk '/MemTotal:/ { print $2 }' /proc/meminfo`
11         THREADS=`expr $KB / 16384`
12         [ $THREADS -gt $MAX_THREADS ] && THREADS=$MAX_THREADS
13 fi
14 [ "$SIZE" ] || SIZE=20480
15 [ "$RSIZE" ] || RSIZE=64
16 [ "$UID" ] || UID=1000
17 [ "$MOUNT" ] || MOUNT=/mnt/lustre
18 [ "$TMP" ] || TMP=/tmp
19 [ "$COUNT" ] || COUNT=1000
20 #[ "$DEBUG_LVL" ] || DEBUG_LVL=0x370200
21 [ "$DEBUG_LVL" ] || DEBUG_LVL=0
22 [ "$DEBUG_OFF" ] || DEBUG_OFF="eval echo $DEBUG_LVL > /proc/sys/portals/debug"
23 [ "$DEBUG_ON" ] || DEBUG_ON="eval echo -1 > /proc/sys/portals/debug"
24
25 for NAME in $CONFIGS; do
26         export NAME MOUNT
27         [ -e $NAME.sh ] && sh $NAME.sh
28         [ ! -e $NAME.xml ] && [ -z "$LDAPURL" ] && echo "no config '$NAME.xml'" 1>&2 && exit 1
29
30         if [ "$RUNTESTS" != "no" ]; then
31                 sh runtests
32         fi
33
34         #[ "$SANITY" != "no" ] && sh sanity.sh
35         if [ "$SANITY" != "no" ]; then
36                 SANITYLOG=/tmp/sanity.log START=: CLEAN=: sh sanity.sh
37         fi
38
39         if [ "$DBENCH" != "no" ]; then
40                 mount | grep $MOUNT || sh llmount.sh
41                 SPACE=`df $MOUNT | tail -1 | awk '{ print $4 }'`
42                 DB_THREADS=`expr $SPACE / 50000`
43                 [ $THREADS -lt $DB_THREADS ] && DB_THREADS=$THREADS
44
45                 $DEBUG_OFF
46                 sh rundbench 1
47                 $DEBUG_ON
48                 sh llmountcleanup.sh
49                 sh llrmount.sh
50                 if [ $DB_THREADS -gt 1 ]; then
51                         $DEBUG_OFF
52                         sh rundbench $DB_THREADS
53                         $DEBUG_ON
54                         sh llmountcleanup.sh
55                         sh llrmount.sh
56                 fi
57                 rm -f /mnt/lustre/`hostname`/client.txt
58         fi
59         chown $UID $MOUNT && chmod 700 $MOUNT
60         if [ "$BONNIE" != "no" ]; then
61                 mount | grep $MOUNT || sh llmount.sh
62                 $DEBUG_OFF
63                 bonnie++ -s 0 -n 10 -u $UID -d $MOUNT
64                 $DEBUG_ON
65                 sh llmountcleanup.sh
66                 sh llrmount.sh
67         fi
68         IOZONE_OPTS="-i 0 -i 1 -i 2 -+d -r $RSIZE -s $SIZE"
69         if [ "$O_DIRECT" -a  "$O_DIRECT" != "no" ]; then
70             IOZONE_OPTS="-I $IOZONE_OPTS"
71         fi
72         IOZONE_FILE="-f $MOUNT/iozone"
73         if [ "$IOZONE" != "no" ]; then
74                 mount | grep $MOUNT || sh llmount.sh
75                 $DEBUG_OFF
76                 iozone $IOZONE_OPTS $IOZONE_FILE
77                 $DEBUG_ON
78                 sh llmountcleanup.sh
79                 sh llrmount.sh
80         fi
81         if [ "$IOZONE_DIR" != "no" ]; then
82                 mount | grep $MOUNT || sh llmount.sh
83                 SPACE=`df $MOUNT | tail -1 | awk '{ print $4 }'`
84                 IOZ_THREADS=`expr $SPACE / \( $SIZE + $SIZE / 1000 \)`
85                 [ $THREADS -lt $IOZ_THREADS ] && IOZ_THREADS=$THREADS
86
87                 $DEBUG_OFF
88                 iozone $IOZONE_OPTS $IOZONE_FILE.odir
89                 IOZVER=`iozone -v | awk '/Revision:/ { print $3 }' | tr -d '.'`
90                 $DEBUG_ON
91                 sh llmountcleanup.sh
92                 sh llrmount.sh
93                 if [ "$IOZ_THREADS" -gt 1 -a "$IOZVER" -ge 3145 ]; then
94                         $DEBUG_OFF
95                         THREAD=1
96                         IOZONE_FILE="-F "
97                         while [ $THREAD -le $IOZ_THREADS ]; do
98                                 IOZONE_FILE="$IOZONE_FILE $MOUNT/iozone.$THREAD"
99                                 THREAD=`expr $THREAD + 1`
100                         done
101                         iozone $IOZONE_OPTS -t $IOZ_THREADS $IOZONE_FILE
102                         $DEBUG_ON
103                         sh llmountcleanup.sh
104                         sh llrmount.sh
105                 elif [ $IOZVER -lt 3145 ]; then
106                         VER=`iozone -v | awk '/Revision:/ { print $3 }'`
107                         echo "iozone $VER too old for multi-threaded tests"
108                 fi
109         fi
110         if [ "$FSX" != "no" ]; then
111                 mount | grep $MOUNT || sh llmount.sh
112                 $DEBUG_OFF
113                 ./fsx -W -c 50 -p 1000 -P $TMP -l 1024000 -N $(($COUNT * 100)) $MOUNT/fsxfile
114                 $DEBUG_ON
115                 sh llmountcleanup.sh
116                 #sh llrmount.sh
117         fi      
118         mount | grep $MOUNT && sh llmountcleanup.sh
119 done
120
121 if [ "$REPLAY_SINGLE" != "no" ]; then
122         sh replay-single.sh
123 fi
124 if [ "$SANITYN" != "no" ]; then
125         export NAME=mount2
126         mount | grep $MOUNT || sh llmount.sh
127         sh sanityN.sh
128         mount | grep $MOUNT && sh llmountcleanup.sh
129 fi