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
17 $LCONF --cleanup --dump /tmp/debug $OPTS
23 [ "$COUNT" ] || COUNT=1000
25 [ "$LCONF" ] || LCONF=$SRCDIR/../utils/lconf
27 OSCMT="`mount | awk '/ lustre_lite / { print $3 }' | tail -1`"
28 if [ -z "$OSCMT" ]; then
29 [ -z "$*" ] && fail "usage: $0 [--reformat] <conf>.xml" 1
32 OSCMT="`mount | awk '/ lustre_lite / { print $3 }' | tail -1`"
33 [ -z "$OSCMT" ] && fail "no lustre filesystem mounted" 1
45 OSCTMP=`echo $OSCMT | tr "/" "."`
46 USED=`df | awk "/$OSCTMP/ { print \\$3 }" | tail -1`
47 USED=`expr $USED + 16` # Some space for the status file
49 # let's start slowly here...
50 echo "touching $OSCMT"
51 touch $OSCMT || fail "can't touch $OSCMT" 2
53 echo "copying /etc/hosts to $HOSTS"
54 cp /etc/hosts $HOSTS || fail "can't cp /etc/hosts to $HOSTS" 3
55 echo "comparing /etc/hosts and $HOSTS"
56 diff -u /etc/hosts $HOSTS || fail "$HOSTS different" 4
57 echo "renaming $HOSTS to $HOSTS.ren"
58 mv $HOSTS $HOSTS.ren || fail "can't rename $HOSTS to $HOSTS.ren" 5
59 echo "copying /etc/hosts to $HOSTS again"
60 cp /etc/hosts $HOSTS || fail "can't cp /etc/hosts to $HOSTS again" 6
61 echo "truncating $HOSTS"
62 > $HOSTS || fail "can't truncate $HOSTS" 8
63 echo "removing $HOSTS"
64 rm $HOSTS || fail "can't remove $HOSTS" 9
67 # let's start slowly here...
69 mkdir $DST || fail "can't mkdir $DST" 10
71 # ok, that hopefully worked, so let's do a little more
72 FILES=`find $SRC -type f | head -$COUNT`
73 echo "copying files from $SRC to $DST$SRC"
74 tar cf - $FILES | tar xvf - -C $DST || fail "copying $SRC" 11
76 echo "comparing newly copied files"
78 [ $V ] && echo "verifying $DST/$f"
79 diff -q $f $DST/$f || ERROR=11
82 [ "$ERROR" ] && fail "old and new files are different" $ERROR
84 $LCONF --cleanup $OPTS || exit 19
85 $LCONF $OPTS || exit 20
87 echo "comparing previously copied files"
89 [ $V ] && echo "verifying $DST/$f"
90 diff -q $f $DST/$f || ERROR=22
93 [ "$ERROR" ] && fail "old and new files are different on second diff" $ERROR
95 $LCONF --cleanup $OPTS || exit 29
96 $LCONF $OPTS || exit 30
98 echo "renaming $HOSTS.ren to $HOSTS"
99 mv $HOSTS.ren $HOSTS || fail "can't rename $HOSTS.ren to $HOSTS" 32
100 echo "truncating $HOSTS"
101 > $HOSTS || fail "can't truncate $HOSTS" 34
102 echo "removing $HOSTS"
103 rm $HOSTS || fail "can't remove $HOSTS again" 36
105 rm -r $V $DST || fail "can't remove $DST" 37
107 NOWUSED=`df | awk "/$OSCTMP/ { print \\$3 }" | tail -1`
108 if [ $NOWUSED -gt $USED ]; then
109 echo "Space not all freed: now ${NOWUSED}kB, was ${USED}kB." 1>&2
110 echo "This is normal on BA OSTs, because of subdirectories." 1>&2
113 cleanup $OPTS || exit 29