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}
43 if [ $UID -ne 0 ]; then
47 RUNAS_ID=${RUNAS_ID:-500}
48 RUNAS=${RUNAS:-"runas -u $RUNAS_ID"}
51 export NAME=${NAME:-lmv}
57 sh llmountcleanup.sh > /dev/null || exit 20
64 sh llrmount.sh > /dev/null || exit 10
72 lctl mark "$*" 2> /dev/null || true
77 strace -o $TMP/$1.strace -ttt $*
79 log "FINISHED: $*: rc $RC"
84 check_kernel_version() {
85 VERSION_FILE=/proc/fs/lustre/kernel_version
87 [ ! -f $VERSION_FILE ] && echo "can't find kernel version" && return 1
88 GOT_VER=`cat $VERSION_FILE`
89 [ $GOT_VER -ge $WANT_VER ] && return 0
90 log "test needs at least kernel version $WANT_VER, running $GOT_VER"
95 if ! mount | grep -q $DIR; then
98 echo -1 >/proc/sys/portals/debug
100 export TESTNAME=test_$1
101 test_$1 || error "test_$1: exit with rc=$?"
108 build_test_filter() {
112 for E in $EXCEPT $ALWAYS_EXCEPT; do
113 eval EXCEPT_${E}=true
122 IFS=abcdefghijklmnopqrstuvwxyz _basetest $1
129 if [ ${!testname}x != x ]; then
134 if [ ${!testname}x != x ]; then
142 if [ ${!testname}x != x ]; then
143 echo "skipping excluded test $1"
146 testname=EXCEPT_$base
147 if [ ${!testname}x != x ]; then
148 echo "skipping excluded test $1 (base $base)"
155 [ "$SANITYLOG" ] && rm -f $SANITYLOG || true
159 if [ "$SANITYLOG" ]; then
160 echo "FAIL: $TESTNAME $@" >> $SANITYLOG
170 MOUNT="`mount | awk '/^'$NAME' .* lustre_lite / { print $3 }'`"
171 if [ -z "$MOUNT" ]; then
173 MOUNT="`mount | awk '/^'$NAME' .* lustre_lite / { print $3 }'`"
174 [ -z "$MOUNT" ] && error "NAME=$NAME not mounted"
178 [ `echo $MOUNT | wc -w` -gt 1 ] && error "NAME=$NAME mounted more than once"
181 [ -z "`echo $DIR | grep $MOUNT`" ] && echo "$DIR not in $MOUNT" && exit 99
183 LOVNAME=`cat /proc/fs/lustre/llite/fs0/lov/common_name`
184 OSTCOUNT=`cat /proc/fs/lustre/lov/$LOVNAME/numobd`
185 STRIPECOUNT=`cat /proc/fs/lustre/lov/$LOVNAME/stripecount`
186 STRIPESIZE=`cat /proc/fs/lustre/lov/$LOVNAME/stripesize`
188 [ -f $DIR/d52a/foo ] && chattr -a $DIR/d52a/foo
189 [ -f $DIR/d52b/foo ] && chattr -i $DIR/d52b/foo
190 rm -rf $DIR/[Rdfs][1-9]*
194 echo preparing for tests involving mounts
195 EXT2_DEV=${EXT2_DEV:-/tmp/SANITY.LOOP}
197 mke2fs -j -F $EXT2_DEV 8000 > /dev/null
200 mkdir $DIR/1a0 || error
201 createmany -o $DIR/1a0/f 4000
202 rmdir $DIR/1a0 && error
203 rm -rf $DIR/1a0 || error
205 run_test 1a " remove splitted dir ============================="
208 mkdir $DIR/1b0 || error
209 createmany -o $DIR/1b0/f 4000
210 find $DIR/1b0 -type f | xargs rm -f
211 NUM=`ls $DIR/1b0 | wc -l`
212 if [ $NUM -ne 0 ] ; then
213 echo "dir must be empty"
221 rmdir $DIR/1b0 && error
225 rmdir $DIR/1b0 && error
229 rmdir $DIR/1b0 && error
233 rmdir $DIR/1b0 || error
235 run_test 1b " remove splitted dir ============================="
238 mkdir $DIR/1b1 || error
239 createmany -o $DIR/1b1/f 4000
240 find $DIR/1b1 -type f | xargs rm -f
241 NUM=`ls $DIR/1b1 | wc -l`
242 if [ $NUM -ne 0 ] ; then
243 echo "dir must be empty"
251 rmdir $DIR/1b1 && error
255 rmdir $DIR/1b1 && error
259 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 ============================="
284 log "cleanup: ======================================================"
285 if [ "`mount | grep ^$NAME`" ]; then
286 rm -rf $DIR/[Rdfs][1-9]*
287 if [ "$I_MOUNTED" = "yes" ]; then
288 sh llmountcleanup.sh || error
292 echo '=========================== finished ==============================='
293 [ -f "$SANITYLOG" ] && cat $SANITYLOG && exit 1 || true