From 8fa23490bb5fd0df2b1def8b14d51919abde6555 Mon Sep 17 00:00:00 2001 From: Andreas Dilger Date: Mon, 3 Jun 2019 08:39:19 -0600 Subject: [PATCH] LU-1538 tests: standardize test script init - sanity 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. Test-Parameters: trivial Signed-off-by: Andreas Dilger Signed-off-by: James Nunez Change-Id: I1ef6639bcb3eb5179bd44da13b35fd843c267156 Reviewed-on: https://review.whamcloud.com/34863 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Jian Yu Reviewed-by: Wei Liu --- lustre/tests/llmount.sh | 5 +--- lustre/tests/llmountcleanup.sh | 5 +--- lustre/tests/sanity.sh | 61 +++++++++++++++--------------------------- lustre/tests/test-framework.sh | 7 +++-- 4 files changed, 29 insertions(+), 49 deletions(-) diff --git a/lustre/tests/llmount.sh b/lustre/tests/llmount.sh index 82217bc..1ecb983 100755 --- a/lustre/tests/llmount.sh +++ b/lustre/tests/llmount.sh @@ -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 diff --git a/lustre/tests/llmountcleanup.sh b/lustre/tests/llmountcleanup.sh index 076faa7..454ed6e 100755 --- a/lustre/tests/llmountcleanup.sh +++ b/lustre/tests/llmountcleanup.sh @@ -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 diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index 2d6bcdd..e21d948 100644 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -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,44 +7,17 @@ set -e ONLY=${ONLY:-"$*"} -# bug number for skipped test: LU-9693 LU-6493 LU-9693 -ALWAYS_EXCEPT="$SANITY_EXCEPT 42a 42b 42c" -# 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 # Check Grants after these tests GRANT_CHECK_LIST="$GRANT_CHECK_LIST 42a 42b 42c 42d 42e 63a 63b 64a 64b 64c 64d" -# skip the grant tests for ARM until they are fixed -if [[ $(uname -m) = aarch64 ]]; then - # bug number: LU-11596 (all below) - ALWAYS_EXCEPT+=" $GRANT_CHECK_LIST" - # bug number: LU-11671 LU-11594 LU-11667 LU-11729 - ALWAYS_EXCEPT+=" 45 103a 317 810" -fi - -SRCDIR=$(cd $(dirname $0); echo $PWD) -export PATH=$PATH:/sbin - -TMP=${TMP:-/tmp} 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} @@ -58,21 +30,33 @@ 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} init_logging +ALWAYS_EXCEPT="$SANITY_EXCEPT " +# bug number for skipped test: LU-9693 LU-6493 LU-9693 +ALWAYS_EXCEPT+=" 42a 42b 42c " +# bug number: LU-8411 LU-9096 LU-9054 +ALWAYS_EXCEPT+=" 407 253 312 " + +if $SHARED_KEY; then + # bug number: LU-9795 LU-9795 LU-9795 LU-9795 + ALWAYS_EXCEPT+=" 17n 60a 133g 300f " +fi + +# skip the grant tests for ARM until they are fixed +if [[ $(uname -m) = aarch64 ]]; then + # bug number: LU-11596 + ALWAYS_EXCEPT+=" $GRANT_CHECK_LIST" + # bug number: LU-11671 LU-11594 LU-11667 LU-11729 + ALWAYS_EXCEPT+=" 45 103a 317 810" +fi + # 5 12 (min)" [ "$SLOW" = "no" ] && EXCEPT_SLOW="27m 64b 68 71 115 300o" @@ -121,6 +105,7 @@ elif [ -r /etc/os-release ]; then fi fi +build_test_filter FAIL_ON_ERROR=false cleanup() { @@ -157,8 +142,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 @@ -7303,7 +7286,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 diff --git a/lustre/tests/test-framework.sh b/lustre/tests/test-framework.sh index 7a1a050..78b8c32 100755 --- a/lustre/tests/test-framework.sh +++ b/lustre/tests/test-framework.sh @@ -421,6 +421,11 @@ init_test_env() { # Constants used in more than one test script export LOV_MAX_STRIPE_COUNT=2000 + + export MACHINEFILE=${MACHINEFILE:-$TMP/$(basename $0 .sh).machines} + . ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh} + get_lustre_env + } check_cpt_number() { @@ -7991,8 +7996,6 @@ init_logging() { do_facet $SINGLEMDS $LCTL --version)" log "OSS: $(do_facet ost1 $LCTL lustre_build_version 2> /dev/null || do_facet ost1 $LCTL --version)" - - get_lustre_env } log_test() { -- 1.8.3.1