3 # Run select tests by setting ONLY, or as arguments to the script.
4 # Skip specific tests by setting EXCEPT.
6 # e.g. ONLY="22 23" or ONLY="`seq 32 39`" or EXCEPT="31"
10 # bug number for skipped test: 2108
11 ALWAYS_EXCEPT=${ALWAYS_EXCEPT:-""}
12 # UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
14 #2.6.*) ALWAYS_EXCEPT="$ALWAYS_EXCEPT 54c 55" # bug 3117
17 [ "$ALWAYS_EXCEPT$EXCEPT" ] && echo "Skipping tests: $ALWAYS_EXCEPT $EXCEPT"
20 export PATH=$PWD/$SRCDIR:$SRCDIR:$SRCDIR/../utils:$PATH
21 export SECURITY=${SECURITY:-"null"}
24 FSTYPE=${FSTYPE:-ext3}
26 CHECKSTAT=${CHECKSTAT:-"checkstat -v"}
27 CREATETEST=${CREATETEST:-createtest}
29 LSTRIPE=${LSTRIPE:-"$LFS setstripe"}
30 LFIND=${LFIND:-"$LFS find"}
31 LVERIFY=${LVERIFY:-ll_dirstripe_verify}
33 MCREATE=${MCREATE:-mcreate}
34 OPENFILE=${OPENFILE:-openfile}
35 OPENUNLINK=${OPENUNLINK:-openunlink}
36 TOEXCL=${TOEXCL:-toexcl}
37 TRUNCATE=${TRUNCATE:-truncate}
38 MUNLINK=${MUNLINK:-munlink}
39 SOCKETSERVER=${SOCKETSERVER:-socketserver}
40 SOCKETCLIENT=${SOCKETCLIENT:-socketclient}
41 IOPENTEST1=${IOPENTEST1:-iopentest1}
42 IOPENTEST2=${IOPENTEST2:-iopentest2}
43 PTLDEBUG=${PTLDEBUG:-0}
47 if [ $UID -ne 0 ]; then
51 RUNAS_ID=${RUNAS_ID:-500}
52 RUNAS=${RUNAS:-"runas -u $RUNAS_ID"}
55 if [ `using_krb5_sec $SECURITY` == 'y' ] ; then
56 start_krb5_kdc || exit 1
57 if [ $RUNAS_ID -ne $UID ]; then
58 $RUNAS ./krb5_refresh_cache.sh || exit 2
62 export NAME=${NAME:-lmv}
68 sh llmountcleanup.sh > /dev/null || exit 20
75 sh llrmount.sh > /dev/null || exit 10
83 lctl mark "$*" 2> /dev/null || true
88 strace -o $TMP/$1.strace -ttt $*
90 log "FINISHED: $*: rc $RC"
95 check_kernel_version() {
96 VERSION_FILE=/proc/fs/lustre/kernel_version
98 [ ! -f $VERSION_FILE ] && echo "can't find kernel version" && return 1
99 GOT_VER=`cat $VERSION_FILE`
100 [ $GOT_VER -ge $WANT_VER ] && return 0
101 log "test needs at least kernel version $WANT_VER, running $GOT_VER"
106 if ! mount | grep -q $DIR; then
109 echo $PTLDEBUG >/proc/sys/portals/debug
111 export TESTNAME=test_$1
112 test_$1 || error "test_$1: exit with rc=$?"
119 build_test_filter() {
123 for E in $EXCEPT $ALWAYS_EXCEPT; do
124 eval EXCEPT_${E}=true
133 IFS=abcdefghijklmnopqrstuvwxyz _basetest $1
140 if [ ${!testname}x != x ]; then
145 if [ ${!testname}x != x ]; then
153 if [ ${!testname}x != x ]; then
154 echo "skipping excluded test $1"
157 testname=EXCEPT_$base
158 if [ ${!testname}x != x ]; then
159 echo "skipping excluded test $1 (base $base)"
166 [ "$SANITYLOG" ] && rm -f $SANITYLOG || true
170 if [ "$SANITYLOG" ]; then
171 echo "FAIL: $TESTNAME $@" >> $SANITYLOG
181 MOUNT="`mount | awk '/^'$NAME' .* lustre_lite / { print $3 }'`"
182 if [ -z "$MOUNT" ]; then
184 MOUNT="`mount | awk '/^'$NAME' .* lustre_lite / { print $3 }'`"
185 [ -z "$MOUNT" ] && error "NAME=$NAME not mounted"
189 [ `echo $MOUNT | wc -w` -gt 1 ] && error "NAME=$NAME mounted more than once"
192 [ -z "`echo $DIR | grep $MOUNT`" ] && echo "$DIR not in $MOUNT" && exit 99
194 #LOVNAME=`cat /proc/fs/lustre/llite/fs0/lov/common_name`
195 #OSTCOUNT=`cat /proc/fs/lustre/lov/$LOVNAME/numobd`
196 #STRIPECOUNT=`cat /proc/fs/lustre/lov/$LOVNAME/stripecount`
197 #STRIPESIZE=`cat /proc/fs/lustre/lov/$LOVNAME/stripesize`
199 [ -f $DIR/d52a/foo ] && chattr -a $DIR/d52a/foo
200 [ -f $DIR/d52b/foo ] && chattr -i $DIR/d52b/foo
201 rm -rf $DIR/[Rdfs][1-9]*
205 echo preparing for tests involving mounts
206 EXT2_DEV=${EXT2_DEV:-/tmp/SANITY.LOOP}
208 mke2fs -j -F $EXT2_DEV 8000 > /dev/null
211 mkdir $DIR/1a0 || error
212 createmany -o $DIR/1a0/f 4000
213 rmdir $DIR/1a0 && error
214 rm -rf $DIR/1a0 || error
216 run_test 1a " remove splitted dir ============================="
219 mkdir $DIR/1b0 || error
220 createmany -o $DIR/1b0/f 4000
221 find $DIR/1b0 -type f | xargs rm -f
222 NUM=`ls $DIR/1b0 | wc -l`
223 if [ $NUM -ne 0 ] ; then
224 echo "dir must be empty"
232 rmdir $DIR/1b0 && error
236 rmdir $DIR/1b0 && error
240 rmdir $DIR/1b0 && error
244 rmdir $DIR/1b0 || error
246 run_test 1b " remove splitted dir ============================="
249 mkdir $DIR/1b1 || error
250 createmany -o $DIR/1b1/f 4000
251 find $DIR/1b1 -type f | xargs rm -f
252 NUM=`ls $DIR/1b1 | wc -l`
253 if [ $NUM -ne 0 ] ; then
254 echo "dir must be empty"
263 rmdir $DIR/1b1 && error
268 rmdir $DIR/1b1 && error
273 rmdir $DIR/1b1 && error
278 rmdir $DIR/1b1 || error
280 run_test 1c " remove splitted cross-node dir ============================="
283 mkdir $DIR/2a0 || error
284 createmany -o $DIR/2a0/f 5000
285 NUM=`ls $DIR/2a0 | wc -l`
286 echo "found $NUM files"
287 if [ $NUM -ne 5000 ]; then
288 echo "wrong number of files: $NUM"
291 rm -rf $DIR/2a0 || error
293 run_test 2a " list splitted dir ============================="
296 mkdir $DIR/2b1 || error
297 createmany -o $DIR/2b1/f 5000
300 statmany -l $DIR/2b1/f 5000 5000 || error
301 statmany -s $DIR/2b1/f 5000 5000 || error
302 rm -rf $DIR/2b1 || error
304 run_test 2b " list splitted dir after remount ============================="
307 mkdir $DIR/3a0 || error
308 for i in `seq 100`; do
309 mkdir $DIR/3a0/d${i} || error
311 createmany -o $DIR/3a0/f 5000 || error
312 rm -rf $DIR/3a0 || error
314 run_test 3a " dir splitting with cross-ref ============================="
317 mkdir $DIR/3b1 || error
318 createmany -m $DIR/3b1/f 5000 || error
319 rm -rf $DIR/3b1 || error
321 run_test 3b " dir splitting via createmany -m ============================="
324 mkdir $DIR/3c1 || error
325 echo "MDS nodes: $MDSCOUNT"
327 for i in `seq 10`; do
328 $LFS dirstripe $DIR/3c1/d-${j}-${i} $j || error
329 createmany -m $DIR/3c1/d-${j}-${i}/m 200 || error
330 createmany -o $DIR/3c1/d-${j}-${i}/o 200 || error
333 rm -rf $DIR/3c1 || error
336 run_test 3c " dir splitting via lfs stripe ============================="
340 while let "rr < 33000"; do
341 if let "rr % 2000 == 0"; then
344 mkdir $DIR/4a1 || error
350 ## this test is very time-consuming, don't run it by default
351 #run_test 4a " FIDS/ nlink overflow test ============================="
358 log "cleanup: ======================================================"
359 if [ "`mount | grep ^$NAME`" ]; then
360 rm -rf $DIR/[Rdfs][1-9]*
361 if [ "$I_MOUNTED" = "yes" ]; then
362 sh llmountcleanup.sh || error
366 echo '=========================== finished ==============================='
367 [ -f "$SANITYLOG" ] && cat $SANITYLOG && exit 1 || true