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.
9 export PATH=/sbin:/usr/sbin:$SRCDIR:$PATH
14 [ "$COUNT" ] || COUNT=1000
16 [ "$LCONF" ] || LCONF=$SRCDIR/../utils/lconf
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
25 # let's start slowly here...
26 echo "touching $OSCMT"
27 touch $OSCMT || fail "can't touch $OSCMT" 2
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
43 # let's start slowly here...
45 mkdir $DST || fail "can't mkdir $DST" 10
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
52 echo "comparing newly copied files"
54 diff -q $f $DST/$f || ERROR=11
57 [ "$ERROR" ] && fail "old and new files are different" $ERROR
59 $LCONF --cleanup $@ || exit 19
62 echo "comparing previously copied files"
64 diff -q $f $DST/$f || ERROR=22
67 [ "$ERROR" ] && fail "old and new files are different on second diff" $ERROR
69 $LCONF --cleanup $@ || exit 29
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
79 rm -r $DST || fail "can't remove $DST" 37
81 $LCONF --cleanup $@ || exit 29