Whamcloud - gitweb
LU-1538 tests: standardize test script init - dne-part-4 55/35255/3
authorAndreas Dilger <adilger@whamcloud.com>
Mon, 17 Jun 2019 22:20:41 +0000 (16:20 -0600)
committerOleg Drokin <green@whamcloud.com>
Thu, 27 Jun 2019 21:33:53 +0000 (21:33 +0000)
Standardize the initial Lustre test script initialization for
clarity and consistency.

The LUSTRE path is already normalized in init_test_env(), so
this doesn't need to be done in the caller.  Use $(...) subshells
instead of `...` in the affected lines.  Remove NAME, CHECKSTAT,
TMP, SAVE_PWD,SRCDIR, PATH, MULTIOP, SETUP, CLEANUP variable
initialization, since it is already done in init_test_env() or
not needed in the test script.  Remove all calls to get_lustre_env()
in the test scripts since this is called in init_test_env().

Move all definitions of ALWAYS_EXCEPT and SLOW to after
init_test_env() and init_logging() and call build_test_filter()
immediately after the ALWAYS_EXCEPT and SLOW definitions.

Test-Parameters: trivial
Test-Parameters: testgroup=review-dne-part-4
Signed-off-by: James Nunez <jnunez@whamcloud.com>
Change-Id: I9d2a7e6bedd2d66e5ee564405b86b6206226769f
Reviewed-on: https://review.whamcloud.com/35255
Tested-by: Jenkins
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Jian Yu <yujian@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/tests/insanity.sh
lustre/tests/mmp.sh
lustre/tests/replay-ost-single.sh
lustre/tests/replay-single.sh
lustre/tests/sanity-dom.sh
lustre/tests/sanity-flr.sh
lustre/tests/sanity-pfl.sh
lustre/tests/sanity-quota.sh

index 1d91a59..917c23c 100755 (executable)
@@ -4,30 +4,22 @@
 
 set -e
 
-LUSTRE=${LUSTRE:-`dirname $0`/..}
+LUSTRE=${LUSTRE:-$(dirname $0)/..}
 . $LUSTRE/tests/test-framework.sh
-
 init_test_env $@
-
-. ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
 init_logging
 
 # bug number for skipped test:
 ALWAYS_EXCEPT="$INSANITY_EXCEPT"
 # UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
 
+build_test_filter
+
 if [ "$FAILURE_MODE" = "HARD" ]; then
        skip_env "$TESTSUITE: is not functional with FAILURE_MODE = HARD, " \
                "please use recovery-double-scale, bz20407"
 fi
 
-[ "$SLOW" = "no" ] && EXCEPT_SLOW=""
-
-SETUP=${SETUP:-""}
-CLEANUP=${CLEANUP:-""}
-
-build_test_filter
-
 SINGLECLIENT=${SINGLECLIENT:-$HOSTNAME}
 LIVE_CLIENT=${LIVE_CLIENT:-$SINGLECLIENT}
 FAIL_CLIENTS=${FAIL_CLIENTS:-$RCLIENTS}
index d3b5632..1db6ff4 100755 (executable)
@@ -10,19 +10,17 @@ set -e
 
 ONLY=${ONLY:-"$*"}
 
-# bug number for skipped test:
-ALWAYS_EXCEPT=${ALWAYS_EXCEPT:-"$MMP_EXCEPT"}
-# UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
-
-SRCDIR=$(cd $(dirname $0); echo $PWD)
-export PATH=$PWD/$SRCDIR:$SRCDIR:$SRCDIR/../utils:$PATH:/sbin
-
-LUSTRE=${LUSTRE:-$(cd $(dirname $0)/..; echo $PWD)}
+LUSTRE=${LUSTRE:-$(dirname $0)/..}
 . $LUSTRE/tests/test-framework.sh
 init_test_env $@
-. ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
 init_logging
 
+# bug number for skipped test:
+ALWAYS_EXCEPT=$MMP_EXCEPT
+# UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
+
+build_test_filter
+
 remote_mds_nodsh && skip "remote MDS with nodsh"
 remote_ost_nodsh && skip "remote OST with nodsh"
 
@@ -36,8 +34,6 @@ fi
 SAVED_FAIL_ON_ERROR=$FAIL_ON_ERROR
 FAIL_ON_ERROR=false
 
