Whamcloud - gitweb
LU-7972 tests: use $REFORMAT in test-framework.sh correctly 76/19276/6
authorEmoly Liu <emoly.liu@intel.com>
Thu, 21 Apr 2016 04:00:31 +0000 (12:00 +0800)
committerOleg Drokin <oleg.drokin@intel.com>
Mon, 2 May 2016 23:59:12 +0000 (23:59 +0000)
$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 <emoly.liu@intel.com>
Change-Id: Iaabea34e0ad453b3f9f986009fa1f8bdec8a98ff
Reviewed-on: http://review.whamcloud.com/19276
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Bobi Jam <bobijam@hotmail.com>
lustre/tests/large-lun.sh
lustre/tests/sgpdd-survey.sh
lustre/tests/test-framework.sh

index 2a60f90..a188624 100644 (file)
@@ -11,7 +11,7 @@ init_test_env $@
 . ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
 init_logging
 
 . ${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
        skip_env "$0 reformats all devices,\
                please set REFORMAT to run this test"
        exit 0
index cd4ec0e..a83dbf0 100644 (file)
@@ -16,9 +16,9 @@ size=${size:-1024}
 
 [ "$SLOW" = no ] && { crghi=2; thrhi=2; }
 
 
 [ "$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
 fi
 
 # Skip these tests
index 27b0c10..c713d66 100755 (executable)
@@ -333,20 +333,20 @@ init_test_env() {
        export SHUTDOWN_ATTEMPTS=${SHUTDOWN_ATTEMPTS:-3}
        export OSD_TRACK_DECLARES_LBUG=${OSD_TRACK_DECLARES_LBUG:-"yes"}
 
        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}
 
        # 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
        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
     # 2.
     # MOUNT2 is mounted
     elif is_mounted $MOUNT2; then