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
23 FSTYPE=${FSTYPE:-ext3}
25 CHECKSTAT=${CHECKSTAT:-"checkstat -v"}
26 CREATETEST=${CREATETEST:-createtest}
28 LSTRIPE=${LSTRIPE:-"$LFS setstripe"}
29 LFIND=${LFIND:-"$LFS find"}
30 LVERIFY=${LVERIFY:-ll_dirstripe_verify}
32 MCREATE=${MCREATE:-mcreate}
33 OPENFILE=${OPENFILE:-openfile}
34 OPENUNLINK=${OPENUNLINK:-openunlink}
35 TOEXCL=${TOEXCL:-toexcl}
36 TRUNCATE=${TRUNCATE:-truncate}
37 MUNLINK=${MUNLINK:-munlink}
38 SOCKETSERVER=${SOCKETSERVER:-socketserver}
39 SOCKETCLIENT=${SOCKETCLIENT:-socketclient}
40 IOPENTEST1=${IOPENTEST1:-iopentest1}
41 IOPENTEST2=${IOPENTEST2:-iopentest2}
42 PTLDEBUG=${PTLDEBUG:-0}
44 if [ $UID -ne 0 ]; then
48 RUNAS_ID=${RUNAS_ID:-500}
49 RUNAS=${RUNAS:-"runas -u $RUNAS_ID"}
52 export NAME=${NAME:-lmv}
58 sh llmountcleanup.sh > /dev/null || exit 20
65 sh llrmount.sh > /dev/null || exit 10
73 lctl mark "$*" 2> /dev/null || true
78 strace -o $TMP/$1.strace -ttt $*
80 log "FINISHED: $*: rc $RC"
85 check_kernel_version() {
86 VERSION_FILE=/proc/fs/lustre/kernel_version
88 [ ! -f $VERSION_FILE ] && echo "can't find kernel version" && return 1
89 GOT_VER=`cat $VERSION_FILE`
90 [ $GOT_VER -ge $WANT_VER ] && return 0
91 log "test needs at least kernel version $WANT_VER, running $GOT_VER"
96 if ! mount | grep -q $DIR; then
99 echo $PTLDEBUG >/proc/sys/portals/debug
101 export TESTNAME=test_$1
102 test_$1 || error "test_$1: exit with rc=$?"
109 build_test_filter() {
113 for E in $EXCEPT $ALWAYS_EXCEPT; do
114 eval EXCEPT_${E}=true
123 IFS=abcdefghijklmnopqrstuvwxyz _basetest $1
130 if [ ${!testname}x != x ]; then
135 if [ ${!testname}x != x ]; then
143 if [ ${!testname}x != x ]; then
144 echo "skipping excluded test $1"
147 testname=EXCEPT_$base
148 if [ ${!testname}x != x ]; then
149 echo "skipping excluded test $1 (base $base)"
156 [ "$SANITYLOG" ] && rm -f $SANITYLOG || true
160 if [ "$SANITYLOG" ]; then
161 echo "FAIL: $TESTNAME $@" >> $SANITYLOG
171 MOUNT="`mount | awk '/^'$NAME' .* lustre_lite / { print $3 }'`"
172 if [ -z "$MOUNT" ]; then
174 MOUNT="`mount | awk '/^'$NAME' .* lustre_lite / { print $3 }'`"
175 [ -z "$MOUNT" ] && error "NAME=$NAME not mounted"
179 [ `echo $MOUNT | wc -w` -gt 1 ] && error "NAME=$NAME mounted more than once"
182 [ -z "`echo $DIR | grep $MOUNT`" ] && echo "$DIR not in $MOUNT" && exit 99
184 LOVNAME=`cat /proc/fs/lustre/llite/fs0/lov/common_name`
185 OSTCOUNT=`cat /proc/fs/lustre/lov/$LOVNAME/numobd`
186 STRIPECOUNT=`cat /proc/fs/lustre/lov/$LOVNAME/stripecount`
187 STRIPESIZE=`cat /proc/fs/lustre/lov/$LOVNAME/stripesize`
189 [ -f $DIR/d52a/foo ] && chattr -a $DIR/d52a/foo
190 [ -f $DIR/d52b/foo ] && chattr -i $DIR/d52b/foo
191 rm -rf $DIR/[Rdfs][1-9]*
195 echo preparing for tests involving mounts
196 EXT2_DEV=${EXT2_DEV:-/tmp/SANITY.LOOP}
198 mke2fs -j -F $EXT2_DEV 8000 > /dev/null
201 mkdir $DIR/1a0 || error
202 createmany -o $DIR/1a0/f 4000
203 rmdir $DIR/1a0 && error
204 rm -rf $DIR/1a0 || error
206 run_test 1a " remove splitted dir ============================="
209 mkdir $DIR/1b0 || error
210 createmany -o $DIR/1b0/f 4000
211 find $DIR/1b0 -type f | xargs rm -f
212 NUM=`ls $DIR/1b0 | wc -l`
213 if [ $NUM -ne 0 ] ; then
214 echo "dir must be empty"
222 rmdir $DIR/1b0 && error
226 rmdir $DIR/1b0 && error
230 rmdir $DIR/1b0 && error
234 rmdir $DIR/1b0 || error
236 run_test 1b " remove splitted dir ============================="
239 mkdir $DIR/1b1 || error
240 createmany -o $DIR/1b1/f 4000
241 find $DIR/1b1 -type f | xargs rm -f
242 NUM=`ls $DIR/1b1 | wc -l`
243 if [ $NUM -ne 0 ] ; then
244 echo "dir must be empty"
252 rmdir $DIR/1b1 && error
256 rmdir $DIR/1b1 && error
260 rmdir $DIR/1b1 && error
264 rmdir $DIR/1b1 || error
266 run_test 1c " remove splitted cross-node dir ============================="
269 mkdir $DIR/2a0 || error
270 createmany -o $DIR/2a0/f 5000
271 NUM=`ls $DIR/2a0 | wc -l`
272 echo "found $NUM files"
273 if [ $NUM -ne 5000 ]; then
274 echo "wrong number of files: $NUM"
277 rm -rf $DIR/2a0 || error
279 run_test 2a " list splitted dir ============================="
282 mkdir $DIR/2b1 || error
283 createmany -o $DIR/2b1/f 5000
286 statmany -l $DIR/2b1/f 5000 5000 || error
287 statmany -s $DIR/2b1/f 5000 5000 || error
288 rm -rf $DIR/2b1 || error
290 run_test 2b " list splitted dir after remount ============================="
293 mkdir $DIR/3a0 || error
294 for i in `seq 100`; do
295 mkdir $DIR/3a0/d${i} || error
297 createmany -o $DIR/3a0/f 5000 || error
298 rm -rf $DIR/3a0 || error
300 run_test 3a " dir splitting with cross-ref ============================="
303 mkdir $DIR/3b1 || error
304 createmany -m $DIR/3b1/f 5000 || error
305 rm -rf $DIR/3b1 || error
307 run_test 3b " dir splitting via createmany -m ============================="
310 mkdir $DIR/3c1 || error
311 echo "MDS nodes: $MDSCOUNT"
313 for i in `seq 10`; do
314 $LFS dirstripe $DIR/3c1/d-${j}-${i} $j || error
315 createmany -m $DIR/3c1/d-${j}-${i}/m 200 || error
316 createmany -o $DIR/3c1/d-${j}-${i}/o 200 || error
319 rm -rf $DIR/3c1 || error
322 run_test 3c " dir splitting via lfs stripe ============================="
326 while let "rr < 33000"; do
327 if let "rr % 2000 == 0"; then
330 mkdir $DIR/4a1 || error
336 ## this test is very time-consuming, don't run it by default
337 #run_test 4a " FIDS/ nlink overflow test ============================="
344 log "cleanup: ======================================================"
345 if [ "`mount | grep ^$NAME`" ]; then
346 rm -rf $DIR/[Rdfs][1-9]*
347 if [ "$I_MOUNTED" = "yes" ]; then
348 sh llmountcleanup.sh || error
352 echo '=========================== finished ==============================='
353 [ -f "$SANITYLOG" ] && cat $SANITYLOG && exit 1 || true