Whamcloud - gitweb
Make runtests take an XML config file as a parameter.
[fs/lustre-release.git] / lustre / tests / runtests
1 #!/bin/sh
2 #
3 # Script which does some basic tests to ensure we haven't regressed.
4 # Probably a good idea to run this before doing any checkins.
5 # In the future this can become more fancy, but it's OK for now.
6
7 SRCDIR="`dirname $0`"
8
9 export PATH=/sbin:/usr/sbin:$SRCDIR:$PATH
10
11 REFORMAT="--reformat"
12 ERROR=
13 SRC=/etc
14 [ "$COUNT" ] || COUNT=1000
15
16 [ "$LCONF" ] || LCONF=$SRCDIR/../utils/lconf
17
18 OSCMT="`mount | awk '/ lustre_lite / { print $3 }'`"
19 if [ -z "$OSCMT" ]; then
20         $LCONF $REFORMAT $@ || exit 1
21         MTPT="`mount | awk '/ lustre_lite / { print $3 }'`"
22         [ -z "$OSCMT" ] && echo "no lustre filesystem mounted" 2>&1 && exit 1
23 fi
24
25 # let's start slowly here...
26 echo "touching $OSCMT"
27 touch $OSCMT || fail "can't touch $OSCMT" 2
28 HOSTS=$OSCMT/hosts.$$
29 echo "copying /etc/hosts to $HOSTS"
30 cp /etc/hosts $HOSTS || fail "can't cp /etc/hosts to $HOSTS" 3
31 echo "comparing /etc/hosts and $HOSTS"
32 diff -u /etc/hosts $HOSTS || fail "$HOSTS different" 4
33 #echo "renaming $HOSTS to $HOSTS.ren"
34 #mv $HOSTS $HOSTS.ren || fail "can't rename $HOSTS to $HOSTS.ren" 5
35 #echo "copying /etc/hosts to $HOSTS again"
36 #cp /etc/hosts $HOSTS || fail "can't cp /etc/hosts to $HOSTS again" 6
37 #echo "truncating $HOSTS"
38 #> $HOSTS || fail "can't truncate $HOSTS" 8
39 #echo "removing $HOSTS"
40 #rm $HOSTS || fail "can't remove $HOSTS" 9
41
42 DST=$OSCMT/runtest.$$
43 # let's start slowly here...
44 echo "creating $DST"
45 mkdir $DST || fail "can't mkdir $DST" 10
46
47 # ok, that hopefully worked, so let's do a little more
48 FILES=`find $SRC -type f | head -$COUNT`
49 echo "copying files from $SRC to $DST$SRC"
50 tar cf - $FILES | tar xvf - -C $DST || fail "copying $SRC" 11
51
52 echo "comparing newly copied files"
53 for f in $FILES; do
54         diff -q $f $DST/$f || ERROR=11
55 done
56
57 [ "$ERROR" ] && fail "old and new files are different" $ERROR
58
59 $LCONF --cleanup $@ || exit 19
60 $LCONF $@ || exit 20
61
62 echo "comparing previously copied files"
63 for f in $FILES; do
64         diff -q $f $DST/$f || ERROR=22
65 done
66
67 [ "$ERROR" ] && fail "old and new files are different on second diff" $ERROR
68
69 $LCONF --cleanup $@ || exit 29
70 $LCONF $@ || exit 30
71
72 #echo "renaming $HOSTS.ren to $HOSTS"
73 #mv $HOSTS.ren $HOSTS || fail "can't rename $HOSTS.ren to $HOSTS" 32
74 echo "truncating $HOSTS"
75 > $HOSTS || fail "can't truncate $HOSTS" 34
76 echo "removing $HOSTS"
77 rm $HOSTS || fail "can't remove $HOSTS again" 36
78 echo "removing $DST"
79 rm -r $DST || fail "can't remove $DST" 37
80
81 $LCONF --cleanup $@ || exit 29