Whamcloud - gitweb
LU-1538 tests: standardize test script init - sanity 26/41226/6
authorAndreas Dilger <adilger@whamcloud.com>
Mon, 3 Jun 2019 14:39:19 +0000 (08:39 -0600)
committerOleg Drokin <green@whamcloud.com>
Tue, 6 Apr 2021 04:42:08 +0000 (04:42 +0000)
Standardize the initial Lustre test script initialization of the
test-framework.sh 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 PATH, NAME, TMP, LFS, LCTL
variable initialization, since it is already done in init_test_env().

Move MACHINEFILE into init_test_env().

Move get_lustre_env() to the end of init_test_env(). All test scripts
currently call init_test_env() and this move will allow all test
scripts to use the variables defined in get_lustre_env() without
having to modify the individual test scripts.

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

Lustre-change: https://review.whamcloud.com/34863
Lustre-commit: 8fa23490bb5fd0df2b1def8b14d51919abde6555

Signed-off-by: James Nunez <jnunez@whamcloud.com>
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Change-Id: I1ef6639bcb3eb5179bd44da13b35fd843c267156
Reviewed-by: Jian Yu <yujian@whamcloud.com>
Reviewed-by: Wei Liu <sarah@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/41226
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
lustre/tests/llmount.sh
lustre/tests/llmountcleanup.sh
lustre/tests/sanity.sh
lustre/tests/test-framework.sh

index 82217bc..1ecb983 100755 (executable)
@@ -1,11 +1,8 @@
 #!/bin/bash
-export PATH=`dirname $0`/../utils:$PATH
-NAME=${NAME:-local}
 
-LUSTRE=${LUSTRE:-`dirname $0`/..}
+LUSTRE=${LUSTRE:-$(dirname $0)/..}
 . $LUSTRE/tests/test-framework.sh
 init_test_env $@
-. ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
 
 [ -n "$LOAD" ] && load_modules && exit 0
 [ -z "$NOFORMAT" ] && formatall
index 076faa7..454ed6e 100755 (executable)
@@ -1,10 +1,7 @@
 #!/bin/bash
-export PATH=`dirname $0`/../utils:$PATH
-NAME=${NAME:-local}
 
-LUSTRE=${LUSTRE:-`dirname $0`/..}
+LUSTRE=${LUSTRE:-$(dirname $0)/..}
 . $LUSTRE/tests/test-framework.sh
 init_test_env $@
-. ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
 
 cleanupall -f
index 3fbdbf4..89d52fe 100755 (executable)
@@ -1,5 +1,4 @@
 #!/bin/bash
-# -*- tab-width: 8; indent-tabs-mode: t; -*-
 #
 # Run select tests by setting ONLY, or as arguments to the script.
 # Skip specific tests by setting EXCEPT.
@@ -8,42 +7,16 @@
 set -e
 
 ONLY=${ONLY:-"$*"}
-# bug number for skipped test: LU-9693 LU-6493 LU-9693 LU-11058
-ALWAYS_EXCEPT="$SANITY_EXCEPT  42a     42b     42c     77k"
-# UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
-
-# skipped tests: LU-8411 LU-9096 LU-9054 ..
-ALWAYS_EXCEPT="  407     253     312     $ALWAYS_EXCEPT"
-
-if $SHARED_KEY; then
-# bug number for skipped tests:        LU-9795 (all below)
-       ALWAYS_EXCEPT="$ALWAYS_EXCEPT   17n     60a     133g    300f"
-fi
-
-if [[ $(uname -m) = aarch64 ]]; then
-       # bug number:    LU-11596 (all below)
-       ALWAYS_EXCEPT+=" 42d 42e 63a 63b 64a 64b 64c"
-       # bug number:    LU-11671 LU-11594 LU-11667 LU-11729
-       ALWAYS_EXCEPT+=" 45       103a      317      810"
-fi
 
 # Check Grants after these tests
-GRANT_CHECK_LIST="$GRANT_CHECK_LIST 42a 42b 42c 42d 42e 63a 63b 64a 64b 64c"
-SRCDIR=$(cd $(dirname $0); echo $PWD)
-export PATH=$PATH:/sbin
-
-TMP=${TMP:-/tmp}
+GRANT_CHECK_LIST="$GRANT_CHECK_LIST 42a 42b 42c 42d 42e 63a 63b 64a 64b 64c 64d"
 OSC=${OSC:-"osc"}
 
 CC=${CC:-cc}
