5 # bug number for skipped test:
6 ALWAYS_EXCEPT=${ALWAYS_EXCEPT:-""}
7 # UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
9 [ "$ALWAYS_EXCEPT$EXCEPT" ] && echo "Skipping tests: $ALWAYS_EXCEPT $EXCEPT"
12 export PATH=$PWD/$SRCDIR:$SRCDIR:$SRCDIR/../utils:$PATH
15 FSTYPE=${FSTYPE:-ext3}
17 CHECKSTAT=${CHECKSTAT:-"checkstat -v"}
18 CREATETEST=${CREATETEST:-createtest}
20 LSTRIPE=${LSTRIPE:-"$LFS setstripe"}
21 LFIND=${LFIND:-"$LFS find"}
22 LVERIFY=${LVERIFY:-ll_dirstripe_verify}
24 MCREATE=${MCREATE:-mcreate}
25 OPENFILE=${OPENFILE:-openfile}
26 OPENUNLINK=${OPENUNLINK:-openunlink}
27 TOEXCL=${TOEXCL:-toexcl}
28 TRUNCATE=${TRUNCATE:-truncate}
29 MUNLINK=${MUNLINK:-munlink}
30 SOCKETSERVER=${SOCKETSERVER:-socketserver}
31 SOCKETCLIENT=${SOCKETCLIENT:-socketclient}
32 IOPENTEST1=${IOPENTEST1:-iopentest1}
33 IOPENTEST2=${IOPENTEST2:-iopentest2}
34 PTLDEBUG=${PTLDEBUG:-0}
37 if [ $UID -ne 0 ]; then
41 RUNAS_ID=${RUNAS_ID:-500}
42 RUNAS=${RUNAS:-"runas -u $RUNAS_ID"}
45 export NAME=${NAME:-local}
51 sh llmountcleanup.sh > /dev/null || exit 20
58 sh llrmount.sh > /dev/null || exit 10
66 lctl mark "$*" 2> /dev/null || true
71 strace -o $TMP/$1.strace -ttt $*
73 log "FINISHED: $*: rc $RC"
78 check_kernel_version() {
79 VERSION_FILE=/proc/fs/lustre/kernel_version
81 [ ! -f $VERSION_FILE ] && echo "can't find kernel version" && return 1
82 GOT_VER=`cat $VERSION_FILE`
83 [ $GOT_VER -ge $WANT_VER ] && return 0
84 log "test needs at least kernel version $WANT_VER, running $GOT_VER"
89 if ! mount | grep -q $DIR; then
92 echo $PTLDEBUG >/proc/sys/portals/debug
94 export TESTNAME=test_$1
95 test_$1 || error "test_$1: exit with rc=$?"
102 build_test_filter() {
106 for E in $EXCEPT $ALWAYS_EXCEPT; do
107 eval EXCEPT_${E}=true
116 IFS=abcdefghijklmnopqrstuvwxyz _basetest $1
123 if [ ${!testname}x != x ]; then
128 if [ ${!testname}x != x ]; then
136 if [ ${!testname}x != x ]; then
137 echo "skipping excluded test $1"
140 testname=EXCEPT_$base
141 if [ ${!testname}x != x ]; then
142 echo "skipping excluded test $1 (base $base)"
149 [ "$SANITYLOG" ] && rm -f $SANITYLOG || true
153 if [ "$SANITYLOG" ]; then
154 echo "FAIL: $TESTNAME $@" >> $SANITYLOG
164 MOUNT="`mount | awk '/^'$NAME' .* lustre_lite / { print $3 }'`"
165 if [ -z "$MOUNT" ]; then
167 MOUNT="`mount | awk '/^'$NAME' .* lustre_lite / { print $3 }'`"
168 [ -z "$MOUNT" ] && error "NAME=$NAME not mounted"
172 [ `echo $MOUNT | wc -w` -gt 1 ] && error "NAME=$NAME mounted more than once"
175 [ -z "`echo $DIR | grep $MOUNT`" ] && echo "$DIR not in $MOUNT" && exit 99
177 rm -rf $DIR/[Rdfs][1-9]*
181 echo preparing for tests involving mounts
182 EXT2_DEV=${EXT2_DEV:-/tmp/SANITY.LOOP}
184 mke2fs -j -F $EXT2_DEV 8000 > /dev/null
187 rm -fr $DIR/1a0 > /dev/null
188 MDS=`find /proc/fs/lustre/mds/* -type d | head -n1 | sed 's/.*\///'`
190 echo "no MDS available, skipping test"
193 count=`find /proc/fs/lustre/mds/* -type d | wc -l`
194 [ $count -gt 1 ] && {
195 echo "more than 1 MDS is found, skipping test"
199 mkdir $DIR/1a0 || error
200 old_last_fid=`cat /proc/fs/lustre/mds/$MDS/last_fid`
201 createmany -o $DIR/1a0/f 5000
202 new_last_fid=`cat /proc/fs/lustre/mds/$MDS/last_fid`
204 diff=$(($new_last_fid-$old_last_fid))
205 [ $diff -ne 5000 ] && {
206 echo "invalid fid management on $MDS: \
207 old $old_last_fid, new $new_last_fid"
210 rm -fr $DIR/1a0 || error
212 run_test 1a " fid managing correctness ============="
215 rm -fr $DIR/1b0 > /dev/null
216 MDS=`find /proc/fs/lustre/mds/* -type d | head -n1 | sed 's/.*\///'`
218 echo "no MDS available, skipping test"
221 count=`find /proc/fs/lustre/mds/* -type d | wc -l`
222 [ $count -gt 1 ] && {
223 echo "more than 1 MDS is found, skipping test"
227 mkdir $DIR/1b0 || error
228 createmany -o $DIR/1b0/f 5000
229 old_last_fid=`cat /proc/fs/lustre/mds/$MDS/last_fid`
231 new_last_fid=`cat /proc/fs/lustre/mds/$MDS/last_fid`
233 [ $new_last_fid -ne $old_last_fid ] && {
234 echo "invalid fid management on $MDS: \
235 old $old_last_fid, new $new_last_fid"
238 rm -fr $DIR/1b0 || error
240 run_test 1b " fid managing correctness ============="
246 log "cleanup: ========================================================"
247 if [ "`mount | grep ^$NAME`" ]; then
248 rm -rf $DIR/[Rdfs][1-9]*
249 if [ "$I_MOUNTED" = "yes" ]; then
250 sh llmountcleanup.sh || error
254 echo "=========================== finished ============================"
255 [ -f "$SANITYLOG" ] && cat $SANITYLOG && exit 1 || true