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
19 FSTYPE=${FSTYPE:-ext3}
21 CHECKSTAT=${CHECKSTAT:-"checkstat -v"}
22 CREATETEST=${CREATETEST:-createtest}
24 LSTRIPE=${LSTRIPE:-"$LFS setstripe"}
25 LFIND=${LFIND:-"$LFS find"}
26 LVERIFY=${LVERIFY:-ll_dirstripe_verify}
28 MCREATE=${MCREATE:-mcreate}
29 OPENFILE=${OPENFILE:-openfile}
30 OPENUNLINK=${OPENUNLINK:-openunlink}
31 TOEXCL=${TOEXCL:-toexcl}
32 TRUNCATE=${TRUNCATE:-truncate}
33 MUNLINK=${MUNLINK:-munlink}
34 SOCKETSERVER=${SOCKETSERVER:-socketserver}
35 SOCKETCLIENT=${SOCKETCLIENT:-socketclient}
36 IOPENTEST1=${IOPENTEST1:-iopentest1}
37 IOPENTEST2=${IOPENTEST2:-iopentest2}
39 if [ $UID -ne 0 ]; then
43 RUNAS_ID=${RUNAS_ID:-500}
44 RUNAS=${RUNAS:-"runas -u $RUNAS_ID"}
47 export NAME=${NAME:-local}
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 ! mount | grep -q $DIR; then
94 echo -1 >/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 OSTCOUNT=`cat /proc/fs/lustre/llite/fs0/lov/numobd`
180 STRIPECOUNT=`cat /proc/fs/lustre/llite/fs0/lov/stripecount`
181 STRIPESIZE=`cat /proc/fs/lustre/llite/fs0/lov/stripesize`
187 $CHECKSTAT -t file $DIR/f || error
189 $CHECKSTAT -a $DIR/f || error
191 run_test 0 "touch .../f ; rm .../f ============================="
209 mdsnum=`mdsdevice|awk ' $3=="mds" {print $1}'`
210 if [ ! -z "$mdsnum" ];then
211 mynid=`mynidstr|awk '{print $4}'`
212 mkdir $DIR/test_0a_dir1
213 touch $DIR/test_0a_file1
214 ln -s $DIR/test_0a_file1 $DIR/test_0a_filelink1
222 mkdir $DIR/test_0a_dir2
223 touch $DIR/test_0a_file2
224 ln -s $DIR/test_0a_file2 $DIR/test_0a_filelink2
225 $CHECKSTAT -t dir -u 500 $DIR/test_0a_dir2 || error
226 $CHECKSTAT -t file -u 500 $DIR/test_0a_file2 || error
227 $CHECKSTAT -t link -u 500 $DIR/test_0a_filelink2 || error
230 root_squash 500:500 $mynid
234 mkdir $DIR/test_0a_dir3
235 touch $DIR/test_0a_file3
236 ln -s $DIR/test_0a_file3 $DIR/test_0a_filelink3
237 $CHECKSTAT -t dir -u root $DIR/test_0a_dir3 || error
238 $CHECKSTAT -t file -u root $DIR/test_0a_file3 || error
239 $CHECKSTAT -t link -u root $DIR/test_0a_filelink3 || error
242 root_squash root:root
246 mkdir $DIR/test_0a_dir4
247 touch $DIR/test_0a_file4
248 ln -s $DIR/test_0a_file4 $DIR/test_0a_filelink4
249 $CHECKSTAT -t dir -u root $DIR/test_0a_dir4 || error
250 $CHECKSTAT -t file -u root $DIR/test_0a_file4 || error
251 $CHECKSTAT -t link -u root $DIR/test_0a_filelink4 || error
257 run_test 1 "test root_squash ============================"
263 log "cleanup: ======================================================"
264 if [ "`mount | grep ^$NAME`" ]; then
265 rm -rf $DIR/[Rdfs][1-9]*
266 if [ "$I_MOUNTED" = "yes" ]; then
267 sh llmountcleanup.sh || error
271 echo '=========================== finished ==============================='
272 [ -f "$SANITYLOG" ] && cat $SANITYLOG && exit 1 || true