From f5f3670b5fa3e972929d732f4d217c6a8442f014 Mon Sep 17 00:00:00 2001 From: Andreas Dilger Date: Mon, 18 Jun 2012 20:21:05 -0600 Subject: [PATCH 1/1] LU-1538 tests: cleanup test output, acc-small 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 Change-Id: I8aae9c1af508d8173135f0938e0a26d9731253df Reviewed-on: http://review.whamcloud.com/3132 Tested-by: Hudson Tested-by: Maloo Reviewed-by: Li Wei Reviewed-by: Keith Mannthey Reviewed-by: Oleg Drokin --- lustre/tests/acceptance-small.sh | 197 +++--------------------------------- lustre/tests/conf-sanity.sh | 4 + lustre/tests/runtests | 25 +++-- lustre/tests/sanity-benchmark.sh | 2 +- lustre/tests/sanity.sh | 48 ++++----- lustre/tests/sanityn.sh | 3 +- lustre/tests/test-groups/regression | 10 +- 7 files changed, 63 insertions(+), 226 deletions(-) diff --git a/lustre/tests/acceptance-small.sh b/lustre/tests/acceptance-small.sh index a863f23..46d7289 100755 --- a/lustre/tests/acceptance-small.sh +++ b/lustre/tests/acceptance-small.sh @@ -1,186 +1,13 @@ #!/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 diff --git a/lustre/tests/conf-sanity.sh b/lustre/tests/conf-sanity.sh index 2a57914..7397bc5 100644 --- a/lustre/tests/conf-sanity.sh +++ b/lustre/tests/conf-sanity.sh @@ -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))" diff --git a/lustre/tests/runtests b/lustre/tests/runtests index 1416303..f4297ff 100755 --- a/lustre/tests/runtests +++ b/lustre/tests/runtests @@ -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" diff --git a/lustre/tests/sanity-benchmark.sh b/lustre/tests/sanity-benchmark.sh index 5eedb00..65554fc 100644 --- a/lustre/tests/sanity-benchmark.sh +++ b/lustre/tests/sanity-benchmark.sh @@ -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 diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index 81c1125..1bc10ae 100644 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -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" diff --git a/lustre/tests/sanityn.sh b/lustre/tests/sanityn.sh index f015397..26ee314 100644 --- a/lustre/tests/sanityn.sh +++ b/lustre/tests/sanityn.sh @@ -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 =================" diff --git a/lustre/tests/test-groups/regression b/lustre/tests/test-groups/regression index bf2c5fe..76453d7 100644 --- a/lustre/tests/test-groups/regression +++ b/lustre/tests/test-groups/regression @@ -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 -- 1.8.3.1