-build_test_filter
-
 # Get the failover facet.
 get_failover_facet() {
     local facet=$1
index d85bf3c..350f099 100755 (executable)
@@ -2,41 +2,34 @@
 
 set -e
 
-LUSTRE=${LUSTRE:-$(cd $(dirname $0)/..; echo $PWD)}
-SETUP=${SETUP:-""}
-CLEANUP=${CLEANUP:-""}
+LUSTRE=${LUSTRE:-$(dirname $0)/..}
 . $LUSTRE/tests/test-framework.sh
 init_test_env $@
-. ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
 init_logging
 
-# While we do not use OSTCOUNT=1 setup anymore,
-# ost1failover_HOST is used
-#ostfailover_HOST=${ostfailover_HOST:-$ost_HOST}
-#failover= must be defined in OST_MKFS_OPTIONS if ostfailover_HOST != ost_HOST
-
-require_dsh_ost || exit 0
-
 # bug number for skipped test:
 ALWAYS_EXCEPT="$REPLAY_OST_SINGLE_EXCEPT"
 # UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
 
 # bug number for SLOW test:
-# time in minutes:                 40"
+# time in minutes:                 40 min"
 [ "$SLOW" = "no" ] && EXCEPT_SLOW="5"
 
 if [ $(facet_fstype $SINGLEMDS) = "zfs" ]; then
 # bug number for slow tests:                 LU-2887
-# time in minutes:                           32  12.5"
+# time in minutes:                           32  12.5 min"
        [ "$SLOW" = "no" ] && EXCEPT_SLOW+=" 8a  8b"
-       if [ $MDSCOUNT -gt 1 ]; then
-# bug number for skipped test:
-               ALWAYS_EXCEPT+=""
-       fi
 fi
 
 build_test_filter
 
+# While we do not use OSTCOUNT=1 setup anymore,
+# ost1failover_HOST is used
+#ostfailover_HOST=${ostfailover_HOST:-$ost_HOST}
+#failover= must be defined in OST_MKFS_OPTIONS if ostfailover_HOST != ost_HOST
+
+require_dsh_ost || exit 0
+
 check_and_setup_lustre
 assert_DIR
 rm -rf $DIR/[df][0-9]*
index 08b4a6c..ec64c0b 100755 (executable)
@@ -1,47 +1,36 @@
 #!/bin/bash
 
 set -e
-#set -v
-
-#
-# This test needs to be run on the client
-#
-SAVE_PWD=$PWD
-export MULTIOP=${MULTIOP:-multiop}
-LUSTRE=${LUSTRE:-$(cd $(dirname $0)/..; echo $PWD)}
-SETUP=${SETUP:-}
-CLEANUP=${CLEANUP:-}
+
+LUSTRE=${LUSTRE:-$(dirname $0)/..}
 . $LUSTRE/tests/test-framework.sh
 init_test_env $@
-. ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
 init_logging
-CHECK_GRANT=${CHECK_GRANT:-"yes"}
-GRANT_CHECK_LIST=${GRANT_CHECK_LIST:-""}
 
-require_dsh_mds || exit 0
-
-# Skip these tests
-# bug number for skipped tests:
 ALWAYS_EXCEPT="$REPLAY_SINGLE_EXCEPT "
-# UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
-
-# time in minutes:                 7.5"
-[ "$SLOW" = "no" ] && EXCEPT_SLOW="44b"
 
 if [ $(facet_fstype $SINGLEMDS) = "zfs" ]; then
-# bug number for skipped test: LU-11388
-       ALWAYS_EXCEPT+="131b"
+       # bug number for skipped test: LU-11388
+       ALWAYS_EXCEPT+="               131b"
+       # UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
 fi
 if $SHARED_KEY; then
-# bug number for skipped tests: LU-9795 (all below)
+       # bug number for skipped tests: LU-9795 (all below)
        ALWAYS_EXCEPT="$ALWAYS_EXCEPT   0b      0c      0d      34      45"
        ALWAYS_EXCEPT="$ALWAYS_EXCEPT   47      58b     58c     71a     85a"
        ALWAYS_EXCEPT="$ALWAYS_EXCEPT   85b     86      88      89      90"
        ALWAYS_EXCEPT="$ALWAYS_EXCEPT   93a     100a    100b    120"
 fi
 
+# time in minutes:                 7.5 (min)"
+[ "$SLOW" = "no" ] && EXCEPT_SLOW="44b"
+
 build_test_filter
 
+CHECK_GRANT=${CHECK_GRANT:-"yes"}
+GRANT_CHECK_LIST=${GRANT_CHECK_LIST:-""}
+
+require_dsh_mds || exit 0
 check_and_setup_lustre
 
 mkdir -p $DIR
index 01bedae..2ebccc3 100644 (file)
@@ -7,33 +7,21 @@
 set -e
 
 ONLY=${ONLY:-"$*"}
-# bug number for skipped test:
-ALWAYS_EXCEPT="$SANITY_DOM_EXCEPT"
-[ "$SLOW" = "no" ] && EXCEPT_SLOW=""
-# UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
-
-LUSTRE=${LUSTRE:-$(cd $(dirname $0)/..; echo $PWD)}
 
+LUSTRE=${LUSTRE:-$(dirname $0)/..}
 . $LUSTRE/tests/test-framework.sh
-CLEANUP=${CLEANUP:-:}
-SETUP=${SETUP:-:}
 init_test_env $@
-. ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
 init_logging
 
-if [ $(facet_fstype $SINGLEMDS) = "zfs" ]; then
-# bug number for skipped test:
-       ALWAYS_EXCEPT+=""
-       if [ $MDSCOUNT -gt 1 ]; then
 # bug number for skipped test:
-               ALWAYS_EXCEPT+=""
-       fi
-fi
+ALWAYS_EXCEPT="$SANITY_DOM_EXCEPT"
+# UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
+
+build_test_filter
 
 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.10.56) ]] ||
        { skip "Need MDS version at least 2.10.56"; exit 0; }
 
