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 export NAME=${NAME:-lmv}
53 sh llmountcleanup.sh > /dev/null || exit 20
60 sh llrmount.sh > /dev/null || exit 10
68 lctl mark "$*" 2> /dev/null || true
73 strace -o $TMP/$1.strace -ttt $*
75 log "FINISHED: $*: rc $RC"
80 check_kernel_version() {
81 VERSION_FILE=/proc/fs/lustre/kernel_version
83 [ ! -f $VERSION_FILE ] && echo "can't find kernel version" && return 1
84 GOT_VER=`cat $VERSION_FILE`
85 [ $GOT_VER -ge $WANT_VER ] && return 0
86 log "test needs at least kernel version $WANT_VER, running $GOT_VER"
91 if ! cat /proc/mounts | grep -q $DIR; then
94 echo $PTLDEBUG >/proc/sys/portals/debug
96 export TESTNAME=test_$1
97 test_$1 || error "test_$1: exit with rc=$?"
104 build_test_filter() {
108 for E in $EXCEPT $ALWAYS_EXCEPT; do
109 eval EXCEPT_${E}=true
118 IFS=abcdefghijklmnopqrstuvwxyz _basetest $1
125 if [ ${!testname}x != x ]; then
130 if [ ${!testname}x != x ]; then
138 if [ ${!testname}x != x ]; then
139 echo "skipping excluded test $1"
142 testname=EXCEPT_$base
143 if [ ${!testname}x != x ]; then
144 echo "skipping excluded test $1 (base $base)"
151 [ "$SANITYLOG" ] && rm -f $SANITYLOG || true
155 if [ "$SANITYLOG" ]; then
156 echo "FAIL: $TESTNAME $@" >> $SANITYLOG
166 MOUNT="`mount | awk '/^'$NAME' .* lustre_lite / { print $3 }'`"
167 if [ -z "$MOUNT" ]; then
169 MOUNT="`mount | awk '/^'$NAME' .* lustre_lite / { print $3 }'`"
170 [ -z "$MOUNT" ] && error "NAME=$NAME not mounted"
174 [ `echo $MOUNT | wc -w` -gt 1 ] && error "NAME=$NAME mounted more than once"
177 [ -z "`echo $DIR | grep $MOUNT`" ] && echo "$DIR not in $MOUNT" && exit 99
179 #LOVNAME=`cat /proc/fs/lustre/llite/fs0/lov/common_name`
180 #OSTCOUNT=`cat /proc/fs/lustre/lov/$LOVNAME/numobd`
181 #STRIPECOUNT=`cat /proc/fs/lustre/lov/$LOVNAME/stripecount`
182 #STRIPESIZE=`cat /proc/fs/lustre/lov/$LOVNAME/stripesize`
184 [ -f $DIR/d52a/foo ] && chattr -a $DIR/d52a/foo
185 [ -f $DIR/d52b/foo ] && chattr -i $DIR/d52b/foo
186 rm -rf $DIR/[Rdfs][1-9]*
190 echo preparing for tests involving mounts
191 EXT2_DEV=${EXT2_DEV:-/tmp/SANITY.LOOP}
193 mke2fs -j -F $EXT2_DEV 8000 > /dev/null
196 mkdir $DIR/1a0 || error
197 createmany -o $DIR/1a0/f 4000
198 rmdir $DIR/1a0 && error
199 rm -rf $DIR/1a0 || error
201 run_test 1a " remove splitted dir ============================="
204 mkdir $DIR/1b0 || error
205 createmany -o $DIR/1b0/f 4000
206 find $DIR/1b0 -type f | xargs rm -f
207 NUM=`ls $DIR/1b0 | wc -l`
208 if [ $NUM -ne 0 ] ; then
209 echo "dir must be empty"
217 rmdir $DIR/1b0 && error
221 rmdir $DIR/1b0 && error
225 rmdir $DIR/1b0 && error
229 rmdir $DIR/1b0 || error
231 run_test 1b " remove splitted dir ============================="
234 mkdir $DIR/1b1 || error
235 createmany -o $DIR/1b1/f 4000
236 find $DIR/1b1 -type f | xargs rm -f
237 NUM=`ls $DIR/1b1 | wc -l`
238 if [ $NUM -ne 0 ] ; then
239 echo "dir must be empty"
248 rmdir $DIR/1b1 && error
253 rmdir $DIR/1b1 && error
258 rmdir $DIR/1b1 && error
263 rmdir $DIR/1b1 || error
265 run_test 1c " remove splitted cross-node dir ============================="
268 mkdir $DIR/2a0 || error
269 createmany -o $DIR/2a0/f 5000
270 NUM=`ls $DIR/2a0 | wc -l`
271 echo "found $NUM files"
272 if [ $NUM -ne 5000 ]; then
273 echo "wrong number of files: $NUM"
276 rm -rf $DIR/2a0 || error
278 run_test 2a " list splitted dir ============================="
281 mkdir $DIR/2b1 || error
282 createmany -o $DIR/2b1/f 5000
285 statmany -l $DIR/2b1/f 5000 5000 || error
286 statmany -s $DIR/2b1/f 5000 5000 || error
287 rm -rf $DIR/2b1 || error
289 run_test 2b " list splitted dir after remount ============================="
292 mkdir $DIR/3a0 || error
293 for i in `seq 100`; do
294 mkdir $DIR/3a0/d${i} || error
296 createmany -o $DIR/3a0/f 5000 || error
297 rm -rf $DIR/3a0 || error
299 run_test 3a " dir splitting with cross-ref ============================="
302 mkdir $DIR/3b1 || error
303 createmany -m $DIR/3b1/f 5000 || error
304 rm -rf $DIR/3b1 || error
306 run_test 3b " dir splitting via createmany -m ============================="
309 mkdir $DIR/3c1 || error
310 echo "MDS nodes: $MDSCOUNT"
312 for i in `seq 10`; do
313 $LFS dirstripe $DIR/3c1/d-${j}-${i} $j || error
314 createmany -m $DIR/3c1/d-${j}-${i}/m 200 || error
315 createmany -o $DIR/3c1/d-${j}-${i}/o 200 || error
318 rm -rf $DIR/3c1 || error
321 run_test 3c " dir splitting via lfs stripe ============================="
325 while let "rr < 33000"; do
326 if let "rr % 2000 == 0"; then
329 mkdir $DIR/4a1 || error
335 ## this test is very time-consuming, don't run it by default
336 #run_test 4a " FIDS/ nlink overflow test ============================="
343 log "cleanup: ======================================================"
344 if [ "`mount | grep ^$NAME`" ]; then
345 rm -rf $DIR/[Rdfs][1-9]*
346 if [ "$I_MOUNTED" = "yes" ]; then
347 sh llmountcleanup.sh || error
351 echo '=========================== finished ==============================='
352 [ -f "$SANITYLOG" ] && cat $SANITYLOG && exit 1 || true