From 630bb7a01c2cdc661ad09644b19b798f48bb66b3 Mon Sep 17 00:00:00 2001 From: Andreas Dilger Date: Tue, 18 Jun 2019 08:55:16 -0600 Subject: [PATCH] LU-1538 tests: standardize test script init dne-part-1 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 Change-Id: Ia8a1b3afcca7af645eed1d0f3dcf843e5254afe6 Reviewed-on: https://review.whamcloud.com/35263 Tested-by: jenkins Reviewed-by: Andreas Dilger Reviewed-by: Emoly Liu Tested-by: Maloo Reviewed-by: Oleg Drokin --- lustre/tests/lustre-rsync-test.sh | 28 ++++++++-------------------- lustre/tests/recovery-small.sh | 12 +++--------- lustre/tests/sanityn.sh | 33 ++++++++++----------------------- 3 files changed, 21 insertions(+), 52 deletions(-) diff --git a/lustre/tests/lustre-rsync-test.sh b/lustre/tests/lustre-rsync-test.sh index e8fef19..8888469f 100644 --- a/lustre/tests/lustre-rsync-test.sh +++ b/lustre/tests/lustre-rsync-test.sh @@ -1,38 +1,28 @@ #!/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 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-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 - -TMP=${TMP:-/tmp} 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 $@ -. ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh} 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 @@ -48,8 +38,6 @@ else 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" diff --git a/lustre/tests/recovery-small.sh b/lustre/tests/recovery-small.sh index a30aa8a..48de1b9 100755 --- a/lustre/tests/recovery-small.sh +++ b/lustre/tests/recovery-small.sh @@ -2,12 +2,10 @@ set -e -export MULTIOP=${MULTIOP:-multiop} PTLDEBUG=${PTLDEBUG:--1} -LUSTRE=${LUSTRE:-`dirname $0`/..} +LUSTRE=${LUSTRE:-$(dirname $0)/..} . $LUSTRE/tests/test-framework.sh init_test_env $@ -. ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh} init_logging ALWAYS_EXCEPT="$RECOVERY_SMALL_EXCEPT " @@ -23,14 +21,10 @@ if [ "$selinux_status" != "Disabled" ]; then $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 +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:-""} diff --git a/lustre/tests/sanityn.sh b/lustre/tests/sanityn.sh index f1d9b97..79d762a 100755 --- a/lustre/tests/sanityn.sh +++ b/lustre/tests/sanityn.sh @@ -3,46 +3,35 @@ 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} -CHECKSTAT=${CHECKSTAT:-"checkstat -v"} 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:-""} -SAVE_PWD=$PWD - -export NAME=${NAME:-local} - -LUSTRE=${LUSTRE:-`dirname $0`/..} +LUSTRE=${LUSTRE:-$(dirname $0)/..} . $LUSTRE/tests/test-framework.sh -CLEANUP=${CLEANUP:-:} -SETUP=${SETUP:-:} init_test_env $@ -. ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh} -get_lustre_env 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 -# 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 + # 23 (min)" [ "$SLOW" = "no" ] && EXCEPT_SLOW="33a" +build_test_filter + 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 -build_test_filter - test_1() { touch $DIR1/$tfile [ -f $DIR2/$tfile ] || error "Check create" -- 1.8.3.1