Whamcloud - gitweb
LU-1538 tests: standardize test script init dne-part-1 63/35263/7
authorAndreas Dilger <adilger@whamcloud.com>
Tue, 18 Jun 2019 14:55:16 +0000 (08:55 -0600)
committerOleg Drokin <green@whamcloud.com>
Tue, 12 Nov 2019 04:06:09 +0000 (04:06 +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, SRCDIR, PATH, MULTIOP,
SETUP, CLEANUP, CHECKSTAT, TMP, SAVE_PWD, variable initialization,
since it is already done in init_test_env() or not needed in the test
scripts.  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-1
Signed-off-by: James Nunez <jnunez@whamcloud.com>
Change-Id: Ia8a1b3afcca7af645eed1d0f3dcf843e5254afe6
Reviewed-on: https://review.whamcloud.com/35263
Tested-by: jenkins <devops@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Emoly Liu <emoly@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/tests/lustre-rsync-test.sh
lustre/tests/recovery-small.sh
lustre/tests/sanityn.sh

index e8fef19..8888469 100644 (file)
@@ -1,38 +1,28 @@
 #!/bin/bash
 #!/bin/bash
-# -*- mode: Bash; tab-width: 4; indent-tabs-mode: t; -*-
-# vim:shiftwidth=4:softtabstop=4:tabstop=4:
 #
 # Run select tests by setting ONLY, or as arguments to the script.
 # Skip specific tests by setting EXCEPT.
 #
 #
 # 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
 
 set -e
 
-SRCDIR=`dirname $0`
-export PATH=$PWD/$SRCDIR:$SRCDIR:$PWD/$SRCDIR/../utils:$PATH:/sbin
-
 ONLY=${ONLY:-"$*"}
 ONLY=${ONLY:-"$*"}
-# bug number for skipped test: LU-4256
-ALWAYS_EXCEPT="$LRSYNC_EXCEPT  2b"
-# UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
-
-[ "$SLOW" = "no" ] && EXCEPT_SLOW=""
-
-[ "$ALWAYS_EXCEPT$EXCEPT" ] &&
-       echo "Skipping tests: `echo $ALWAYS_EXCEPT $EXCEPT`"
 
 KILL=/bin/kill
 
 KILL=/bin/kill
-
-TMP=${TMP:-/tmp}
 LREPL_LOG=$TMP/lustre_rsync.log
 ORIG_PWD=${PWD}
 
 LREPL_LOG=$TMP/lustre_rsync.log
 ORIG_PWD=${PWD}
 
-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
 
 init_logging
 
+ALWAYS_EXCEPT="$LRSYNC_EXCEPT "
+# bug number for skipped test: LU-4256
+ALWAYS_EXCEPT+="               2b"
+# UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
+
+build_test_filter
+
 [ -n "$FILESET" ] && skip "Not functional for FILESET set"
 
 check_and_setup_lustre
 [ -n "$FILESET" ] && skip "Not functional for FILESET set"
 
 check_and_setup_lustre
@@ -48,8 +38,6 @@ else
        error "No generic nobody group"
 fi
 
        error "No generic nobody group"
 fi
 
-build_test_filter
-
 export LRSYNC=${LRSYNC:-"$LUSTRE/utils/lustre_rsync"}
 [ ! -f "$LRSYNC" ] && export LRSYNC=$(which lustre_rsync)
 export LRSYNC="$LRSYNC -v -c no -d 2"
 export LRSYNC=${LRSYNC:-"$LUSTRE/utils/lustre_rsync"}
 [ ! -f "$LRSYNC" ] && export LRSYNC=$(which lustre_rsync)
 export LRSYNC="$LRSYNC -v -c no -d 2"
index a30aa8a..48de1b9 100755 (executable)
@@ -2,12 +2,10 @@
 
 set -e
 
 
 set -e
 
-export MULTIOP=${MULTIOP:-multiop}
 PTLDEBUG=${PTLDEBUG:--1}
 PTLDEBUG=${PTLDEBUG:--1}
-LUSTRE=${LUSTRE:-`dirname $0`/..}
+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="$RECOVERY_SMALL_EXCEPT "
 init_logging
 
 ALWAYS_EXCEPT="$RECOVERY_SMALL_EXCEPT "
@@ -23,14 +21,10 @@ if [ "$selinux_status" != "Disabled" ]; then
        $SHARED_KEY && ALWAYS_EXCEPT+=" 136"
 fi
 
        $SHARED_KEY && ALWAYS_EXCEPT+=" 136"
 fi
 
-require_dsh_mds || exit 0
-
-# also long tests: 19, 21a, 21e, 21f, 23, 27
-
-[ "$SLOW" = "no" ] && EXCEPT_SLOW=""
-
 build_test_filter
 
 build_test_filter
 
+require_dsh_mds || exit 0
+
 # Allow us to override the setup if we already have a mounted system by
 # setting SETUP=" " and CLEANUP=" "
 SETUP=${SETUP:-""}
 # Allow us to override the setup if we already have a mounted system by
 # setting SETUP=" " and CLEANUP=" "
 SETUP=${SETUP:-""}
index f1d9b97..79d762a 100755 (executable)
@@ -3,46 +3,35 @@
 set -e
 
 ONLY=${ONLY:-"$*"}
 set -e
 
 ONLY=${ONLY:-"$*"}
-# bug number for skipped test: 9977/LU-7105
-#              LU-7105
-ALWAYS_EXCEPT=" 28     $SANITYN_EXCEPT"
-# UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
-
-SRCDIR=$(dirname $0)
-PATH=$PWD/$SRCDIR:$SRCDIR:$SRCDIR/../utils:$PATH
 
 SIZE=${SIZE:-40960}
 
 SIZE=${SIZE:-40960}
-CHECKSTAT=${CHECKSTAT:-"checkstat -v"}
 OPENFILE=${OPENFILE:-openfile}
 OPENUNLINK=${OPENUNLINK:-openunlink}
 OPENFILE=${OPENFILE:-openfile}
 OPENUNLINK=${OPENUNLINK:-openunlink}
-export MULTIOP=${MULTIOP:-multiop}
 export TMP=${TMP:-/tmp}
 MOUNT_2=${MOUNT_2:-"yes"}
 CHECK_GRANT=${CHECK_GRANT:-"yes"}
 GRANT_CHECK_LIST=${GRANT_CHECK_LIST:-""}
 
 export TMP=${TMP:-/tmp}
 MOUNT_2=${MOUNT_2:-"yes"}
 CHECK_GRANT=${CHECK_GRANT:-"yes"}
 GRANT_CHECK_LIST=${GRANT_CHECK_LIST:-""}
 
-SAVE_PWD=$PWD
-
-export NAME=${NAME:-local}
-
-LUSTRE=${LUSTRE:-`dirname $0`/..}
+LUSTRE=${LUSTRE:-$(dirname $0)/..}
 . $LUSTRE/tests/test-framework.sh
 . $LUSTRE/tests/test-framework.sh
-CLEANUP=${CLEANUP:-:}
-SETUP=${SETUP:-:}
 init_test_env $@
 init_test_env $@
-. ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
-get_lustre_env
 init_logging
 
 init_logging
 
+ALWAYS_EXCEPT="$SANITYN_EXCEPT "
+# bug number for skipped test:  LU-7105
+ALWAYS_EXCEPT+="                28"
+# UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
+
 if [ $(facet_fstype $SINGLEMDS) = "zfs" ]; then
 if [ $(facet_fstype $SINGLEMDS) = "zfs" ]; then
-# bug number for skipped test:
-       ALWAYS_EXCEPT="$ALWAYS_EXCEPT "
-# LU-2829 / LU-2887 - make allowances for ZFS slowness
+       # LU-2829 / LU-2887 - make allowances for ZFS slowness
        TEST33_NFILES=${TEST33_NFILES:-1000}
 fi
        TEST33_NFILES=${TEST33_NFILES:-1000}
 fi
+
 #                                  23   (min)"
 [ "$SLOW" = "no" ] && EXCEPT_SLOW="33a"
 
 #                                  23   (min)"
 [ "$SLOW" = "no" ] && EXCEPT_SLOW="33a"
 
+build_test_filter
+
 FAIL_ON_ERROR=false
 
 SETUP=${SETUP:-:}
 FAIL_ON_ERROR=false
 
 SETUP=${SETUP:-:}
@@ -63,8 +52,6 @@ dd if=/dev/urandom of=$SAMPLE_FILE bs=1M count=1
 
 check_runas_id $RUNAS_ID $RUNAS_GID $RUNAS
 
 
 check_runas_id $RUNAS_ID $RUNAS_GID $RUNAS
 
-build_test_filter
-
 test_1() {
        touch $DIR1/$tfile
        [ -f $DIR2/$tfile ] || error "Check create"
 test_1() {
        touch $DIR1/$tfile
        [ -f $DIR2/$tfile ] || error "Check create"