Whamcloud - gitweb
b=14384
authorgrev <grev>
Mon, 16 Jun 2008 20:24:07 +0000 (20:24 +0000)
committergrev <grev>
Mon, 16 Jun 2008 20:24:07 +0000 (20:24 +0000)
i=Adilger
remove tdir creation from run_one: the test has to create tdir by
itself if it needs this dir

lustre/tests/conf-sanity.sh
lustre/tests/recovery-small.sh
lustre/tests/replay-dual.sh
lustre/tests/replay-ost-single.sh
lustre/tests/replay-single.sh
lustre/tests/sanity-quota.sh
lustre/tests/sanity.sh
lustre/tests/sanityN.sh
lustre/tests/test-framework.sh

index 7e52d76..b7bc13d 100644 (file)
@@ -41,6 +41,8 @@ OSTSIZE=40000
 #
 [ "$SLOW" = "no" ] && EXCEPT_SLOW="0 1 2 3 6 7 15 18 24b 25 30 31 32 33 34a "
 
+assert_DIR
+
 reformat() {
         formatall
 }
index 3f29d3f..7b7a978 100755 (executable)
@@ -23,6 +23,7 @@ SETUP=${SETUP:-""}
 CLEANUP=${CLEANUP:-""}
 
 cleanup_and_setup_lustre
+assert_DIR
 rm -rf $DIR/[df][0-9]*
 
 SAMPLE_NAME=recovery-small.junk
