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 if [ $UID -ne 0 ]; then
44 RUNAS_ID=${RUNAS_ID:-500}
45 RUNAS=${RUNAS:-"runas -u $RUNAS_ID"}
48 if [ `using_krb5_sec $SECURITY` == 'y' ] ; then
49 start_krb5_kdc || exit 1
50 if [ $RUNAS_ID -ne $UID ]; then
51 $RUNAS ./krb5_refresh_cache.sh || exit 2
55 export NAME=${NAME:-local}
61 sh llmountcleanup.sh > /dev/null || exit 20
68 sh llrmount.sh > /dev/null || exit 10
76 lctl mark "$*" 2> /dev/null || true
81 strace -o $TMP/$1.strace -ttt $*
83 log "FINISHED: $*: rc $RC"
88 check_kernel_version() {
89 VERSION_FILE=/proc/fs/lustre/kernel_version
91 [ ! -f $VERSION_FILE ] && echo "can't find kernel version" && return 1
92 GOT_VER=`cat $VERSION_FILE`
93 [ $GOT_VER -ge $WANT_VER ] && return 0
94 log "test needs at least kernel version $WANT_VER, running $GOT_VER"
99 if ! mount | grep -q $DIR; then
102 echo $PTLDEBUG >/proc/sys/portals/debug
104 export TESTNAME=test_$1
105 test_$1 || error "test_$1: exit with rc=$?"
112 build_test_filter() {
116 for E in $EXCEPT $ALWAYS_EXCEPT; do
117 eval EXCEPT_${E}=true
126 IFS=abcdefghijklmnopqrstuvwxyz _basetest $1
133 if [ ${!testname}x != x ]; then
138 if [ ${!testname}x != x ]; then
146 if [ ${!testname}x != x ]; then
147 echo "skipping excluded test $1"
150 testname=EXCEPT_$base
151 if [ ${!testname}x != x ]; then
152 echo "skipping excluded test $1 (base $base)"
159 [ "$SANITYLOG" ] && rm -f $SANITYLOG || true
163 if [ "$SANITYLOG" ]; then
164 echo "FAIL: $TESTNAME $@" >> $SANITYLOG
174 MOUNT="`mount | awk '/^'$NAME' .* lustre_lite / { print $3 }'`"
175 if [ -z "$MOUNT" ]; then
177 MOUNT="`mount | awk '/^'$NAME' .* lustre_lite / { print $3 }'`"
178 [ -z "$MOUNT" ] && error "NAME=$NAME not mounted"
182 [ `echo $MOUNT | wc -w` -gt 1 ] && error "NAME=$NAME mounted more than once"
185 [ -z "`echo $DIR | grep $MOUNT`" ] && echo "$DIR not in $MOUNT" && exit 99
187 rm -rf $DIR/[Rdfs][1-9]*
191 echo preparing for tests involving mounts
192 EXT2_DEV=${EXT2_DEV:-/tmp/SANITY.LOOP}
194 mke2fs -j -F $EXT2_DEV 8000 > /dev/null
197 rm -fr $DIR/1a0 > /dev/null
198 MDS=`find /proc/fs/lustre/mds/* -type d | head -n1 | sed 's/.*\///'`
200 echo "no MDS available, skipping test"
203 count=`find /proc/fs/lustre/mds/* -type d | wc -l`
204 [ $count -gt 1 ] && {
205 echo "more than 1 MDS is found, skipping test"
209 mkdir $DIR/1a0 || error
210 old_last_fid=`cat /proc/fs/lustre/mds/$MDS/last_fid`
211 createmany -o $DIR/1a0/f 5000
212 new_last_fid=`cat /proc/fs/lustre/mds/$MDS/last_fid`
214 diff=$(($new_last_fid-$old_last_fid))
215 [ $diff -ne 5000 ] && {
216 echo "invalid fid management on $MDS: \
217 old $old_last_fid, new $new_last_fid"
220 rm -fr $DIR/1a0 || error
222 run_test 1a " fid correctness (create) ============="
225 rm -fr $DIR/1b0 > /dev/null
226 MDS=`find /proc/fs/lustre/mds/* -type d | head -n1 | sed 's/.*\///'`
228 echo "no MDS available, skipping test"
231 count=`find /proc/fs/lustre/mds/* -type d | wc -l`
232 [ $count -gt 1 ] && {
233 echo "more than 1 MDS is found, skipping test"
237 mkdir $DIR/1b0 || error
238 createmany -o $DIR/1b0/f 5000
239 old_last_fid=`cat /proc/fs/lustre/mds/$MDS/last_fid`
241 new_last_fid=`cat /proc/fs/lustre/mds/$MDS/last_fid`
243 [ $new_last_fid -ne $old_last_fid ] && {
244 echo "invalid fid management on $MDS: \
245 old $old_last_fid, new $new_last_fid"
248 rm -fr $DIR/1b0 || error
250 run_test 1b " fid correctness (remove) ============="
256 log "cleanup: ========================================================"
257 if [ "`mount | grep ^$NAME`" ]; then
258 rm -rf $DIR/[Rdfs][1-9]*
259 if [ "$I_MOUNTED" = "yes" ]; then
260 sh llmountcleanup.sh || error
264 echo "=========================== finished ============================"
265 [ -f "$SANITYLOG" ] && cat $SANITYLOG && exit 1 || true