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"
+[ "$SLOW" = "no" ] && EXCEPT_SLOW="12 16"
# Tests that fail on uml
[ "$UML" = "true" ] && EXCEPT="$EXCEPT 7"
CREATETEST=${CREATETEST:-createtest}
GETSTRIPE=${GETSTRIPE:-lfs getstripe}
SETSTRIPE=${SETSTRIPE:-lstripe}
-LFS=${LFS:-lfs}
-LCTL=${LCTL:-lctl}
MCREATE=${MCREATE:-mcreate}
OPENFILE=${OPENFILE:-openfile}
OPENUNLINK=${OPENUNLINK:-openunlink}
TOEXCL=${TOEXCL:-toexcl}
TRUNCATE=${TRUNCATE:-truncate}
export TMP=${TMP:-/tmp}
-CHECK_GRANT=${CHECK_GRANT:-"no"}
-
+MOUNT_2=${MOUNT_2:-"yes"}
+CHECK_GRANT=${CHECK_GRANT:-"yes"}
+GRANT_CHECK_LIST=${GRANT_CHECK_LIST:-""}
if [ $UID -ne 0 ]; then
RUNAS_ID="$UID"
LUSTRE=${LUSTRE:-`dirname $0`/..}
. $LUSTRE/tests/test-framework.sh
+CLEANUP=${CLEANUP:-:}
+SETUP=${SETUP:-:}
init_test_env $@
. ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
-if [ ! -z "$USING_KRB5" ]; then
+SANITYLOG=${TESTSUITELOG:-$TMP/$(basename $0 .sh).log}
+FAIL_ON_ERROR=false
+
+if $GSS_KRB5; then
$RUNAS krb5_login.sh || exit 1
fi
-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:-:}
-
-log() {
- echo "$*"
- lctl mark "$*" 2> /dev/null || true
-}
-
-trace() {
- log "STARTING: $*"
- strace -o $TMP/$1.strace -ttt $*
- RC=$?
- log "FINISHED: $*: rc $RC"
- return 1
-}
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=$?"
- check_grant || error "check grant fail"
- 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
-}
-
-sync_clients() {
- cd $DIR1
- sync; sleep 1; sync
- cd $DIR2
- sync; sleep 1; sync
-
- cd $SAVE_PWD
-}
-
-check_grant() {
- [ "$CHECK_GRANT" == "no" ] && return 0
-
- echo -n "checking grant......"
- cd $SAVE_PWD
- # write some data to sync client lost_grant
- rm -f $DIR1/${tfile}_check_grant_* 2>&1
- for i in `seq $OSTCOUNT`; do
- $LFS setstripe $DIR1/${tfile}_check_grant_$i 0 $(($i -1)) 1
- dd if=/dev/zero of=$DIR1/${tfile}_check_grant_$i bs=4k \
- count=1 > /dev/null 2>&1
- done
- # sync all the data and make sure no pending data on server
- sync_clients
-
- #get client grant and server grant
- client_grant=0
- for d in /proc/fs/lustre/osc/*/cur_grant_bytes; do
- client_grant=$(($client_grant + `cat $d`))
- done
- server_grant=0
- for d in /proc/fs/lustre/obdfilter/*/tot_granted; do
- server_grant=$(($server_grant + `cat $d`))
- done
-
- # cleanup the check_grant file
- for i in `seq $OSTCOUNT`; do
- rm $DIR1/${tfile}_check_grant_$i
- done
-
- #check whether client grant == server grant
- if [ $client_grant != $server_grant ]; then
- echo "failed: client:${client_grant} server: ${server_grant}"
- return 1
- else
- echo "pass"
- fi
-}
-
-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 $@"
- $LCTL dk $TMP/lustre-log-$TESTNAME.log
- if [ "$SANITYLOG" ]; then
- echo "$0: FAIL: $TESTNAME $@" >> $SANITYLOG
- else
- exit 1
- fi
-}
-
-pass() {
- echo PASS $@
-}
-
-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
+check_and_setup_lustre
LPROC=/proc/fs/lustre
LOVNAME=`cat $LPROC/llite/*/lov/common_name | tail -n 1`
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) ==========="
test_16() {
rm -f $MOUNT1/fsxfile
- lfs setstripe $MOUNT1/fsxfile 0 -1 -1 # b=10919
+ lfs setstripe $MOUNT1/fsxfile -c -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
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
}
ECHO_UUID="ECHO_osc1_UUID"
tOST=`$LCTL dl | | awk '/-osc-|OSC.*MNT/ { print $4 }' | head -1`
- lfs setstripe $DIR1/$tfile 1048576 0 2
+ lfs setstripe $DIR1/$tfile -s 1048576 -i 0 -c 2
tOBJID=`lfs getstripe $DIR1/$tfile |grep "^[[:space:]]\+1" |awk '{print $2}'`
dd if=/dev/zero of=$DIR1/$tfile bs=1024k count=2
#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"
-