@@ -726,6 +727,7 @@ test_51() {
 run_test 51 "failover MDS during recovery"
 
 test_52_guts() {
+       do_facet client "mkdir -p $DIR/$tdir"
        do_facet client "writemany -q -a $DIR/$tdir/$tfile 300 5" &
        CLIENT_PID=$!
        echo writemany pid $CLIENT_PID
index dffb15c..49cad57 100755 (executable)
@@ -23,6 +23,7 @@ init_test_env $@
 build_test_filter
 
 cleanup_and_setup_lustre
+assert_DIR
 rm -rf $DIR/[df][0-9]*
 
 [ "$DAEMONFILE" ] && $LCTL debug_daemon start $DAEMONFILE $DAEMONSIZE
index 8dd9d9d..794d5b0 100755 (executable)
@@ -30,6 +30,7 @@ OSTCOUNT=1
 build_test_filter
 
 REFORMAT=--reformat cleanup_and_setup_lustre
+assert_DIR
 rm -rf $DIR/[df][0-9]*
 
 test_0a() {
index ea4994f..da1c31e 100755 (executable)
@@ -30,6 +30,7 @@ cleanup_and_setup_lustre
 
 mkdir -p $DIR
 
+assert_DIR
 rm -rf $DIR/[df][0-9]*
 
 test_0a() {    # was test_0
@@ -219,6 +220,7 @@ run_test 5 "|x| 220 open(O_CREAT)"
 
 
 test_6a() {    # was test_6
+    mkdir -p $DIR/$tdir
     replay_barrier $SINGLEMDS
     mcreate $DIR/$tdir/$tfile
     fail $SINGLEMDS
@@ -230,6 +232,7 @@ test_6a() { # was test_6
 run_test 6a "mkdir + contained create"
 
 test_6b() {
+    mkdir -p $DIR/$tdir
     replay_barrier $SINGLEMDS
     rm -rf $DIR/$tdir
     fail $SINGLEMDS
@@ -238,6 +241,7 @@ test_6b() {
 run_test 6b "|X| rmdir"
 
 test_7() {
+    mkdir -p $DIR/$tdir
     replay_barrier $SINGLEMDS
     mcreate $DIR/$tdir/$tfile
     fail $SINGLEMDS
@@ -1324,6 +1328,7 @@ run_test 57 "test recovery from llog for setattr op"
 
 #recovery many mds-ost setattr from llog
 test_58() {
+    mkdir -p $DIR/$tdir
 #define OBD_FAIL_MDS_OST_SETATTR       0x12c
     do_facet $SINGLEMDS "lctl set_param fail_loc=0x8000012c"
     createmany -o $DIR/$tdir/$tfile-%d 2500
@@ -1340,6 +1345,7 @@ run_test 58 "test recovery from llog for setattr op (test llog_gen_rec)"
 # log_commit_thread vs filter_destroy race used to lead to import use after free
 # bug 11658
 test_59() {
+    mkdir -p $DIR/$tdir
     createmany -o $DIR/$tdir/$tfile-%d 200
     sync
     unlinkmany $DIR/$tdir/$tfile-%d 200
@@ -1356,6 +1362,7 @@ run_test 59 "test log_commit_thread vs filter_destroy race"
 # race between add unlink llog vs cat log init in post_recovery (only for b1_6)
 # bug 12086: should no oops and No ctxt error for this test
 test_60() {
+    mkdir -p $DIR/$tdir
     createmany -o $DIR/$tdir/$tfile-%d 200
     replay_barrier $SINGLEMDS
     unlinkmany $DIR/$tdir/$tfile-%d 0 100
@@ -1367,7 +1374,7 @@ test_60() {
 run_test 60 "test llog post recovery init vs llog unlink"
 
 #test race  llog recovery thread vs llog cleanup
-test_61() {
+test_61a() {   # was test_61
     mkdir $DIR/$tdir
     createmany -o $DIR/$tdir/$tfile-%d 800
     replay_barrier ost1 
@@ -1383,7 +1390,7 @@ test_61() {
     $CHECKSTAT -t file $DIR/$tdir/$tfile-* && return 1
     rmdir $DIR/$tdir
 }
-run_test 61 "test race llog recovery vs llog cleanup"
+run_test 61a "test race llog recovery vs llog cleanup"
 
 #test race  mds llog sync vs llog cleanup
 test_61b() {
index 22445c0..09bb53d 100644 (file)
@@ -167,6 +167,7 @@ run_test 0 "Set quota ============================="
 
 # block hard limit (normal use and out of quota)
 test_1() {
+       mkdir -p $DIR/$tdir
        chmod 0777 $DIR/$tdir
 
        LIMIT=$(( $BUNIT_SZ * $(($OSTCOUNT + 1)) * 5)) # 5 bunits each sever
@@ -217,6 +218,7 @@ run_test 1 "Block hard limit (normal use and out of quota) ==="
 
 # file hard limit (normal use and out of quota)
 test_2() {
+       mkdir -p $DIR/$tdir
        chmod 0777 $DIR/$tdir
 
        LIMIT=$(($IUNIT_SZ * 10)) # 10 iunits on mds
@@ -323,6 +325,7 @@ test_block_soft() {
 
 # block soft limit (start timer, timer goes off, stop timer)
 test_3() {
+       mkdir -p $DIR/$tdir
        chmod 0777 $DIR/$tdir
 
        LIMIT=$(( $BUNIT_SZ * 2 )) # 1 bunit on mds and 1 bunit on the ost
@@ -406,6 +409,7 @@ test_file_soft() {
 
 # file soft limit (start timer, timer goes off, stop timer)
 test_4a() {    # was test_4
+       mkdir -p $DIR/$tdir
        chmod 0777 $DIR/$tdir
        LIMIT=$(($IUNIT_SZ * 10))       # 10 iunits on mds
        TESTFILE=$DIR/$tdir/$tfile-0
@@ -463,6 +467,7 @@ run_test 4b "Grace time strings handling ==="
 
 # chown & chgrp (chown & chgrp successfully even out of block/file quota)
 test_5() {
+       mkdir -p $DIR/$tdir
        BLIMIT=$(( $BUNIT_SZ * $((OSTCOUNT + 1)) * 10)) # 10 bunits on each server
        ILIMIT=$(( $IUNIT_SZ * 10 )) # 10 iunits on mds
        
@@ -498,6 +503,7 @@ test_6() {
                return 0;
        fi
 
+       mkdir -p $DIR/$tdir
        chmod 0777 $DIR/$tdir
 
        LIMIT=$((BUNIT_SZ * (OSTCOUNT + 1) * 5)) # 5 bunits per server
@@ -557,6 +563,7 @@ run_test 6 "Block quota acquire & release ========="
 # quota recovery (block quota only by now)
 test_7()
 {
+       mkdir -p $DIR/$tdir
        chmod 0777 $DIR/$tdir
        remote_mds && skip "remote mds" && return 0
 
@@ -606,6 +613,7 @@ run_test 7 "Quota recovery (only block limit) ======"
 
 # run dbench with quota enabled
 test_8() {
+       mkdir -p $DIR/$tdir
        BLK_LIMIT=$((100 * 1024 * 1024)) # 100G
        FILE_LIMIT=1000000
        DBENCH_LIB=${DBENCH_LIB:-/usr/lib/dbench}
@@ -625,6 +633,7 @@ test_8() {
        SRC=$DBENCH_LIB/client_plain.txt
        [ ! -e $TGT -a -e $SRC ] && echo "copying $SRC to $TGT" && cp $SRC $TGT
 
+       mkdir -p $DIR/$tdir
        chmod 0777 $DIR/$tdir
        SAVE_PWD=$PWD
        cd $DIR/$tdir
@@ -718,6 +727,7 @@ run_test 9 "run for fixing bug10707(64bit) ==========="
 
 # run for fixing bug10707, it need a big room. test for 32bit
 test_10() {
+       mkdir -p $DIR/$tdir
        chmod 0777 $DIR/$tdir
        lustrefs_size=`(echo 0; df -t lustre -P | awk '{print $4}') | tail -n 1`
        size_file=$((FSIZE * GB))
@@ -819,12 +829,12 @@ test_11() {
        local i=1
        while [ $i -le $REPS ]; do
           echo "test: cycle($i of $REPS) start at $(date)"
-          mkdir -p $DIR/$tdir && chmod 777 $DIR/$tdir
+          mkdir -p $TESTDIR && chmod 777 $TESTDIR
           echo -n "    create a file for uid "
           for j in `seq 1 30`; do
               echo -n "$j "
                # 30MB per dd for a total of 900MB (if space even permits)
-              runas -u $j dd if=/dev/zero of=$DIR/$tdir/$tfile  bs=$blksize count=15 > /dev/null 2>&1 &
+              runas -u $j dd if=/dev/zero of=$TESTDIR/$tfile  bs=$blksize count=15 > /dev/null 2>&1 &
           done
           echo ""
           PROCS=$(ps -ef | grep -v grep | grep "dd if /dev/zero of $TESTDIR" | wc -l)
@@ -833,11 +843,11 @@ test_11() {
             sleep 20
             SECS=$((SECS + sleep))
             PROCS=$(ps -ef | grep -v grep | grep "dd if /dev/zero of $TESTDIR" | wc -l)
-            USED=$(du -s $DIR/$tdir | awk '{print $1}')
+            USED=$(du -s $TESTDIR | awk '{print $1}')
             PCT=$(($USED * 100 / $block_limit))
             echo "${i}/${REPS} ${PCT}% p${PROCS} t${SECS}  "
             if [ $USED -le $LAST_USED ]; then
-                kill -9 $(ps -ef | grep "dd if /dev/zero of $DIR/$tdir" | grep -v grep | awk '{ print $2 }')
+                kill -9 $(ps -ef | grep "dd if /dev/zero of $TESTDIR" | grep -v grep | awk '{ print $2 }')
                 i=$REPS
                 RV=2
                 break
@@ -845,7 +855,7 @@ test_11() {
              LAST_USED=$USED
           done
           echo "    removing the test files..."
-          rm -f $DIR/$tdir/$tfile
+          rm -f $TESTDIR/$tfile
           echo "cycle $i done at $(date)"
           i=$[$i+1]
        done
@@ -866,6 +876,7 @@ run_test 11 "run for fixing bug10912 ==========="
 
 # test a deadlock between quota and journal b=11693
 test_12() {
+       mkdir -p $DIR/$tdir
        chmod 0777 $DIR/$tdir
 
        [ "$(grep $DIR2 /proc/mounts)" ] || mount_client $DIR2 || \
@@ -932,7 +943,8 @@ test_13() {
        # one OST * 10 + (mds + other OSTs)
        LIMIT=$((BUNIT_SZ * 10 + (BUNIT_SZ * OSTCOUNT)))
        TESTFILE="$DIR/$tdir/$tfile"
-       
+       mkdir -p $DIR/$tdir
+
        echo "   User quota (limit: $LIMIT kbytes)"
        $LFS setquota -u $TSTUSR 0 $LIMIT 0 0 $DIR
        $SHOW_QUOTA_USER
@@ -1017,6 +1029,7 @@ pre_test_14
 
 test_14a() {   # was test_14 b=12223 -- setting quota on root
        TESTFILE="$DIR/$tdir/$tfile"
+       mkdir -p $DIR/$tdir
 
        # out of root's file and block quota
         $LFS setquota -u root 10 10 10 10 $DIR
index b3ff755..a8a7175 100644 (file)
@@ -110,7 +110,7 @@ fi
 check_and_setup_lustre
 
 DIR=${DIR:-$MOUNT}
-[ -z "`echo $DIR | grep $MOUNT`" ] && echo "$DIR not in $MOUNT" && exit 99
+assert_DIR
 
 LOVNAME=`lctl get_param -n llite.*.lov.common_name | tail -n 1`
 OSTCOUNT=`lctl get_param -n lov.$LOVNAME.numobd`
@@ -515,6 +515,7 @@ run_test 21 "write to dangling link ============================"
 
 test_22() {
        WDIR=$DIR/$tdir
+       mkdir -p $WDIR
        chown $RUNAS_ID $WDIR
        (cd $WDIR || error "cd $WDIR failed";
        $RUNAS tar cf - /etc/hosts /etc/sysconfig/network | \
@@ -781,6 +782,7 @@ run_test 26e "unlink multiple component recursive symlink ======"
 
 # recursive symlinks (bug 7022)
 test_26f() {
+       mkdir -p $DIR/$tdir
        mkdir $DIR/$tdir/$tfile        || error "mkdir $DIR/$tdir/$tfile failed"
        cd $DIR/$tdir/$tfile           || error "cd $DIR/$tdir/$tfile failed"
        mkdir -p lndir/bar1      || error "mkdir lndir/bar1 failed"
@@ -1875,6 +1877,7 @@ test_42d() {
 run_test 42d "test complete truncate of file with cached dirty data"
 
 test_43() {
+       mkdir -p $DIR/$tdir
        cp -p /bin/ls $DIR/$tdir/$tfile
        multiop $DIR/$tdir/$tfile Ow_c &
        pid=$!
@@ -4037,6 +4040,7 @@ test_105c() {
 run_test 105c "lockf when mounted without -o flock test ========"
 
 test_106() { #bug 10921
+       mkdir -p $DIR/$tdir
        $DIR/$tdir && error "exec $DIR/$tdir succeeded"
        chmod 777 $DIR/$tdir || error "chmod $DIR/$tdir failed"
 }
@@ -4615,6 +4619,7 @@ test_119c() # bug 13099
 run_test 119c "Testing for direct read hitting hole"
 
 test_120a() {
+        mkdir -p $DIR/$tdir
         [ -z "`lctl get_param -n mdc.*.connect_flags | grep early_lock_cancel`" ] && \
                skip "no early lock cancel on server" && return 0
         lru_resize_disable mdc
@@ -4634,6 +4639,7 @@ test_120a() {
 run_test 120a "Early Lock Cancel: mkdir test"
 
 test_120b() {
+        mkdir -p $DIR/$tdir
         [ -z "`lctl get_param -n mdc.*.connect_flags | grep early_lock_cancel`" ] && \
                skip "no early lock cancel on server" && return 0
         lru_resize_disable mdc
@@ -4653,6 +4659,7 @@ test_120b() {
 run_test 120b "Early Lock Cancel: create test"
 
 test_120c() {
+        mkdir -p $DIR/$tdir
         [ -z "`lctl get_param -n mdc.*.connect_flags | grep early_lock_cancel`" ] && \
                skip "no early lock cancel on server" && return 0
         lru_resize_disable mdc
@@ -4674,6 +4681,7 @@ test_120c() {
 run_test 120c "Early Lock Cancel: link test"
 
 test_120d() {
+        mkdir -p $DIR/$tdir
         [ -z "`lctl get_param -n mdc.*.connect_flags | grep early_lock_cancel`" ] && \
                skip "no early lock cancel on server" && return 0
         lru_resize_disable mdc
@@ -4694,6 +4702,7 @@ test_120d() {
 run_test 120d "Early Lock Cancel: setattr test"
 
 test_120e() {
+        mkdir -p $DIR/$tdir
         [ -z "`lctl get_param -n mdc.*.connect_flags | grep early_lock_cancel`" ] && \
                skip "no early lock cancel on server" && return 0
         lru_resize_disable mdc
@@ -4722,6 +4731,7 @@ run_test 120e "Early Lock Cancel: unlink test"
 test_120f() {
         [ -z "`lctl get_param -n mdc.*.connect_flags | grep early_lock_cancel`" ] && \
                skip "no early lock cancel on server" && return 0
+        mkdir -p $DIR/$tdir
         lru_resize_disable mdc
         lru_resize_disable osc
         mkdir -p $DIR/$tdir/d1 $DIR/$tdir/d2
index b32c148..f13b1e1 100644 (file)
@@ -64,6 +64,7 @@ LPROC=/proc/fs/lustre
 LOVNAME=`lctl get_param -n llite.*.lov.common_name | tail -n 1`
 OSTCOUNT=`lctl get_param -n lov.$LOVNAME.numobd`
 
+assert_DIR
 rm -rf $DIR1/[df][0-9]* $DIR1/lnk
 
 # $RUNAS_ID may get set incorrectly somewhere else
@@ -162,11 +163,9 @@ test_6() {
 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"
+       local dir=d7
+       opendirunlink $DIR1/$dir $DIR2/$dir || \
+               error "opendirunlink $DIR1/$dir $DIR2/$dir"
 }
 run_test 7 "remove of open directory on other node ============="
 
@@ -482,6 +481,7 @@ test_25() {
        [ `lctl get_param -n mdc.*-mdc-*.connect_flags | grep -c acl` -lt 2 ] && \
            skip "must have acl, skipping" && return
 
+       mkdir -p $DIR1/$tdir
        touch $DIR1/$tdir/f1 || error "touch $DIR1/$tdir/f1"
        chmod 0755 $DIR1/$tdir/f1 || error "chmod 0755 $DIR1/$tdir/f1"
 
@@ -590,6 +590,7 @@ test_29() { # bug 10999
 run_test 29 "lock put race between glimpse and enqueue ========="
 
 test_30() { #bug #11110
+    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 $?')
index 94bbafb..6d117ff 100644 (file)
@@ -28,6 +28,18 @@ assert_env() {
     [ $failed ] && exit 1 || true
 }
 
+assert_DIR () {
+    local failed=""
+    [ -z "`echo :$DIR: | grep :$MOUNT:`" ] && \
+        failed=1 && echo "DIR not in $MOUNT. Aborting."
+    [ -z "`echo :$DIR1: | grep :$MOUNT1:`" ] && \
+        failed=1 && echo "DIR1 not in $MOUNT1. Aborting."
+    [ -z "`echo :$DIR2: | grep :$MOUNT2:`" ] && \
+        failed=1 && echo "DIR2 not in $MOUNT2. Aborting"
+
+    [ -n "$failed" ] && exit 99 || true
+}
+
 usage() {
     echo "usage: $0 [-r] [-f cfgfile]"
     echo "       -r: reformat"
@@ -1445,6 +1457,8 @@ basetest() {
 }
 
 run_test() {
+    assert_DIR
+
     export base=`basetest $1`
     if [ ! -z "$ONLY" ]; then
         testname=ONLY_$1
@@ -1548,7 +1562,6 @@ run_one() {
     export tdir=d0.${TESTSUITE}/d${base}
     local SAVE_UMASK=`umask`
     umask 0022
-    mkdir -p $DIR/$tdir
 
     BEFORE=`date +%s`
     log "== test $testnum: $message ============ `date +%H:%M:%S` ($BEFORE)"
@@ -1563,7 +1576,6 @@ run_one() {
         error "LBUG/LASSERT detected"
     ps auxww | grep -v grep | grep -q multiop && error "multiop still running"
     pass "($((`date +%s` - $BEFORE))s)"
-    rmdir ${DIR}/$tdir >/dev/null 2>&1 || true
     unset TESTNAME
     unset tdir
     umask $SAVE_UMASK