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 ALWAYS_EXCEPT=${ALWAYS_EXCEPT:-""}
11 # UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
13 [ "$ALWAYS_EXCEPT$EXCEPT" ] && echo "Skipping tests: $ALWAYS_EXCEPT $EXCEPT"
16 export PATH=$PWD/$SRCDIR:$SRCDIR:$SRCDIR/../utils:$PATH
17 export SECURITY=${SECURITY:-"null"}
20 FSTYPE=${FSTYPE:-ext3}
22 CHECKSTAT=${CHECKSTAT:-"checkstat -v"}
23 CREATETEST=${CREATETEST:-createtest}
25 LSTRIPE=${LSTRIPE:-"$LFS setstripe"}
26 LFIND=${LFIND:-"$LFS find"}
27 LVERIFY=${LVERIFY:-ll_dirstripe_verify}
29 MCREATE=${MCREATE:-mcreate}
30 OPENFILE=${OPENFILE:-openfile}
31 OPENUNLINK=${OPENUNLINK:-openunlink}
32 TOEXCL=${TOEXCL:-toexcl}
33 TRUNCATE=${TRUNCATE:-truncate}
34 MUNLINK=${MUNLINK:-munlink}
35 SOCKETSERVER=${SOCKETSERVER:-socketserver}
36 SOCKETCLIENT=${SOCKETCLIENT:-socketclient}
37 IOPENTEST1=${IOPENTEST1:-iopentest1}
38 IOPENTEST2=${IOPENTEST2:-iopentest2}
42 if [ $UID -ne 0 ]; then
46 RUNAS_ID=${RUNAS_ID:-500}
47 RUNAS=${RUNAS:-"runas -u $RUNAS_ID"}
50 if [ `using_krb5_sec $SECURITY` == 'y' ] ; then
51 start_krb5_kdc || exit 1
52 if [ $RUNAS_ID -ne $UID ]; then
53 $RUNAS ./krb5_refresh_cache.sh || exit 2
57 export NAME=${NAME:-local}
63 sh llmountcleanup.sh > /dev/null || exit 20
70 sh llrmount.sh > /dev/null || exit 10
78 lctl mark "$*" 2> /dev/null || true
83 strace -o $TMP/$1.strace -ttt $*
85 log "FINISHED: $*: rc $RC"
90 check_kernel_version() {
91 VERSION_FILE=/proc/fs/lustre/kernel_version
93 [ ! -f $VERSION_FILE ] && echo "can't find kernel version" && return 1
94 GOT_VER=`cat $VERSION_FILE`
95 [ $GOT_VER -ge $WANT_VER ] && return 0
96 log "test needs at least kernel version $WANT_VER, running $GOT_VER"
101 if ! cat /proc/mounts | grep -q $DIR; then
104 echo -1 >/proc/sys/portals/debug
106 export TESTNAME=test_$1
107 test_$1 || error "test_$1: exit with rc=$?"
114 build_test_filter() {
118 for E in $EXCEPT $ALWAYS_EXCEPT; do
119 eval EXCEPT_${E}=true
128 IFS=abcdefghijklmnopqrstuvwxyz _basetest $1
135 if [ ${!testname}x != x ]; then
140 if [ ${!testname}x != x ]; then
148 if [ ${!testname}x != x ]; then
149 echo "skipping excluded test $1"
152 testname=EXCEPT_$base
153 if [ ${!testname}x != x ]; then
154 echo "skipping excluded test $1 (base $base)"
161 [ "$SANITYLOG" ] && rm -f $SANITYLOG || true
165 if [ "$SANITYLOG" ]; then
166 echo "FAIL: $TESTNAME $@" >> $SANITYLOG
176 MOUNT="`mount | awk '/^'$NAME' .* lustre_lite / { print $3 }'`"
177 if [ -z "$MOUNT" ]; then
179 MOUNT="`mount | awk '/^'$NAME' .* lustre_lite / { print $3 }'`"
180 [ -z "$MOUNT" ] && error "NAME=$NAME not mounted"
184 [ `echo $MOUNT | wc -w` -gt 1 ] && error "NAME=$NAME mounted more than once"
187 [ -z "`echo $DIR | grep $MOUNT`" ] && echo "$DIR not in $MOUNT" && exit 99
189 OSTCOUNT=`cat /proc/fs/lustre/llite/fs0/lov/numobd`
190 STRIPECOUNT=`cat /proc/fs/lustre/llite/fs0/lov/stripecount`
191 STRIPESIZE=`cat /proc/fs/lustre/llite/fs0/lov/stripesize`
197 $CHECKSTAT -t file $DIR/f || error
199 $CHECKSTAT -a $DIR/f || error
201 run_test 0 "touch .../f ; rm .../f ============================="
219 mdsnum=`mdsdevice|awk ' $3=="mds" {print $1}'`
220 if [ ! -z "$mdsnum" ];then
221 mynid=`mynidstr|awk '{print $4}'`
222 mkdir $DIR/test_0a_dir1
223 touch $DIR/test_0a_file1
224 ln -s $DIR/test_0a_file1 $DIR/test_0a_filelink1
232 mkdir $DIR/test_0a_dir2
233 touch $DIR/test_0a_file2
234 ln -s $DIR/test_0a_file2 $DIR/test_0a_filelink2
235 $CHECKSTAT -t dir -u 500 $DIR/test_0a_dir2 || error
236 $CHECKSTAT -t file -u 500 $DIR/test_0a_file2 || error
237 $CHECKSTAT -t link -u 500 $DIR/test_0a_filelink2 || error
240 root_squash 500:500 $mynid
244 mkdir $DIR/test_0a_dir3
245 touch $DIR/test_0a_file3
246 ln -s $DIR/test_0a_file3 $DIR/test_0a_filelink3
247 $CHECKSTAT -t dir -u root $DIR/test_0a_dir3 || error
248 $CHECKSTAT -t file -u root $DIR/test_0a_file3 || error
249 $CHECKSTAT -t link -u root $DIR/test_0a_filelink3 || error
252 root_squash root:root
256 mkdir $DIR/test_0a_dir4
257 touch $DIR/test_0a_file4
258 ln -s $DIR/test_0a_file4 $DIR/test_0a_filelink4
259 $CHECKSTAT -t dir -u root $DIR/test_0a_dir4 || error
260 $CHECKSTAT -t file -u root $DIR/test_0a_file4 || error
261 $CHECKSTAT -t link -u root $DIR/test_0a_filelink4 || error
267 run_test 1 "test root_squash ============================"
273 setfattr -n trusted.name1 -v value1 $DIR/f2 || error
274 [ "`getfattr -n trusted.name1 $DIR/f2 2> /dev/null | \
275 grep "trusted.name1"`" == "trusted.name1=\"value1\"" ] || error
277 setfattr -n user.author1 -v author1 $DIR/f2 || error
278 [ "`getfattr -n user.author1 $DIR/f2 2> /dev/null | \
279 grep "user.author1"`" == "user.author1=\"author1\"" ] || error
282 setfattr -n trusted.name2 -v value2 $DIR/f2 || error
283 setfattr -n trusted.name3 -v value3 $DIR/f2 || error
284 [ `getfattr -d -m "^trusted" $DIR/f2 2> /dev/null | \
285 grep "trusted" | wc -l` -eq 5 ] || error
288 setfattr -n user.author2 -v author2 $DIR/f2 || error
289 setfattr -n user.author3 -v author3 $DIR/f2 || error
290 [ `getfattr -d -m "^user" $DIR/f2 2> /dev/null | \
291 grep "user" | wc -l` -eq 3 ] || error
293 setfattr -x trusted.name1 $DIR/f2 2> /dev/null || error
294 getfattr -d -m trusted $DIR/f2 2> /dev/null | \
295 grep "trusted.name1" && error || true
297 setfattr -x user.author1 $DIR/f2 2> /dev/null || error
298 getfattr -d -m user $DIR/f2 2> /dev/null | \
299 grep "user.author1" && error || true
301 run_test 2 "set/get xattr test (trusted xattr only) ============"
305 $SAVE_PWD/acl/run $SAVE_PWD/acl/$1.test
313 run_acl_subtest cp || return 1
314 run_acl_subtest getfacl-noacl || return 2
315 run_acl_subtest misc || return 3
316 run_acl_subtest permissions || return 4
317 run_acl_subtest setfacl || return 5
322 run_test 3 "==============acl test ============="
328 log "cleanup: ======================================================"
329 if [ "`mount | grep ^$NAME`" ]; then
330 rm -rf $DIR/[Rdfs][1-9]*
331 if [ "$I_MOUNTED" = "yes" ]; then
332 sh llmountcleanup.sh || error
336 echo '=========================== finished ==============================='
337 [ -f "$SANITYLOG" ] && cat $SANITYLOG && exit 1 || true