-CHECKSTAT=${CHECKSTAT:-"checkstat -v"}
 CREATETEST=${CREATETEST:-createtest}
-LFS=${LFS:-lfs}
 LVERIFY=${LVERIFY:-ll_dirstripe_verify}
-LCTL=${LCTL:-lctl}
 OPENFILE=${OPENFILE:-openfile}
 OPENUNLINK=${OPENUNLINK:-openunlink}
-export MULTIOP=${MULTIOP:-multiop}
 READS=${READS:-"reads"}
 MUNLINK=${MUNLINK:-munlink}
 SOCKETSERVER=${SOCKETSERVER:-socketserver}
@@ -56,21 +29,34 @@ CHECK_GRANT=${CHECK_GRANT:-"yes"}
 GRANT_CHECK_LIST=${GRANT_CHECK_LIST:-""}
 export PARALLEL=${PARALLEL:-"no"}
 
-export NAME=${NAME:-local}
-
-SAVE_PWD=$PWD
-
-CLEANUP=${CLEANUP:-:}
-SETUP=${SETUP:-:}
 TRACE=${TRACE:-""}
-LUSTRE=${LUSTRE:-$(cd $(dirname $0)/..; echo $PWD)}
 LUSTRE_TESTS_API_DIR=${LUSTRE_TESTS_API_DIR:-${LUSTRE}/tests/clientapi}
+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_EXCEPT "
+# bug number for skipped test: LU-9693 LU-6493 LU-9693 LU-11058
+ALWAYS_EXCEPT+="                42a     42b     42c     77k"
+# UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
+
+# skipped tests: LU-8411 LU-9096 LU-9054 ..
+ALWAYS_EXCEPT="  407     253     312     $ALWAYS_EXCEPT"
+
+if $SHARED_KEY; then
+# bug number for skipped tests:        LU-9795 (all below)
+       ALWAYS_EXCEPT="$ALWAYS_EXCEPT   17n     60a     133g    300f"
+fi
+
+if [[ $(uname -m) = aarch64 ]]; then
+       # bug number:    LU-11596 (all below)
+       ALWAYS_EXCEPT+=" 42d 42e 63a 63b 64a 64b 64c"
+       # bug number:    LU-11671 LU-11665 LU-11594 LU-11667 LU-11729
+       ALWAYS_EXCEPT+=" 45       101c     103a     317      810"
+fi
+
 # skip nfs tests on kernels >= 4.14.0 until they are fixed
 if [ $LINUX_VERSION_CODE -ge $(version_code 4.14.0) ]; then
        # bug number:   LU-12661
@@ -132,6 +118,7 @@ elif [ -r /etc/os-release ]; then
        fi
 fi
 
+build_test_filter
 FAIL_ON_ERROR=false
 
 cleanup() {
@@ -168,8 +155,6 @@ rm -rf $DIR/[Rdfs][0-9]*
 
 check_runas_id $RUNAS_ID $RUNAS_GID $RUNAS
 
-build_test_filter
-
 if [ "${ONLY}" = "MOUNT" ] ; then
        echo "Lustre is up, please go on"
        exit
@@ -7270,7 +7255,7 @@ test_65j() { # bug6367
        sync; sleep 1
 
        # if we aren't already remounting for each test, do so for this test
-       if [ "$CLEANUP" = ":" -a "$I_MOUNTED" = "yes" ]; then
+       if [ "$I_MOUNTED" = "yes" ]; then
                cleanup || error "failed to unmount"
                setup
        fi
index 4f84ef3..0a6111f 100755 (executable)
@@ -419,6 +419,11 @@ init_test_env() {
        fi
 
        export TF_FAIL=${TF_FAIL:-$TMP/tf.fail}
+
+       export MACHINEFILE=${MACHINEFILE:-$TMP/$(basename $0 .sh).machines}
+       . ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
+       get_lustre_env
+
 }
 
 check_cpt_number() {