Whamcloud - gitweb
LU-1538 tests: cleanup test output, acc-small
authorAndreas Dilger <adilger@whamcloud.com>
Tue, 19 Jun 2012 02:21:05 +0000 (20:21 -0600)
committerOleg Drokin <green@whamcloud.com>
Sat, 11 Aug 2012 00:23:13 +0000 (20:23 -0400)
There are a number of issues observed when running test scripts
on a single-node system.  Several minor cleanups to the test
scripts are also possible (coding style, more clear output, etc):

- sanity.sh test_51ba() should clean up subdirectories even if
  test_51b() failed to create all of the files
- sanity.sh test_61ic() shouldn't print all files to stdout
- running fsx accepts $FSXOPT to allow adding extra test options
- implement acceptance-small.sh via auster, so that we don't have to
  maintain two separate test wrappers, and it would be possible for
  users running acc-sm to upload results to Maloo if they wanted.

Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Change-Id: I8aae9c1af508d8173135f0938e0a26d9731253df
Reviewed-on: http://review.whamcloud.com/3132
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Li Wei <liwei@whamcloud.com>
Reviewed-by: Keith Mannthey <keith@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/tests/acceptance-small.sh
lustre/tests/conf-sanity.sh
lustre/tests/runtests
lustre/tests/sanity-benchmark.sh
lustre/tests/sanity.sh
lustre/tests/sanityn.sh
lustre/tests/test-groups/regression

index a863f23..46d7289 100755 (executable)
 #!/bin/bash
