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.
10 [ $2 ] && RC=$2 || RC=1
14 export PATH=/sbin:/usr/sbin:$SRCDIR:$PATH
18 [ "$COUNT" ] || COUNT=1000
20 [ "$LCONF" ] || LCONF=$SRCDIR/../utils/lconf
22 OSCMT="`mount | awk '/ lustre_lite / { print $3 }' | tail -1`"
23 if [ -z "$OSCMT" ]; then
24 [ -z "$*" ] && fail "usage: $0 [--reformat] <conf>.xml" 1
26 trap "$LCONF --cleanup $@" 0
27 OSCMT="`mount | awk '/ lustre_lite / { print $3 }'`"
28 [ -z "$OSCMT" ] && fail "no lustre filesystem mounted" 1
31 # let's start slowly here...
32 echo "touching $OSCMT"
33 touch $OSCMT || fail "can't touch $OSCMT" 2
35 echo "copying /etc/hosts to $HOSTS"
36 cp /etc/hosts $HOSTS || fail "can't cp /etc/hosts to $HOSTS" 3
37 echo "comparing /etc/hosts and $HOSTS"
38 diff -u /etc/hosts $HOSTS || fail "$HOSTS different" 4
39 #echo "renaming $HOSTS to $HOSTS.ren"
40 #mv $HOSTS $HOSTS.ren || fail "can't rename $HOSTS to $HOSTS.ren" 5
41 #echo "copying /etc/hosts to $HOSTS again"
42 #cp /etc/hosts $HOSTS || fail "can't cp /etc/hosts to $HOSTS again" 6
43 #echo "truncating $HOSTS"
44 #> $HOSTS || fail "can't truncate $HOSTS" 8
45 #echo "removing $HOSTS"
46 #rm $HOSTS || fail "can't remove $HOSTS" 9
49 # let's start slowly here...
51 mkdir $DST || fail "can't mkdir $DST" 10
53 # ok, that hopefully worked, so let's do a little more
54 FILES=`find $SRC -type f | head -$COUNT`
55 echo "copying files from $SRC to $DST$SRC"
56 tar cf - $FILES | tar xvf - -C $DST || fail "copying $SRC" 11
58 echo "comparing newly copied files"
60 diff -q $f $DST/$f || ERROR=11
63 [ "$ERROR" ] && fail "old and new files are different" $ERROR
65 $LCONF --cleanup $@ || exit 19
68 echo "comparing previously copied files"
70 diff -q $f $DST/$f || ERROR=22
73 [ "$ERROR" ] && fail "old and new files are different on second diff" $ERROR
75 $LCONF --cleanup $@ || exit 29
78 #echo "renaming $HOSTS.ren to $HOSTS"
79 #mv $HOSTS.ren $HOSTS || fail "can't rename $HOSTS.ren to $HOSTS" 32
80 echo "truncating $HOSTS"
81 > $HOSTS || fail "can't truncate $HOSTS" 34
82 echo "removing $HOSTS"
83 rm $HOSTS || fail "can't remove $HOSTS again" 36
85 rm -r $DST || fail "can't remove $DST" 37
87 $LCONF --cleanup $@ || exit 29