From: Emoly Liu Date: Thu, 21 Apr 2016 04:00:31 +0000 (+0800) Subject: LU-7972 tests: use $REFORMAT in test-framework.sh correctly X-Git-Tag: 2.8.53~21 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=03eb7bb98d5d7f86b37cf4d3a8965ac71bd0693e LU-7972 tests: use $REFORMAT in test-framework.sh correctly $REFORMAT is always used incorrectly in test-framework.sh, because as long as $REFORMAT is not null, format will be done, even if REFORMAT=no. This patch fixes this issue by setting/judging $REFORMAT=yes/no explicitly. Signed-off-by: Emoly Liu Change-Id: Iaabea34e0ad453b3f9f986009fa1f8bdec8a98ff Reviewed-on: http://review.whamcloud.com/19276 Reviewed-by: Andreas Dilger Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Bobi Jam --- diff --git a/lustre/tests/large-lun.sh b/lustre/tests/large-lun.sh index 2a60f90..a188624 100644 --- a/lustre/tests/large-lun.sh +++ b/lustre/tests/large-lun.sh @@ -11,7 +11,7 @@ init_test_env $@ . ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh} init_logging -if ! [ "$REFORMAT" ]; then +if [ "$REFORMAT" != "yes" ]; then skip_env "$0 reformats all devices,\ please set REFORMAT to run this test" exit 0 diff --git a/lustre/tests/sgpdd-survey.sh b/lustre/tests/sgpdd-survey.sh index cd4ec0e..a83dbf0 100644 --- a/lustre/tests/sgpdd-survey.sh +++ b/lustre/tests/sgpdd-survey.sh @@ -16,9 +16,9 @@ size=${size:-1024} [ "$SLOW" = no ] && { crghi=2; thrhi=2; } -if ! ([ "$SGPDD_YES" ] && [ "$REFORMAT" ]); then - skip_env "$0 reformats all devices, please set SGPDD_YES and REFORMAT to run this test" - exit 0 +if [ "$SGPDD_YES" != "yes" -o "$REFORMAT" != "yes" ]; then + skip_env "$0 reformats all devices, set SGPDD_YES=yes REFORMAT=yes" + exit 0 fi # Skip these tests diff --git a/lustre/tests/test-framework.sh b/lustre/tests/test-framework.sh index 27b0c10..c713d66 100755 --- a/lustre/tests/test-framework.sh +++ b/lustre/tests/test-framework.sh @@ -333,20 +333,20 @@ init_test_env() { export SHUTDOWN_ATTEMPTS=${SHUTDOWN_ATTEMPTS:-3} export OSD_TRACK_DECLARES_LBUG=${OSD_TRACK_DECLARES_LBUG:-"yes"} - # command line - - while getopts "rvwf:" opt $*; do - case $opt in - f) CONFIG=$OPTARG;; - r) REFORMAT=--reformat;; - v) VERBOSE=true;; - w) WRITECONF=writeconf;; - \?) usage;; - esac - done + # command line + + while getopts "rvwf:" opt $*; do + case $opt in + f) CONFIG=$OPTARG;; + r) REFORMAT=yes;; + v) VERBOSE=true;; + w) WRITECONF=writeconf;; + \?) usage;; + esac + done - shift $((OPTIND - 1)) - ONLY=${ONLY:-$*} + shift $((OPTIND - 1)) + ONLY=${ONLY:-$*} # print the durations of each test if "true" DDETAILS=${DDETAILS:-false} @@ -3995,15 +3995,15 @@ check_and_setup_lustre() { local MOUNTED=$(mounted_lustre_filesystems) local do_check=true - # 1. - # both MOUNT and MOUNT2 are not mounted - if ! is_mounted $MOUNT && ! is_mounted $MOUNT2; then - [ "$REFORMAT" ] && formatall - # setupall mounts both MOUNT and MOUNT2 (if MOUNT_2 is set) - setupall - is_mounted $MOUNT || error "NAME=$NAME not mounted" - export I_MOUNTED=yes - do_check=false + # 1. + # both MOUNT and MOUNT2 are not mounted + if ! is_mounted $MOUNT && ! is_mounted $MOUNT2; then + [ "$REFORMAT" = "yes" ] && formatall + # setupall mounts both MOUNT and MOUNT2 (if MOUNT_2 is set) + setupall + is_mounted $MOUNT || error "NAME=$NAME not mounted" + export I_MOUNTED=yes + do_check=false # 2. # MOUNT2 is mounted elif is_mounted $MOUNT2; then