Whamcloud - gitweb
46b9a07693c6a57ec620121722486a93c25061e5
[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
15 setup_opts $@
16
17 [ "`mount | grep $OSCMT`" ] || echo | sh llsetup.sh $@ || exit 1
18
19 # let's start slowly here...
20 echo "touching $OSCMT"
21 touch $OSCMT || fail "can't touch $OSCMT" 2
22 echo "copying /etc/hosts to $OSCMT/hosts"
23 cp /etc/hosts $OSCMT || fail "can't cp /etc/hosts to $OSCMT/hosts" 3
24 echo "comparing /etc/hosts and $OSCMT/hosts"
25 diff -u /etc/hosts $OSCMT/hosts || fail "$OSCMT/hosts different" 4
26
27 # ok, that hopefully worked, so let's do a little more
28 FILES=`find /etc -type f`
29 echo "copying files from /etc to $OSCMT/etc"
30 tar cf - $FILES | tar xvf - -C $OSCMT || fail "copying /etc" 10
31
32 echo "comparing newly copied files"
33 for f in $FILES; do
34         diff -q $f $OSCMT/$f || ERROR=11
35 done
36
37 [ "$ERROR" ] && fail "old and new files are different" 11
38
39 sh llcleanup.sh $@
40
41 echo | sh llrsetup.sh $@ || exit 20
42 echo "comparing previously copied files"
43 diff -u /etc/hosts $OSCMT/hosts || fail "$OSCMT/hosts is now different" 21
44
45 for f in $FILES; do
46         diff -q $f $OSCMT/$f || ERROR=22
47 done
48
49 [ "$ERROR" ] && fail "old and new files are different on second diff" 23
50
51 sh llcleanup.sh $@
52 echo | sh llrsetup.sh $@ || exit 24
53
54 echo "truncating $OSCMT/hosts"
55 > $OSCMT/hosts || fail "can't truncate $OSTMT/hosts" 25
56 echo "removing $OSCMT/hosts"
57 rm $OSCMT/hosts || fail "can't remove $OSCMT/hosts" 26
58
59 echo "removing $OSCMT/etc"
60 rm -r $OSCMT/etc || fail "can't remove $OSCMT/etc" 27
61
62 sh llcleanup.sh $@