Whamcloud - gitweb
Comment out the rename part of runtests to try and get something working.
[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 . $SRCDIR/common.sh
12
13 ERROR=
14 SRC=/etc
15 [ "$COUNT" ] || COUNT=1000
16
17 setup_opts $@
18
19 [ "`mount | grep $OSCMT`" ] || echo | sh llsetup.sh $@ || exit 1
20
21 # let's start slowly here...
22 echo "touching $OSCMT"
23 touch $OSCMT || fail "can't touch $OSCMT" 2
24 HOSTS=$OSCMT/hosts.$$
25 echo "copying /etc/hosts to $HOSTS"
26 cp /etc/hosts $HOSTS || fail "can't cp /etc/hosts to $HOSTS" 3
27 echo "comparing /etc/hosts and $HOSTS"
28 diff -u /etc/hosts $HOSTS || fail "$HOSTS different" 4
29 #echo "renaming $HOSTS to $HOSTS.ren"
30 #mv $HOSTS $HOSTS.ren || fail "can't rename $HOSTS to $HOSTS.ren" 5
31 #echo "copying /etc/hosts to $HOSTS again"
32 #cp /etc/hosts $HOSTS || fail "can't cp /etc/hosts to $HOSTS again" 6
33 #echo "truncating $HOSTS"
34 #> $HOSTS || fail "can't truncate $HOSTS" 8
35 #echo "removing $HOSTS"
36 #rm $HOSTS || fail "can't remove $HOSTS" 9
37
38 DST=$OSCMT/runtest.$$
39 # let's start slowly here...
40 echo "creating $DST"
41 mkdir $DST || fail "can't mkdir $DST" 10
42
43 # ok, that hopefully worked, so let's do a little more
44 FILES=`find $SRC -type f | head -$COUNT`
45 echo "copying files from $SRC to $DST$SRC"
46 tar cf - $FILES | tar xvf - -C $DST || fail "copying $SRC" 11
47
48 echo "comparing newly copied files"
49 for f in $FILES; do
50         diff -q $f $DST/$f || ERROR=11
51 done
52
53 [ "$ERROR" ] && fail "old and new files are different" $ERROR
54
55 sh llcleanup.sh $@
56
57 echo | sh llrsetup.sh $@ || exit 20
58 echo "comparing previously copied files"
59 for f in $FILES; do
60         diff -q $f $DST/$f || ERROR=22
61 done
62
63 [ "$ERROR" ] && fail "old and new files are different on second diff" $ERROR
64
65 sh llcleanup.sh $@
66 echo | sh llrsetup.sh $@ || exit 31
67
68 #echo "renaming $HOSTS.ren to $HOSTS"
69 #mv $HOSTS.ren $HOSTS || fail "can't rename $HOSTS.ren to $HOSTS" 32
70 echo "truncating $HOSTS"
71 > $HOSTS || fail "can't truncate $HOSTS" 34
72 echo "removing $HOSTS"
73 rm $HOSTS || fail "can't remove $HOSTS again" 36
74 echo "removing $DST"
75 rm -r $DST || fail "can't remove $DST" 37
76
77 sh llcleanup.sh $@