-MULTIOP=${MULTIOP:-multiop}
 OPENFILE=${OPENFILE:-openfile}
 MOUNT_2=${MOUNT_2:-"yes"}
 FAIL_ON_ERROR=false
@@ -46,8 +34,6 @@ if [[ $UID -eq 0 && $RUNAS_ID -eq 0 ]]; then
 fi
 check_runas_id $RUNAS_ID $RUNAS_GID $RUNAS
 
-build_test_filter
-
 DOM="yes"
 DOM_SIZE=${DOM_SIZE:-"$((1024*1024))"}
 OSC="mdc"
index 33732e3..9a1b82d 100644 (file)
@@ -5,21 +5,21 @@
 set -e
 set +o posix
 
-SRCDIR=$(dirname $0)
-export PATH=$PWD/$SRCDIR:$SRCDIR:$PWD/$SRCDIR/../utils:$PATH:/sbin
 
 ONLY=${ONLY:-"$*"}
-# Bug number for skipped test:    LU-11381
-ALWAYS_EXCEPT="$SANITY_FLR_EXCEPT 201"
-# UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
 
-LUSTRE=${LUSTRE:-$(cd $(dirname $0)/..; echo $PWD)}
+LUSTRE=${LUSTRE:-$(dirname $0)/..}
 . $LUSTRE/tests/test-framework.sh
 init_test_env $@
-. ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
-get_lustre_env
 init_logging
 
+ALWAYS_EXCEPT="$SANITY_FLR_EXCEPT "
+# Bug number for skipped test:    LU-11381
+ALWAYS_EXCEPT+="                  201"
+# UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
+
+build_test_filter
+
 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.10.56) ]] ||
        { skip "Need MDS version at least 2.10.56"; exit 0; }
 
@@ -31,8 +31,6 @@ check_and_setup_lustre
 DIR=${DIR:-$MOUNT}
 assert_DIR
 
-build_test_filter
-
 assert_DIR
 rm -rf $DIR/[Rdfs][0-9]*
 
index 12d6abf..35640cf 100644 (file)
@@ -4,34 +4,25 @@
 # Skip specific tests by setting EXCEPT.
 set -e
 
-SRCDIR=$(dirname $0)
-export PATH=$PWD/$SRCDIR:$SRCDIR:$PWD/$SRCDIR/../utils:$PATH:/sbin
-
 ONLY=${ONLY:-"$*"}
-# Bug number for skipped test:
-ALWAYS_EXCEPT="$SANITY_PFL_EXCEPT"
-# UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
 
-TMP=${TMP:-/tmp}
-CHECKSTAT=${CHECKSTAT:-"checkstat -v"}
-
-LUSTRE=${LUSTRE:-$(cd $(dirname $0)/..; echo $PWD)}
+LUSTRE=${LUSTRE:-$(dirname $0)/..}
 . $LUSTRE/tests/test-framework.sh
 init_test_env $@
-. ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
 init_logging
 
