ONLY=${ONLY:-"$*"}
# bug number for skipped test: 3192 9977
-ALWAYS_EXCEPT=${ALWAYS_EXCEPT:-"14b 28"}
+ALWAYS_EXCEPT="14b 28 $SANITYN_EXCEPT"
# UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
[ "$SLOW" = "no" ] && EXCEPT="$EXCEPT 16"
# Tests that fail on uml
[ "$UML" = "true" ] && EXCEPT="$EXCEPT 7"
+# Join file feature is not supported currently.
+# It will be ported soon.
+EXCEPT="$EXCEPT 22"
+
SRCDIR=`dirname $0`
PATH=$PWD/$SRCDIR:$SRCDIR:$SRCDIR/../utils:$PATH
CREATETEST=${CREATETEST:-createtest}
GETSTRIPE=${GETSTRIPE:-lfs getstripe}
SETSTRIPE=${SETSTRIPE:-lstripe}
-LCTL=${LCTL:-lctl}
MCREATE=${MCREATE:-mcreate}
OPENFILE=${OPENFILE:-openfile}
OPENUNLINK=${OPENUNLINK:-openunlink}
TOEXCL=${TOEXCL:-toexcl}
TRUNCATE=${TRUNCATE:-truncate}
export TMP=${TMP:-/tmp}
+MOUNT_2=${MOUNT_2:-"yes"}
+CHECK_GRANT=${CHECK_GRANT:-"yes"}
+GRANT_CHECK_LIST=${GRANT_CHECK_LIST:-""}
if [ $UID -ne 0 ]; then
RUNAS_ID="$UID"
SAVE_PWD=$PWD
+export NAME=${NAME:-local}
+
LUSTRE=${LUSTRE:-`dirname $0`/..}
. $LUSTRE/tests/test-framework.sh
+CLEANUP=${CLEANUP:-:}
+SETUP=${SETUP:-:}
init_test_env $@
. ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
-cleanup() {
- echo -n "cln.."
- grep " $MOUNT2 " /proc/mounts && zconf_umount `hostname` $MOUNT2 ${FORCE}
- cleanupall ${FORCE} > /dev/null || { echo "FAILed to clean up"; exit 20; }
-}
-CLEANUP=${CLEANUP:-:}
-
-setup() {
- echo -n "mnt.."
- setupall || exit 10
- echo "done"
-}
-SETUP=${SETUP:-:}
+SANITYLOG=${TESTSUITELOG:-$TMP/$(basename $0 .sh).log}
+FAIL_ON_ERROR=false
-log() {
- echo "$*"
- lctl mark "$*" 2> /dev/null || true
-}
+if $GSS_KRB5; then
+ $RUNAS krb5_login.sh || exit 1
+fi
-trace() {
- log "STARTING: $*"
- strace -o $TMP/$1.strace -ttt $*
- RC=$?
- log "FINISHED: $*: rc $RC"
- return 1
-}
+SETUP=${SETUP:-:}
TRACE=${TRACE:-""}
LPROC=/proc/fs/lustre
-run_one() {
- if ! grep -q $DIR /proc/mounts; then
- $SETUP
- fi
- testnum=$1
- message=$2
- BEFORE=`date +%s`
- log "== test $testnum: $message= `date +%H:%M:%S` ($BEFORE)"
- export TESTNAME=test_$testnum
- export tfile=f${testnum}
- export tdir=d${base}
- test_$1 || error "exit with rc=$?"
- unset TESTNAME
- pass "($((`date +%s` - $BEFORE))s)"
- cd $SAVE_PWD
- $CLEANUP
-}
-
-build_test_filter() {
- [ "$ALWAYS_EXCEPT$EXCEPT$SANITYN_EXCEPT" ] && \
- echo "Skipping tests: `echo $ALWAYS_EXCEPT $EXCEPT $SANITYN_EXCEPT`"
-
- for O in $ONLY; do
- eval ONLY_${O}=true
- done
- for E in $EXCEPT $ALWAYS_EXCEPT $SANITY_EXCEPT; do
- eval EXCEPT_${E}=true
- done
-}
-
-_basetest() {
- echo $*
-}
-
-basetest() {
- IFS=abcdefghijklmnopqrstuvwxyz _basetest $1
-}
-
-build_test_filter() {
- [ "$ALWAYS_EXCEPT$EXCEPT$SANITYN_EXCEPT" ] && \
- echo "Skipping tests: `echo $ALWAYS_EXCEPT $EXCEPT $SANITYN_EXCEPT`"
-
- for O in $ONLY; do
- eval ONLY_${O}=true
- done
- for E in $EXCEPT $ALWAYS_EXCEPT $SANITYN_EXCEPT; do
- eval EXCEPT_${E}=true
- done
-}
-
-_basetest() {
- echo $*
-}
-
-basetest() {
- IFS=abcdefghijklmnopqrstuvwxyz _basetest $1
-}
-
-run_test() {
- export base=`basetest $1`
- if [ "$ONLY" ]; then
- testname=ONLY_$1
- if [ ${!testname}x != x ]; then
- run_one $1 "$2"
- return $?
- fi
- testname=ONLY_$base
- if [ ${!testname}x != x ]; then
- run_one $1 "$2"
- return $?
- fi
- echo -n "."
- return 0
- fi
- testname=EXCEPT_$1
- if [ ${!testname}x != x ]; then
- echo "skipping excluded test $1"
- return 0
- fi
- testname=EXCEPT_$base
- if [ ${!testname}x != x ]; then
- echo "skipping excluded test $1 (base $base)"
- return 0
- fi
- run_one $1 "$2"
- return $?
-}
-
[ "$SANITYLOG" ] && rm -f $SANITYLOG || true
-error () {
- sysctl -w lustre.fail_loc=0 2> /dev/null || true
- log "$0: FAIL: $TESTNAME $@"
- if [ "$SANITYLOG" ]; then
- echo "$0: FAIL: $TESTNAME $@" >> $SANITYLOG
- else
- exit 1
- fi
-}
-
-pass() {
- echo PASS $@
-}
+check_and_setup_lustre
-mounted_lustre_filesystems() {
- awk '($3 ~ "lustre" && $1 ~ ":") { print $2 }' /proc/mounts
-}
-MOUNTED="`mounted_lustre_filesystems`"
-if [ -z "$MOUNTED" ]; then
- formatall
- setupall
- mount_client $MOUNT2
- MOUNTED="`mounted_lustre_filesystems`"
- [ -z "$MOUNTED" ] && error "NAME=$NAME not mounted"
- I_MOUNTED=yes
-fi
-export MOUNT1=`mounted_lustre_filesystems | head -n 1`
-[ -z "$MOUNT1" ] && error "NAME=$NAME not mounted once"
-export MOUNT2=`mounted_lustre_filesystems | tail -n 1`
-[ "$MOUNT1" = "$MOUNT2" ] && error "NAME=$NAME not mounted twice"
-[ `mounted_lustre_filesystems | wc -l` -ne 2 ] && \
- error "NAME=$NAME mounted more than twice"
-
-export DIR1=${DIR1:-$MOUNT1}
-export DIR2=${DIR2:-$MOUNT2}
-[ -z "`echo $DIR1 | grep $MOUNT1`" ] && echo "$DIR1 not in $MOUNT1" && exit 96
-[ -z "`echo $DIR2 | grep $MOUNT2`" ] && echo "$DIR2 not in $MOUNT2" && exit 95
+LPROC=/proc/fs/lustre
+LOVNAME=`cat $LPROC/llite/*/lov/common_name | tail -n 1`
+OSTCOUNT=`cat $LPROC/lov/$LOVNAME/numobd`
rm -rf $DIR1/[df][0-9]* $DIR1/lnk
+check_runas_id $RUNAS_ID $RUNAS
+
build_test_filter
test_1a() {
run_test 6 "remove of open file on other node =================="
test_7() {
+ # run_one creates uniq $tdir (bug 13798)
+ # opendirunlink failes if it exists
+ rmdir $DIR1/$tdir || true
opendirunlink $DIR1/$tdir $DIR2/$tdir || \
error "opendirunlink $DIR1/$tdir $DIR2/$tdir"
}
run_test 11 "execution of file opened for write should return error ===="
test_12() {
- sh lockorder.sh
+ DIR=$DIR DIR2=$DIR2 sh lockorder.sh
}
run_test 12 "test lock ordering (link, stat, unlink) ==========="
multiop $DIR2/d14/multiop Oc && error "expected error, got success"
kill -USR1 $MULTIPID || return 2
wait $MULTIPID || return 3
- rm $TMP/test14.junk
+ rm $TMP/test14.junk $DIR1/d14/multiop || error "removing multiop"
}
run_test 14a "open(RDWR) of executing file returns -ETXTBSY ===="
kill -USR1 $MULTIPID || return 2
wait $MULTIPID || return 3
cmp `which multiop` $DIR1/d14/multiop || error "binary changed"
- rm $TMP/test14.junk
+ rm $TMP/test14.junk $DIR1/d14/multiop || error "removing multiop"
}
run_test 14b "truncate of executing file returns -ETXTBSY ======"
kill -USR1 $MULTIPID || return 2
wait $MULTIPID || return 3
cmp `which multiop` $DIR1/d14/multiop || error "binary changed"
- rm $TMP/test14.junk
+ rm $TMP/test14.junk $DIR1/d14/multiop || error "removing multiop"
}
run_test 14c "open(O_TRUNC) of executing file return -ETXTBSY =="
kill -USR1 $MULTIPID || return 2
wait $MULTIPID || return 3
cmp `which multiop` $DIR1/d14/multiop || error "binary changed"
- rm $TMP/test14.junk
+ rm $TMP/test14.junk $DIR1/d14/multiop || error "removing multiop"
}
run_test 14d "chmod of executing file is still possible ========"
test_15() { # bug 974 - ENOSPC
echo "PATH=$PATH"
sh oos2.sh $MOUNT1 $MOUNT2
+ grant_error=`dmesg | grep "> available"`
+ [ -z "$grant_error" ] || error "$grant_error"
}
run_test 15 "test out-of-space with multiple writers ==========="
test_16() {
- fsx -c 50 -p 100 -N 2500 -S 0 $MOUNT1/fsxfile $MOUNT2/fsxfile
+ rm -f $MOUNT1/fsxfile
+ lfs setstripe $MOUNT1/fsxfile 0 -1 -1 # b=10919
+ fsx -c 50 -p 100 -N 2500 -l $((SIZE * 256)) -S 0 $MOUNT1/fsxfile $MOUNT2/fsxfile
}
run_test 16 "2500 iterations of dual-mount fsx ================="
test_17() { # bug 3513, 3667
- [ ! -d /proc/fs/lustre/ost ] && echo "skipping OST-only test" && return
+ [ ! -d /proc/fs/lustre/ost ] && skip "remote OST, skipping OST-only test" && return
cp /etc/termcap $DIR1/f17
cancel_lru_locks osc > /dev/null
lfs df -ih $DIR2/$tfile || error "lfs df -ih $DIR2/$tfile failed"
OSC=`lctl dl | awk '/-osc-|OSC.*MNT/ {print $4}' | head -n 1`
+# OSC=`lctl dl | awk '/-osc-/ {print $4}' | head -n 1`
lctl --device %$OSC deactivate
lfs df -i || error "lfs df -i with deactivated OSC failed"
lctl --device %$OSC recover
run_test 24 "lfs df [-ih] [path] test ========================="
test_25() {
- [ `cat $LPROC/mdc/*-mdc-*/connect_flags | grep -c acl` -lt 2 ] && echo "skipping $TESTNAME (must have acl)" && return
+ [ `cat $LPROC/mdc/*-mdc-*/connect_flags | grep -c acl` -lt 2 ] && \
+ skip "must have acl, skipping" && return
- mkdir $DIR1/$tdir || error "mkdir $DIR1/$tdir"
touch $DIR1/$tdir/f1 || error "touch $DIR1/$tdir/f1"
chmod 0755 $DIR1/$tdir/f1 || error "chmod 0755 $DIR1/$tdir/f1"
- $RUNAS checkstat $DIR2/$tdir/f1 || error "checkstat $DIR2/$tdir/f1 #1"
+ $RUNAS $CHECKSTAT $DIR2/$tdir/f1 || error "checkstat $DIR2/$tdir/f1 #1"
setfacl -m u:$RUNAS_ID:--- $DIR1/$tdir || error "setfacl $DIR2/$tdir #1"
- $RUNAS checkstat $DIR2/$tdir/f1 && error "checkstat $DIR2/$tdir/f1 #2"
+ $RUNAS $CHECKSTAT $DIR2/$tdir/f1 && error "checkstat $DIR2/$tdir/f1 #2"
setfacl -m u:$RUNAS_ID:r-x $DIR1/$tdir || error "setfacl $DIR2/$tdir #2"
- $RUNAS checkstat $DIR2/$tdir/f1 || error "checkstat $DIR2/$tdir/f1 #3"
+ $RUNAS $CHECKSTAT $DIR2/$tdir/f1 || error "checkstat $DIR2/$tdir/f1 #3"
setfacl -m u:$RUNAS_ID:--- $DIR1/$tdir || error "setfacl $DIR2/$tdir #3"
- $RUNAS checkstat $DIR2/$tdir/f1 && error "checkstat $DIR2/$tdir/f1 #4"
+ $RUNAS $CHECKSTAT $DIR2/$tdir/f1 && error "checkstat $DIR2/$tdir/f1 #4"
setfacl -x u:$RUNAS_ID: $DIR1/$tdir || error "setfacl $DIR2/$tdir #4"
- $RUNAS checkstat $DIR2/$tdir/f1 || error "checkstat $DIR2/$tdir/f1 #5"
+ $RUNAS $CHECKSTAT $DIR2/$tdir/f1 || error "checkstat $DIR2/$tdir/f1 #5"
rm -rf $DIR1/$tdir
}
run_test 26b "sync mtime between ost and mds"
test_27() {
- cancel_lru_locks OSC
+ cancel_lru_locks osc
lctl clear
dd if=/dev/zero of=$DIR2/$tfile bs=$((4096+4))k conv=notrunc count=4 seek=3 &
DD2_PID=$!
#run_test 29 "lock put race between glimpse and enqueue ========="
test_30() { #bug #11110
- rm -rf $DIR1/$tdir
- mkdir -p $DIR1/$tdir
cp -f /bin/bash $DIR1/$tdir/bash
/bin/sh -c 'sleep 1; rm -f $DIR2/$tdir/bash; cp /bin/bash $DIR2/$tdir' &
err=$($DIR1/$tdir/bash -c 'sleep 2; openfile -f O_RDONLY /proc/$$/exe >& /dev/null; echo $?')
wait
- [ $err -ne 116 ] && error "return code ($err) != -ESTALE" && return
+ [ $err -ne 116 ] && error_ignore 12900 "return code ($err) != -ESTALE" && return
true
}
run_test 30 "recreate file race ========="
log "cleanup: ======================================================"
-rm -rf $DIR1/[df][0-9]* $DIR1/lnk || true
-if [ "$I_MOUNTED" = "yes" ]; then
- cleanup
-fi
+
+check_and_cleanup_lustre
echo '=========================== finished ==============================='
-[ -f "$SANITYLOG" ] && cat $SANITYLOG && exit 1 || true
+[ -f "$SANITYLOG" ] && cat $SANITYLOG && grep -q FAIL $SANITYLOG && exit 1 || true
echo "$0: completed"
-