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
19 [ "$COUNT" ] || COUNT=1000
21 [ "$LCONF" ] || LCONF=$SRCDIR/../utils/lconf
23 OSCMT="`mount | awk '/ lustre_lite / { print $3 }'`"
24 if [ -z "$OSCMT" ]; then
25 $LCONF $REFORMAT $@ || exit 1
26 trap "$LCONF --cleanup $@" 0
27 OSCMT="`mount | awk '/ lustre_lite / { print $3 }'`"
28 [ -z "$OSCMT" ] && echo "no lustre filesystem mounted" 2>&1 && exit 1
32 # let's start slowly here...
33 echo "touching $OSCMT"
34 touch $OSCMT || fail "can't touch $OSCMT" 2
36 echo "copying /etc/hosts to $HOSTS"
37 cp /etc/hosts $HOSTS || fail "can't cp /etc/hosts to $HOSTS" 3
38 echo "comparing /etc/hosts and $HOSTS"
39 diff -u /etc/hosts $HOSTS || fail "$HOSTS different" 4
40 #echo "renaming $HOSTS to $HOSTS.ren"
41 #mv $HOSTS $HOSTS.ren || fail "can't rename $HOSTS to $HOSTS.ren" 5
42 #echo "copying /etc/hosts to $HOSTS again"
43 #cp /etc/hosts $HOSTS || fail "can't cp /etc/hosts to $HOSTS again" 6
44 #echo "truncating $HOSTS"
45 #> $HOSTS || fail "can't truncate $HOSTS" 8
46 #echo "removing $HOSTS"
47 #rm $HOSTS || fail "can't remove $HOSTS" 9
50 # let's start slowly here...
52 mkdir $DST || fail "can't mkdir $DST" 10
54 # ok, that hopefully worked, so let's do a little more
55 FILES=`find $SRC -type f | head -$COUNT`
56 echo "copying files from $SRC to $DST$SRC"
57 tar cf - $FILES | tar xvf - -C $DST || fail "copying $SRC" 11
59 echo "comparing newly copied files"
61 diff -q $f $DST/$f || ERROR=11
64 [ "$ERROR" ] && fail "old and new files are different" $ERROR
66 $LCONF --cleanup $@ || exit 19
69 echo "comparing previously copied files"
71 diff -q $f $DST/$f || ERROR=22
74 [ "$ERROR" ] && fail "old and new files are different on second diff" $ERROR
76 $LCONF --cleanup $@ || exit 29
79 #echo "renaming $HOSTS.ren to $HOSTS"
80 #mv $HOSTS.ren $HOSTS || fail "can't rename $HOSTS.ren to $HOSTS" 32
81 echo "truncating $HOSTS"
82 > $HOSTS || fail "can't truncate $HOSTS" 34
83 echo "removing $HOSTS"
84 rm $HOSTS || fail "can't remove $HOSTS again" 36
86 rm -r $DST || fail "can't remove $DST" 37
88 $LCONF --cleanup $@ || exit 29