+# bug number for skipped test:
+ALWAYS_EXCEPT="$SANITY_PFL_EXCEPT"
+# UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
+
+build_test_filter
+
 check_and_setup_lustre
 
 if [[ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.9.51) ]]; then
        skip_env "Need MDS version at least 2.9.51"
 fi
 
-[ "$ALWAYS_EXCEPT$EXCEPT" ] &&
-       echo "Skipping tests: $ALWAYS_EXCEPT $EXCEPT"
-
-build_test_filter
-
 [ $UID -eq 0 -a $RUNAS_ID -eq 0 ] &&
        error "\$RUNAS_ID set to 0, but \$UID is also 0!"
 check_runas_id $RUNAS_ID $RUNAS_GID $RUNAS
index a7cf361..c0ac7c3 100755 (executable)
@@ -3,22 +3,32 @@
 # Run select tests by setting ONLY, or as arguments to the script.
 # Skip specific tests by setting EXCEPT.
 #
-# Run test by setting NOSETUP=true when ltest has setup env for us
 set -e
 
-SRCDIR=$(dirname $0)
-export PATH=$PWD/$SRCDIR:$SRCDIR:$PWD/$SRCDIR/../utils:$PATH:/sbin
-
 ONLY=${ONLY:-"$*"}
-# Bug number for skipped test:      LU-5152
-ALWAYS_EXCEPT="$SANITY_QUOTA_EXCEPT 55"
+
+LUSTRE=${LUSTRE:-$(dirname $0)/..}
+. $LUSTRE/tests/test-framework.sh
+init_test_env $@
+init_logging
+
+ALWAYS_EXCEPT="$SANITY_QUOTA_EXCEPT "
+# Bug number for skipped test:  LU-5152
+ALWAYS_EXCEPT+="                55"
 # UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
 
-[ "$ALWAYS_EXCEPT$EXCEPT" ] &&
-       echo "Skipping tests: $ALWAYS_EXCEPT $EXCEPT"
+# Test duration:                   30 min
+[ "$SLOW" = "no" ] && EXCEPT_SLOW="61"
 
-TMP=${TMP:-/tmp}
+if [ $(facet_fstype $SINGLEMDS) = "zfs" ]; then
+       # bug number:                        LU-2887
+       # Test duration:                     21      9 min"
+       [ "$SLOW" = "no" ] && EXCEPT_SLOW+=" 12a     9"
+fi
 
+build_test_filter
+
+DIRECTIO=${DIRECTIO:-$LUSTRE/tests/directio}
 ORIG_PWD=${PWD}
 TSTID=${TSTID:-60000}
 TSTID2=${TSTID2:-60001}
@@ -30,14 +40,6 @@ MAX_DQ_TIME=604800
 MAX_IQ_TIME=604800
 QTYPE="ugp"
 
-LUSTRE=${LUSTRE:-$(cd $(dirname $0)/..; echo $PWD)}
-. $LUSTRE/tests/test-framework.sh
-init_test_env $@
-. ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
-
-init_logging
-DIRECTIO=${DIRECTIO:-$LUSTRE/tests/directio}
-
 require_dsh_mds || exit 0
 require_dsh_ost || exit 0
 
@@ -48,18 +50,6 @@ if [ $(facet_fstype $SINGLEMDS) == ldiskfs ] &&
        skip_env "e2fsprogs doesn't support quota" && exit 0
 fi
 
-# Test duration:                   30 min
-[ "$SLOW" = "no" ] && EXCEPT_SLOW="61"
-
-if [ $(facet_fstype $SINGLEMDS) = "zfs" ]; then
-       # bug number for skipped test:
-       ALWAYS_EXCEPT="$ALWAYS_EXCEPT"
-
-       # bug number:                        LU-2887
-       # Test duration:                     21      9 min"
-       [ "$SLOW" = "no" ] && EXCEPT_SLOW+=" 12a     9"
-fi
-
 QUOTALOG=${TESTSUITELOG:-$TMP/$(basename $0 .sh).log}
 
 [ "$QUOTALOG" ] && rm -f $QUOTALOG || true
@@ -83,8 +73,6 @@ SHOW_QUOTA_INFO_USER="$LFS quota -t -u $DIR"
 SHOW_QUOTA_INFO_GROUP="$LFS quota -t -g $DIR"
 SHOW_QUOTA_INFO_PROJID="eval is_project_quota_supported && $LFS quota -t -p $DIR"
 
-build_test_filter
-
 lustre_fail() {
        local fail_node=$1
        local fail_loc=$2