5 # bug number for skipped test:
6 ALWAYS_EXCEPT=${ALWAYS_EXCEPT:-""}
7 # UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
9 [ "$ALWAYS_EXCEPT$EXCEPT" ] && echo "Skipping tests: $ALWAYS_EXCEPT $EXCEPT"
12 export PATH=$PWD/$SRCDIR:$SRCDIR:$SRCDIR/../utils:$PATH
13 export SECURITY=${SECURITY:-"null"}
16 FSTYPE=${FSTYPE:-ext3}
18 CHECKSTAT=${CHECKSTAT:-"checkstat -v"}
19 CREATETEST=${CREATETEST:-createtest}
21 LSTRIPE=${LSTRIPE:-"$LFS setstripe"}
22 LFIND=${LFIND:-"$LFS find"}
23 LVERIFY=${LVERIFY:-ll_dirstripe_verify}
25 MCREATE=${MCREATE:-mcreate}
26 OPENFILE=${OPENFILE:-openfile}
27 OPENUNLINK=${OPENUNLINK:-openunlink}
28 TOEXCL=${TOEXCL:-toexcl}
29 TRUNCATE=${TRUNCATE:-truncate}
30 MUNLINK=${MUNLINK:-munlink}
31 SOCKETSERVER=${SOCKETSERVER:-socketserver}
32 SOCKETCLIENT=${SOCKETCLIENT:-socketclient}
33 IOPENTEST1=${IOPENTEST1:-iopentest1}
34 IOPENTEST2=${IOPENTEST2:-iopentest2}
35 PTLDEBUG=${PTLDEBUG:-0}
40 export NAME=${NAME:-local}
46 sh llmountcleanup.sh > /dev/null || exit 20
53 sh llrmount.sh > /dev/null || exit 10
61 lctl mark "$*" 2> /dev/null || true
66 strace -o $TMP/$1.strace -ttt $*
68 log "FINISHED: $*: rc $RC"
73 check_kernel_version() {
74 VERSION_FILE=/proc/fs/lustre/kernel_version
76 [ ! -f $VERSION_FILE ] && echo "can't find kernel version" && return 1
77 GOT_VER=`cat $VERSION_FILE`
78 [ $GOT_VER -ge $WANT_VER ] && return 0
79 log "test needs at least kernel version $WANT_VER, running $GOT_VER"
84 if ! cat /proc/mounts | grep -q $DIR; then
87 echo $PTLDEBUG >/proc/sys/portals/debug
89 export TESTNAME=test_$1
90 test_$1 || error "test_$1: exit with rc=$?"
101 for E in $EXCEPT $ALWAYS_EXCEPT; do
102 eval EXCEPT_${E}=true
111 IFS=abcdefghijklmnopqrstuvwxyz _basetest $1
118 if [ ${!testname}x != x ]; then
123 if [ ${!testname}x != x ]; then
131 if [ ${!testname}x != x ]; then
132 echo "skipping excluded test $1"
135 testname=EXCEPT_$base
136 if [ ${!testname}x != x ]; then
137 echo "skipping excluded test $1 (base $base)"
144 [ "$SANITYLOG" ] && rm -f $SANITYLOG || true
148 if [ "$SANITYLOG" ]; then
149 echo "FAIL: $TESTNAME $@" >> $SANITYLOG
159 MOUNT="`mount | awk '/^'$NAME' .* lustre_lite / { print $3 }'`"
160 if [ -z "$MOUNT" ]; then
162 MOUNT="`mount | awk '/^'$NAME' .* lustre_lite / { print $3 }'`"
163 [ -z "$MOUNT" ] && error "NAME=$NAME not mounted"
167 [ `echo $MOUNT | wc -w` -gt 1 ] && error "NAME=$NAME mounted more than once"
170 [ -z "`echo $DIR | grep $MOUNT`" ] && echo "$DIR not in $MOUNT" && exit 99
172 rm -rf $DIR/[Rdfs][1-9]*
176 echo preparing for tests involving mounts
177 EXT2_DEV=${EXT2_DEV:-/tmp/SANITY.LOOP}
179 mke2fs -j -F $EXT2_DEV 8000 > /dev/null
182 rm -fr $DIR/1a0 > /dev/null
183 MDS=`find /proc/fs/lustre/mds/* -type d | head -n1 | sed 's/.*\///'`
185 echo "no MDS available, skipping test"
188 count=`find /proc/fs/lustre/mds/* -type d | wc -l`
189 [ $count -gt 1 ] && {
190 echo "more than 1 MDS is found, skipping test"
194 mkdir $DIR/1a0 || error
195 old_last_fid=`cat /proc/fs/lustre/mds/$MDS/last_fid`
196 createmany -o $DIR/1a0/f 5000
197 new_last_fid=`cat /proc/fs/lustre/mds/$MDS/last_fid`
199 diff=$(($new_last_fid-$old_last_fid))
200 [ $diff -ne 5000 ] && {
201 echo "invalid fid management on $MDS: \
202 old $old_last_fid, new $new_last_fid"
205 rm -fr $DIR/1a0 || error
207 run_test 1a " fid correctness (create) ============="
210 rm -fr $DIR/1b0 > /dev/null
211 MDS=`find /proc/fs/lustre/mds/* -type d | head -n1 | sed 's/.*\///'`
213 echo "no MDS available, skipping test"
216 count=`find /proc/fs/lustre/mds/* -type d | wc -l`
217 [ $count -gt 1 ] && {
218 echo "more than 1 MDS is found, skipping test"
222 mkdir $DIR/1b0 || error
223 createmany -o $DIR/1b0/f 5000
224 old_last_fid=`cat /proc/fs/lustre/mds/$MDS/last_fid`
226 new_last_fid=`cat /proc/fs/lustre/mds/$MDS/last_fid`
228 [ $new_last_fid -ne $old_last_fid ] && {
229 echo "invalid fid management on $MDS: \
230 old $old_last_fid, new $new_last_fid"
233 rm -fr $DIR/1b0 || error
235 run_test 1b " fid correctness (remove) ============="
241 log "cleanup: ========================================================"
242 if [ "`mount | grep ^$NAME`" ]; then
243 rm -rf $DIR/[Rdfs][1-9]*
244 if [ "$I_MOUNTED" = "yes" ]; then
245 sh llmountcleanup.sh || error
249 echo "=========================== finished ============================"
250 [ -f "$SANITYLOG" ] && cat $SANITYLOG && exit 1 || true