Whamcloud - gitweb
Add openclose into the mix, to test EA creation and removal on the MDS.
[fs/lustre-release.git] / lustre / tests / runregression-mds.sh
1 #!/bin/sh
2
3 SRCDIR="`dirname $0`"
4
5 ENDRUN=endrun-`hostname`
6
7 fail() { 
8         echo "ERROR: $1" 1>&2
9         [ $2 ] && RC=$2 || RC=1
10         exit $RC
11 }
12
13 export PATH=/sbin:/usr/sbin:$SRCDIR:$PATH
14
15 cleanup() {
16         trap 0
17         $LCONF --cleanup $OPTS
18 }
19
20 [ "$COUNT" ] || COUNT=1000
21
22 [ "$LCONF" ] || LCONF=$SRCDIR/../utils/lconf
23
24 [ -z "$*" ] && fail "usage: $0 [--reformat] <conf>.xml" 1
25
26 OSCMT="`mount | awk '/ lustre_lite / { print $3 }' | tail -1`"
27 if [ -z "$OSCMT" ]; then
28         $LCONF $@ || exit 1
29         trap cleanup 0
30         OSCMT="`mount | awk '/ lustre_lite / { print $3 }' | tail -1`"
31         [ -z "$OSCMT" ] && fail "no lustre filesystem mounted" 1
32 fi
33
34 while [ "$1" ]; do
35         case $1 in
36         -v|--verbose) V=-v;;
37         --reformat) : ;;
38         *) OPTS="$OPTS $1" ;;
39         esac
40         shift
41 done
42
43 OSCTMP=`echo $OSCMT | tr "/" "."`
44 USED=`df | awk "/$OSCTMP/ { print \\$3 }" | tail -1`
45 USED=`expr $USED + 16`  # Some space for the status file
46
47 THREADS=1
48 while [ $THREADS -lt 196 ]; do
49         echo "starting $THREADS threads at `date`"
50         echo 0 > /proc/sys/portals/debug
51         $SRCDIR/createdestroy /mnt/lustre/file-$$ $COUNT -10 $THREADS
52         $SRCDIR/openclose /mnt/lustre/file-$$ $COUNT $THREADS
53         THREADS=`expr $THREADS + 5`
54         $LCONF --cleanup $OPTS || fail 10
55         $LCONF $OPTS || fail 11
56 done
57
58 rm -f $ENDRUN
59
60 NOWUSED=`df | awk "/$OSCTMP/ { print \\$3 }" | tail -1`
61 if [ $NOWUSED -gt $USED ]; then
62         echo "Space not all freed: now ${NOWUSED}kB, was ${USED}kB." 1>&2
63         echo "This is normal on BA OSTs, because of subdirectories." 1>&2
64 fi
65
66 cleanup