-# script which _must_ complete successfully (at minimum) before checkins to
-# the CVS HEAD are allowed.
-#set -vx
-set -e
-
-export MSKIPPED=0
-export OSKIPPED=0
-
-# This is the default set of tests to run.
-DEFAULT_SUITES="runtests sanity sanity-benchmark sanityn lfsck
-                racer replay-single conf-sanity recovery-small
-                replay-ost-single replay-dual replay-vbr insanity sanity-quota
-                sanity-sec sanity-gss performance-sanity large-scale
-                recovery-mds-scale recovery-double-scale recovery-random-scale
-                parallel-scale lustre_rsync-test metadata-updates ost-pools
-                lnet-selftest mmp obdfilter-survey sgpdd-survey"
-
-if [[ -n $@ ]]; then
-    ACC_SM_ONLY="${ACC_SM_ONLY} $@"
-fi
-
-[ "$SIZE" ] || SIZE=$((RAMKB * 2))
-[ "$RSIZE" ] || RSIZE=512
-[ "$UID" ] || UID=1000
-[ "$MOUNT" ] || MOUNT=/mnt/lustre
-[ "$MOUNT2" ] || MOUNT2=${MOUNT}2
-[ "$TMP" ] || TMP=/tmp
-[ "$COUNT" ] || COUNT=1000
-[ "$DEBUG_LVL" ] || DEBUG_LVL=0
-[ "$DEBUG_OFF" ] || DEBUG_OFF="eval lctl set_param debug=\"$DEBUG_LVL\""
-[ "$DEBUG_ON" ] || DEBUG_ON="eval lctl set_param debug=0x33f0484"
-
-export TF_FAIL=$TMP/tf.fail
-
-if [ "$ACC_SM_ONLY" ]; then
-    for O in $DEFAULT_SUITES; do
-        O=$(echo $O | tr "-" "_" | tr "[:lower:]" "[:upper:]")
-        export ${O}="no"
-    done
-    for O in $ACC_SM_ONLY; do
-        O=`echo ${O%.sh} | tr "-" "_"`
-        O=`echo $O | tr "[:lower:]" "[:upper:]"`
-        export ${O}="yes"
-    done
-fi
-
-STARTTIME=`date +%s`
-
-LUSTRE=${LUSTRE:-$(cd $(dirname $0)/..; echo $PWD)}
-. $LUSTRE/tests/test-framework.sh
-init_test_env
-
-if $GSS; then
-    # liblustre doesn't support GSS
-    export LIBLUSTRE=no
-else
-    export SANITY_GSS="no"
-fi
-
-SETUP=${SETUP:-setupall}
-FORMAT=${FORMAT:-formatall}
-CLEANUP=${CLEANUP:-stopall}
-
-setup_if_needed() {
-    nfs_client_mode && return
-
-    local MOUNTED=$(mounted_lustre_filesystems)
-    if $(echo $MOUNTED' ' | grep -w -q $MOUNT' '); then
-        check_config_clients $MOUNT
-        init_facets_vars
-        init_param_vars
-        return
-    fi
-
-    echo "Lustre is not mounted, trying to do setup SETUP=$SETUP ... "
-    [ "$REFORMAT" ] && $FORMAT
-    $SETUP
-
-    MOUNTED=$(mounted_lustre_filesystems)
-    if ! $(echo $MOUNTED' ' | grep -w -q $MOUNT' '); then
-        echo "Lustre is not mounted after setup! SETUP=$SETUP"
-        exit 1
-    fi
-}
-
-find_in_path() {
-    target=$1
-    for dir in $(tr : " " <<< $PATH); do
-      if [ -e $dir/$target ]; then
-          echo "$dir/$target found in PATH"
-          return 0
-      fi
-    done
-    return 1
-}
-
-title() {
-    # update titlebar if stdin is attaached to an xterm
-    if ${UPDATE_TITLEBAR:-false}; then
-        if tty -s; then
-            case $TERM in 
-                xterm*)
-                    echo -ne "\033]2; acceptance-small: $* \007" >&0
-                    ;;
-            esac
-        fi
-    fi 
-    log "-----============= acceptance-small: "$*" ============----- $(date)"
-}
-
-run_suite() {
-    local suite_name=$(echo ${1%.sh} | tr "[:upper:]_" "[:lower:]-" )
-    local suite=$(echo ${suite_name} | tr "[:lower:]-" "[:upper:]_")
-    local suite_only=ONLY # Change to ${suite}_ONLY after fixing YALA
-
-    if is_sanity_benchmark ${suite_name}; then
-        suite_only=suite_name
-        suite_script=$LUSTRE/tests/sanity-benchmark.sh
-    elif [ -e $LUSTRE/tests/${suite_name}.sh ]; then
-        suite_script=$LUSTRE/tests/${suite_name}.sh
-    elif [ -e $LUSTRE/tests/$suite_name ]; then
-        suite_script=$LUSTRE/tests/$suite_name
-    elif find_in_path $suite_name; then
-        suite_script=${suite_name}
-    elif find_in_path ${suite_name}.sh; then
-        suite_script=${suite_name}.sh
-    else
-        echo "Can't find test script for $suite_name"
-        return 1
-    fi
-
-    echo "$suite_script located."
-    if [[ ${!suite} != no ]]; then
-        local rc
-        local status
-        local duration
-        local start_ts=$(date +%s)
-        rm -rf $TF_FAIL
-        title $suite_name
-        log_test $suite_name
-        bash $suite_script ${!suite_only}
-        rc=$?
-        duration=$(($(date +%s) - $start_ts))
-        if [ -f $TF_FAIL -o $rc -ne 0 ]; then
-            status="FAIL"
-        else
-            status="PASS"
-        fi
-        echo "Script: $status"
-        log_test_status $duration $status
-
-        $CLEANUP
-        [ x$suite = xSGPDD_SURVEY ] || $SETUP
-
-        eval ${suite}="done"
-    else
-        echo "Skipping $suite_name"
-    fi
-}
-
-run_suites() {
-    for suite in $*; do
-        run_suite $suite
-    done
-}
-
-export NAME MOUNT START CLEAN
-. $LUSTRE/tests/cfg/$NAME.sh
-
-assert_env mds_HOST
-assert_env ost_HOST OSTCOUNT
-assert_env FSNAME MOUNT MOUNT2
-
-setup_if_needed
-init_logging
-
-run_suites ${ACC_SM_ONLY:-$DEFAULT_SUITES}
-
-RC=$?
-title FINISHED
-echo "Finished at `date` in $((`date +%s` - $STARTTIME))s"
-print_summary
-[ "$MSKIPPED" = 1 ] && log "FAIL: remote MDS tests skipped" && RC=1
-[ "$OSKIPPED" = 1 ] && log "FAIL: remote OST tests skipped" && RC=1
-echo "$0: completed with rc $RC" && exit $RC
+#
+# usage: acceptance-small.sh [test list]
+#      if no tests are specified, they are taken from test-groups/regression
+#      if {TEST_NAME}=no is set, that test script is skipped
+DEFAULT_SUITES="${@:-$ACC_SM_ONLY}"
+DEFAULT_SUITES="${DEFAULT_SUITES:-$(cat test-groups/regression)}"
+for SUB in $DEFAULT_SUITES; do
+       ENV=$(echo $SUB | tr "[:lower:]-" "[:upper:]_")
+       [ "$(eval echo \$$ENV)" = "no" ] && continue
+       SUITES="$SUITES $SUB"
+done
+sh auster -r -v -f ${NAME:-lustre} $SUITES
index 2a57914..7397bc5 100644 (file)
@@ -2577,6 +2577,10 @@ thread_sanity() {
         lassert 23 "$msg (PDSH problems?)" '(($tstarted && $tmin && $tmax))' || return $?
         lassert 24 "$msg" '(($tstarted >= $tmin && $tstarted <= $tmax ))' || return $?
 
+       [ $tmin -eq $tmax -a $tmin -eq $tstarted ] &&
+               skip_env "module parameter forced $facet thread count" &&
+               tmin=3 && tmax=$((3 * tmax))
+
         # Check that we can change min/max
        do_facet $facet "lctl set_param ${paramp}.threads_min=$((tmin + ncpts))"
        do_facet $facet "lctl set_param ${paramp}.threads_max=$((tmax - ncpts))"
index 1416303..f4297ff 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 #
 # Script which does some basic tests to ensure we haven't regressed.
 # Probably a good idea to run this before doing any checkins.
@@ -16,8 +16,8 @@ init_test_env $@
 init_logging
 
 RUNTESTS_SRC=${RUNTESTS_SRC:-"/etc /bin"}
-[ "$COUNT" ] || COUNT=1000
-[ "$SLOW" = "no" ] && COUNT=100
+[ "$COUNT" ] || COUNT=10000
+[ "$SLOW" = "no" ] && COUNT=1000
 
 [ "$MCREATE" ] || MCREATE=mcreate
 
@@ -67,12 +67,15 @@ mkdir $DST || error "can't mkdir $DST" 10
 FILES=$TMP/runtests.files
 # use "NUL" instead of newline as filename terminator, bug 19702 
 find $RUNTESTS_SRC -type f -mtime +1 | head -n $COUNT | tr '\n' '\0' > $FILES
-[ -s "$FILES" ] || error "$RUNTESTS_SRC contains only files modifed less than 2 days ago"
+[ -s "$FILES" ] ||
+       error "$RUNTESTS_SRC contains only files modifed less than 2 days ago"
+COUNT=$(xargs -0 -n 1 echo < $FILES | wc -l)
 
-log "copying files from $RUNTESTS_SRC to $DST$RUNTESTS_SRC at `date`"
-tar cf - --null --files-from $FILES | tar xvf - -C $DST > /dev/null || error "copying $RUNTESTS_SRC" 11
+log "copying $COUNT files from $RUNTESTS_SRC to $DST$RUNTESTS_SRC at `date`"
+tar cf - --null --files-from $FILES | tar xvf - -C $DST > /dev/null ||
+       error "copying $RUNTESTS_SRC" 11
 
-log "comparing newly copied files at `date`"
+log "comparing $COUNT newly copied files at `date`"
 
 cat $FILES | tr "\0" "\n" | ( rc=0; while read f; do
        [ $V ] && log "verifying $DST/$f"
@@ -85,10 +88,10 @@ log "finished at `date` ($(($(date +%s) - START)))"
 stopall || exit 19
 setupall || exit 20
 
-log "comparing previously copied files"
+log "comparing $COUNT previously copied files"
 cat $FILES | tr "\0" "\n" | ( rc=0; while read f; do
-        [ $V ] && log "verifying $DST/$f"
-        diff -q "$f" "$DST/$f" || rc=22
+       [ $V ] && log "verifying $DST/$f"
+       diff -q "$f" "$DST/$f" || rc=22
 done
 [ "$rc" = 0 ] || error_exit "old and new files are different: rc=$rc" )
 
@@ -114,7 +117,7 @@ fi
 # mkdirmany test (bug 589)
 log "running $MKDIRMANY $MOUNT/base$$ 100"
 $MKDIRMANY $MOUNT/base$$ 100 || error "mkdirmany failed"
-log "removing mkdirmany directories"
+log "removing $MKDIRMANY directories"
 rmdir $MOUNT/base$$* || error "mkdirmany cleanup failed"
 
 log "done"
index 5eedb00..65554fc 100644 (file)
@@ -194,7 +194,7 @@ test_fsx() {
     rm -f $testfile
     $LFS setstripe -c -1 $testfile
     CMD="fsx -c 50 -p 1000 -S $FSX_SEED -P $TMP -l $FSX_SIZE \
-        -N $((FSX_COUNT * 100)) $testfile"
+        -N $((FSX_COUNT * 100)) $FSXOPT $testfile"
     echo "Using: $CMD"
     $CMD || error "fsx failed"
     rm -f $testfile
index 81c1125..1bc10ae 100644 (file)
@@ -3097,28 +3097,30 @@ test_51b() {
 run_test 51b "mkdir .../t-0 --- .../t-$NUMTEST ===================="
 
 test_51ba() { # LU-993
-        local BASE=$DIR/d51b
-        # unlink all but 100 subdirectories, then check it still works
-        local LEFT=100
-        local DELETE=$((NUMTEST - LEFT))
-
-        ! [ -d "${BASE}/t-$DELETE" ] && skip "test_51b() not run" && return 0
-
-        # for ldiskfs the nlink count should be 1, but this is OSD specific
-        # and so this is listed for informational purposes only
-        log "nlink before: $(stat -c %h $BASE)"
-        unlinkmany -d $BASE/t- $DELETE ||
-                error "unlink of first $DELETE subdirs failed"
-
-        log "nlink between: $(stat -c %h $BASE)"
-        local FOUND=$(ls -l ${BASE} | wc -l)
-        FOUND=$((FOUND - 1))  # trim the first line of ls output
-        [ $FOUND -ne $LEFT ] &&
-                error "can't find subdirs: found only $FOUND/$LEFT"
-
-        unlinkmany -d $BASE/t- $DELETE $LEFT ||
-                error "unlink of second $LEFT subdirs failed"
-        log "nlink after: $(stat -c %h $BASE)"
+       local BASE=$DIR/d51b
+       # unlink all but 100 subdirectories, then check it still works
+       local LEFT=100
+       local DELETE=$((NUMTEST - LEFT))
+
+       # continue on to run this test even if 51b didn't finish,
+       # just to delete the many subdirectories created.
+       ! [ -d "${BASE}/t-1" ] && skip "test_51b() not run" && return 0
+
+       # for ldiskfs the nlink count should be 1, but this is OSD specific
+       # and so this is listed for informational purposes only
+       log "nlink before: $(stat -c %h $BASE)"
+       unlinkmany -d $BASE/t- $DELETE ||
+               error "unlink of first $DELETE subdirs failed"
+
+       log "nlink between: $(stat -c %h $BASE)"
+       local FOUND=$(ls -l ${BASE} | wc -l)
+       FOUND=$((FOUND - 1))  # trim the first line of ls output
+       [ $FOUND -ne $LEFT ] &&
+               error "can't find subdirs: found only $FOUND/$LEFT"
+
+       unlinkmany -d $BASE/t- $DELETE $LEFT ||
+               error "unlink of second $LEFT subdirs failed"
+       log "nlink after: $(stat -c %h $BASE)"
 }
 run_test 51ba "rmdir .../t-0 --- .../t-$NUMTEST"
 
@@ -4206,7 +4208,7 @@ test_65ib() { # bug12836
 run_test 65ib "getstripe -v on -1 default directory striping"
 
 test_65ic() { # bug12836
-       $LFS find -mtime -1 $MOUNT || error "find $MOUNT failed"
+       $LFS find -mtime -1 $MOUNT > /dev/null || error "find $MOUNT failed"
 }
 run_test 65ic "new find on -1 default directory striping"
 
index f015397..26ee314 100644 (file)
@@ -330,7 +330,8 @@ run_test 15 "test out-of-space with multiple writers ==========="
 test_16() {
        rm -f $MOUNT1/fsxfile
        lfs setstripe $MOUNT1/fsxfile -c -1 # b=10919
-       fsx -c 50 -p 100 -N 2500 -l $((SIZE * 256)) -S 0 $MOUNT1/fsxfile $MOUNT2/fsxfile
+       fsx -c 50 -p 100 -N 2500 -l $((SIZE * 256)) -S 0 $FSXOPT \
+               $MOUNT1/fsxfile $MOUNT2/fsxfile
 }
 run_test 16 "2500 iterations of dual-mount fsx ================="
 
index bf2c5fe..76453d7 100644 (file)
@@ -1,10 +1,10 @@
+runtests
 sanity
-metadata-updates
-sanity-benchmark
 sanityn
-lfsck
-liblustre
+sanity-benchmark
+metadata-updates
 racer
+lnet-selftest
 replay-single
 conf-sanity
 recovery-small
@@ -17,8 +17,8 @@ sanity-sec
 sanity-gss
 lustre_rsync-test
 ost-pools
-lnet-selftest
 mmp
 obdfilter-survey
 sgpdd-survey
 sanity-scrub
+lfsck