Whamcloud - gitweb
LU-1538 tests: standardize test script init - lnet 54/35254/2
authorAndreas Dilger <adilger@whamcloud.com>
Mon, 17 Jun 2019 20:59:39 +0000 (14:59 -0600)
committerOleg Drokin <green@whamcloud.com>
Wed, 3 Jul 2019 03:10:53 +0000 (03:10 +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, PATH, SAVE_PWD,
RLUSTRE, MULTIOP variable initialization, since it is already done in
init_test_env() or not needed in the test script.

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-zfs-part-3
Signed-off-by: James Nunez <jnunez@whamcloud.com>
Change-Id: I491cf3e282a1f31fb8c87440554445d708c6da1e
Reviewed-on: https://review.whamcloud.com/35254
Tested-by: Jenkins
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Jian Yu <yujian@whamcloud.com>
Reviewed-by: Wei Liu <sarah@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/tests/conf-sanity.sh
lustre/tests/lnet-selftest.sh

index 860cefb..cafcadc 100644 (file)
@@ -4,32 +4,38 @@ set -e
 
 ONLY=${ONLY:-"$*"}
 
 
 ONLY=${ONLY:-"$*"}
 
-# bug number for skipped test:
-ALWAYS_EXCEPT="$CONF_SANITY_EXCEPT"
+SRCDIR=$(dirname $0)
+PTLDEBUG=${PTLDEBUG:--1}
+LUSTRE=${LUSTRE:-$(dirname $0)/..}
+. $LUSTRE/tests/test-framework.sh
+init_test_env $@
+init_logging
+
+#                                  tool to create lustre filesystem images
+ALWAYS_EXCEPT="$CONF_SANITY_EXCEPT 32newtarball"
+
+# bug number for skipped test: LU-11915
+ALWAYS_EXCEPT="$ALWAYS_EXCEPT  110"
 # UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
 
 # UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
 
-# bug number for skipped test:
-# a tool to create lustre filesystem images
-ALWAYS_EXCEPT="32newtarball $ALWAYS_EXCEPT"
 if $SHARED_KEY; then
 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   0       31      32a     32d     35a"
        ALWAYS_EXCEPT="$ALWAYS_EXCEPT   53a     53b     54b     76a     76b"
        ALWAYS_EXCEPT="$ALWAYS_EXCEPT   76c     76d     78      103"
 fi
 
        ALWAYS_EXCEPT="$ALWAYS_EXCEPT   0       31      32a     32d     35a"
        ALWAYS_EXCEPT="$ALWAYS_EXCEPT   53a     53b     54b     76a     76b"
        ALWAYS_EXCEPT="$ALWAYS_EXCEPT   76c     76d     78      103"
 fi
 
-SRCDIR=$(dirname $0)
-PATH=$PWD/$SRCDIR:$SRCDIR:$SRCDIR/../utils:$PATH
+if ! combined_mgs_mds; then
+       # bug number for skipped test: LU-11991         LU-11990
+       ALWAYS_EXCEPT="$ALWAYS_EXCEPT  32a 32b 32c 32d 32e      66"
+       # bug number for skipped test: LU-9897  LU-12032
+       ALWAYS_EXCEPT="$ALWAYS_EXCEPT  84       123F"
+fi
 
 
-PTLDEBUG=${PTLDEBUG:--1}
-SAVE_PWD=$PWD
-LUSTRE=${LUSTRE:-$(dirname $0)/..}
-RLUSTRE=${RLUSTRE:-$LUSTRE}
-export MULTIOP=${MULTIOP:-multiop}
+#                                  8  22  40  165  (min)
+[ "$SLOW" = "no" ] && EXCEPT_SLOW="45 69 106 111"
 
 
-. $LUSTRE/tests/test-framework.sh
-init_test_env $@
-. ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
+build_test_filter
 
 # use small MDS + OST size to speed formatting time
 # do not use too small MDSSIZE/OSTSIZE, which affect the default journal size
 
 # use small MDS + OST size to speed formatting time
 # do not use too small MDSSIZE/OSTSIZE, which affect the default journal size
@@ -49,30 +55,15 @@ MDSDEV1_2=$fs2mds_DEV
 OSTDEV1_2=$fs2ost_DEV
 OSTDEV2_2=$fs3ost_DEV
 
 OSTDEV1_2=$fs2ost_DEV
 OSTDEV2_2=$fs3ost_DEV
 
-# bug number for skipped test: LU-11915
-ALWAYS_EXCEPT="$ALWAYS_EXCEPT   110"
-
-if ! combined_mgs_mds; then
-       # bug number for skipped test: LU-11991                 LU-11990
-       ALWAYS_EXCEPT="$ALWAYS_EXCEPT  32a 32b 32c 32d 32e      66"
-       # bug number for skipped test: LU-9897  LU-12032
-       ALWAYS_EXCEPT="$ALWAYS_EXCEPT  84       123F"
-fi
-
 # pass "-E lazy_itable_init" to mke2fs to speed up the formatting time
 if [[ "$LDISKFS_MKFS_OPTS" != *lazy_itable_init* ]]; then
        LDISKFS_MKFS_OPTS=$(csa_add "$LDISKFS_MKFS_OPTS" -E lazy_itable_init)
 fi
 
 # pass "-E lazy_itable_init" to mke2fs to speed up the formatting time
 if [[ "$LDISKFS_MKFS_OPTS" != *lazy_itable_init* ]]; then
        LDISKFS_MKFS_OPTS=$(csa_add "$LDISKFS_MKFS_OPTS" -E lazy_itable_init)
 fi
 
-init_logging
-
 #
 require_dsh_mds || exit 0
 require_dsh_ost || exit 0
 
 #
 require_dsh_mds || exit 0
 require_dsh_ost || exit 0
 
-#                                  8  22  40  165  (min)
-[ "$SLOW" = "no" ] && EXCEPT_SLOW="45 69 106 111"
-
 assert_DIR
 
 gen_config() {
 assert_DIR
 
 gen_config() {
@@ -275,8 +266,6 @@ generate_name() {
        cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w $1 | head -n 1
 }
 
        cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w $1 | head -n 1
 }
 
-build_test_filter
-
 if [ "$ONLY" == "setup" ]; then
        setup
        exit
 if [ "$ONLY" == "setup" ]; then
        setup
        exit
index 10631ca..ed8104d 100755 (executable)
@@ -1,11 +1,8 @@
 #!/bin/bash
 #!/bin/bash
-# -*- mode: Bash; tab-width: 4; indent-tabs-mode: t; -*-
-# vim:shiftwidth=4:softtabstop=4:tabstop=4:
 
 
-LUSTRE=${LUSTRE:-$(cd $(dirname $0)/..; echo $PWD)}
+LUSTRE=${LUSTRE:-$(dirname $0)/..}
 . $LUSTRE/tests/test-framework.sh
 init_test_env $@
 . $LUSTRE/tests/test-framework.sh
 init_test_env $@
-. ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
 init_logging
 
 ALWAYS_EXCEPT="$LNET_SELFTEST_EXCEPT"
 init_logging
 
 ALWAYS_EXCEPT="$LNET_SELFTEST_EXCEPT"
@@ -22,6 +19,8 @@ if [ -r /etc/os-release ]; then
        fi
 fi
 
        fi
 fi
 
+build_test_filter
+
 [ x$LST = x ] && skip_env "lst not found LST=$LST"
 
 # FIXME: what is the reasonable value here?
 [ x$LST = x ] && skip_env "lst not found LST=$LST"
 
 # FIXME: what is the reasonable value here?
@@ -90,8 +89,6 @@ if is_mounted $MOUNT2; then
        interim_umount1=true
 fi
 
        interim_umount1=true
 fi
 
-build_test_filter
-
 lst_prepare () {
     # Workaround for bug 15619
     lst_cleanup_all
 lst_prepare () {
     # Workaround for bug 15619
     lst_cleanup_all