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
19 export PATH=/sbin:/usr/sbin:$SRCDIR:$SRCDIR/../utils:$PATH
23 [ "$COUNT" ] || COUNT=1000
25 [ "$LCONF" ] || LCONF=$SRCDIR/../utils/lconf
27 [ "$MCREATE" ] || MCREATE=$SRCDIR/../tests/mcreate
29 [ "$MKDIRMANY" ] || MKDIRMANY=$SRCDIR/../tests/mkdirmany
33 *.xml) export NAME=`echo $1 | sed "s/.xml//"` ;;
38 OSCMT="`mount | awk '/ lustre_lite / { print $3 }' | tail -1`"
39 if [ -z "$OSCMT" ]; then
41 OSCMT="`mount | awk '/ lustre_lite / { print $3 }' | tail -1`"
42 [ -z "$OSCMT" ] && fail "no lustre filesystem mounted" 1
46 OSCTMP=`echo $OSCMT | tr "/" "."`
47 USED=`df | awk "/$OSCTMP/ { print \\$3 }" | tail -1`
48 USED=`expr $USED + 16` # Some space for the status file
50 # let's start slowly here...
52 touch $OSCMT || fail "can't touch $OSCMT" 2
55 # this will cause the following cp to trigger bug #620096
56 log "create an empty file $HOSTS"
59 log "copying /etc/hosts to $HOSTS"
60 cp /etc/hosts $HOSTS || fail "can't cp /etc/hosts to $HOSTS" 3
61 log "comparing /etc/hosts and $HOSTS"
62 diff -u /etc/hosts $HOSTS || fail "$HOSTS different" 4
63 log "renaming $HOSTS to $HOSTS.ren"
64 mv $HOSTS $HOSTS.ren || fail "can't rename $HOSTS to $HOSTS.ren" 5
65 log "copying /etc/hosts to $HOSTS again"
66 cp /etc/hosts $HOSTS || fail "can't cp /etc/hosts to $HOSTS again" 6
67 log "truncating $HOSTS"
68 > $HOSTS || fail "can't truncate $HOSTS" 8
70 rm $HOSTS || fail "can't remove $HOSTS" 9
73 # let's start slowly here...
75 mkdir $DST || fail "can't mkdir $DST" 10
77 # ok, that hopefully worked, so let's do a little more, with files that
78 # haven't changed in the last day (hopefully they don't change during test)
79 FILES=`find $SRC -type f -mtime +1 -ctime +1 | head -$COUNT`
80 log "copying files from $SRC to $DST$SRC"
81 tar cf - $FILES | tar xvf - -C $DST || fail "copying $SRC" 11
83 log "comparing newly copied files"
85 [ $V ] && log "verifying $DST/$f"
86 diff -q $f $DST/$f || ERROR=11
89 [ "$ERROR" ] && fail "old and new files are different" $ERROR
91 sh llmountcleanup.sh || exit 19
92 sh llrmount.sh || exit 20
94 log "comparing previously copied files"
96 [ $V ] && log "verifying $DST/$f"
97 diff -q $f $DST/$f || ERROR=22
100 [ "$ERROR" ] && fail "old and new files are different on second diff" $ERROR
102 sh llmountcleanup.sh || exit 19
103 sh llrmount.sh || exit 20
105 log "renaming $HOSTS.ren to $HOSTS"
106 mv $HOSTS.ren $HOSTS || fail "can't rename $HOSTS.ren to $HOSTS" 32
107 log "truncating $HOSTS"
108 > $HOSTS || fail "can't truncate $HOSTS" 34
109 log "removing $HOSTS"
110 rm $HOSTS || fail "can't remove $HOSTS again" 36
112 rm -r $V $DST || fail "can't remove $DST" 37
114 # mkdirmany test (bug 589)
115 log "running mkdirmany $OSCMT/base$$ 100"
116 $MKDIRMANY $OSCMT/base$$ 100 || fail "mkdirmany failed"
117 log "removing mkdirmany directories"
118 rmdir $OSCMT/base$$* || fail "mkdirmany cleanup failed"
122 NOWUSED=`df | awk "/$OSCTMP/ { print \\$3 }" | tail -1`
123 if [ $NOWUSED -gt $USED ]; then
124 echo "Space not all freed: now ${NOWUSED}kB, was ${USED}kB." 1>&2
125 echo "This is normal on BA OSTs, because of subdirectories." 1>&2
128 if [ "$I_MOUNTED" = "yes" ]; then
129 sh llmountcleanup.sh || exit 29