From 66876ae2f6bec5f57af475b4dafedeacd7fbe7e5 Mon Sep 17 00:00:00 2001 From: James Nunez Date: Thu, 3 Oct 2019 09:42:18 -0600 Subject: [PATCH] =?utf8?q?LU-1538=20tests:=20standardize=20test=20script?= =?utf8?q?=20init=20=E2=80=93=20full=20group?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Standardize the initial Lustre test script initialization for clarity and consistency for test suites in the full test group. 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. 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: envdefinitions=SLOW=yes,ENABLE_QUOTA=yes clientcount=2 osscount=1 ostcount=7 mdscount=1 mdtcount=1 austeroptions=-R iscsi=1 testlist=metadata-updates,performance-sanity,racer Test-Parameters: envdefinitions=SLOW=yes,ENABLE_QUOTA=yes clientcount=2 osscount=1 ostcount=7 mdscount=1 mdtcount=1 austeroptions=-R testlist=obdfilter-survey,sanity-benchmark,sanity-lsnapshot Signed-off-by: James Nunez Change-Id: I6e21a4a5d9e9215d5b452c4fd30467d9c007b5a5 Reviewed-on: https://review.whamcloud.com/36359 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Emoly Liu Reviewed-by: Jian Yu Reviewed-by: Oleg Drokin --- lustre/tests/metadata-updates.sh | 22 +++++++++------------- lustre/tests/obdfilter-survey.sh | 22 +++++++++------------- lustre/tests/performance-sanity.sh | 17 +++++------------ lustre/tests/posix.sh | 15 ++++----------- lustre/tests/racer.sh | 12 ++++++------ lustre/tests/sanity-benchmark.sh | 12 +++++------- lustre/tests/sanity-lsnapshot.sh | 10 ++++------ 7 files changed, 42 insertions(+), 68 deletions(-) diff --git a/lustre/tests/metadata-updates.sh b/lustre/tests/metadata-updates.sh index d82d0a8..86ae8db 100755 --- a/lustre/tests/metadata-updates.sh +++ b/lustre/tests/metadata-updates.sh @@ -8,18 +8,16 @@ set -e ONLY=${ONLY:-"$*"} -#Bug number for excepting test -ALWAYS_EXCEPT="$METADATA_UPDATES_EXCEPT" -# UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT LIST - -[ "$SLOW" = "no" ] && EXCEPT_SLOW="" - -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 +#Bug number for skipped test: +ALWAYS_EXCEPT="$METADATA_UPDATES_EXCEPT " +# UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT LIST +build_test_filter + TRACE=${TRACE:-"+x"} TESTDIR=${TESTDIR:-$DIR/d0.$(basename $0 .sh)} @@ -50,7 +48,6 @@ NUM_FILES=1000 log "===== $0 ====== " check_and_setup_lustre -build_test_filter cleanup_prepare () { @@ -260,19 +257,18 @@ run_test 2 "directory content create, check, delete files , check" test_3() { WRITE_DISJOINT=${WRITE_DISJOINT:-$(which write_disjoint 2> /dev/null)} || true disjoint_file=$TESTDIR/$tfile - machine_file=${MACHINEFILE:-$TMP/$(basename $0 .sh).machines} numloops=1000 [ ! -f "$WRITE_DISJOINT" ] && skip_env "write_disjoint not found" set $TRACE - generate_machine_file $NODES_TO_USE $machine_file - mpi_run ${MACHINEFILE_OPTION} $machine_file \ + generate_machine_file $NODES_TO_USE $MACHINEFILE + mpi_run ${MACHINEFILE_OPTION} ${MACHINEFILE} \ -np $(get_node_count ${NODES_TO_USE//,/ }) \ $WRITE_DISJOINT -f $disjoint_file -n $numloops || error "mpi_run failed" - rm -f $machine_file + rm -f $MACHINEFILE } run_test 3 "write_disjoint test" diff --git a/lustre/tests/obdfilter-survey.sh b/lustre/tests/obdfilter-survey.sh index f2ec471..890f0e4 100644 --- a/lustre/tests/obdfilter-survey.sh +++ b/lustre/tests/obdfilter-survey.sh @@ -1,29 +1,25 @@ #!/bin/bash -#set -x set -e -LUSTRE=${LUSTRE:-`dirname $0`/..} +LUSTRE=${LUSTRE:-$(dirname $0)/..} . $LUSTRE/tests/test-framework.sh init_test_env $@ +init_logging -nobjhi=${nobjhi:-1} -thrhi=${thrhi:-16} -size=${size:-1024} +# bug number for skipped test: +ALWAYS_EXCEPT="$OBDFILTER_SURVEY_EXCEPT " +# UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT! -# the summary file a bit smaller than OSTSIZE -. ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh} -init_logging +build_test_filter [ "$SLOW" = no ] && { nobjhi=1; thrhi=4; } +nobjhi=${nobjhi:-1} +thrhi=${thrhi:-16} +size=${size:-1024} thrlo=${thrlo:-$(( thrhi / 2))} -# bug number for skipped test: -ALWAYS_EXCEPT="$OBDFILTER_SURVEY_EXCEPT" -# UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT! - OBDSURVEY=${OBDSURVEY:-$(which obdfilter-survey)} -build_test_filter check_and_setup_lustre # FIXME: the summary file a bit smaller than OSTSIZE, add estimation diff --git a/lustre/tests/performance-sanity.sh b/lustre/tests/performance-sanity.sh index cc27c3e..c4004ff 100644 --- a/lustre/tests/performance-sanity.sh +++ b/lustre/tests/performance-sanity.sh @@ -1,28 +1,21 @@ #!/bin/bash -#set -vx set -e -TESTNAME=`basename $0 .sh` -TMP=${TMP:-/tmp} +TESTNAME=$(basename $0 .sh) LOG=${LOG:-"$TMP/${TESTNAME}.log"} -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="$PERFORMANCE_SANITY_EXCEPT " +build_test_filter + [ -x "$MDSRATE" ] || FAIL_ON_ERROR=true error "No mdsrate program. Aborting." which mpirun > /dev/null 2>&1 || FAIL_ON_ERROR=true error "No mpirun program. Aborting." -# Skip these tests -# bug number: -ALWAYS_EXCEPT=" $PERFORMANCE_SANITY_EXCEPT" - -build_test_filter - get_mpiuser_id $MPI_USER MPI_RUNAS=${MPI_RUNAS:-"runas -u $MPI_USER_UID -g $MPI_USER_GID"} $GSS_KRB5 && refresh_krb5_tgt $MPI_USER_UID $MPI_USER_GID $MPI_RUNAS diff --git a/lustre/tests/posix.sh b/lustre/tests/posix.sh index 28cde8f..58ef6a3 100755 --- a/lustre/tests/posix.sh +++ b/lustre/tests/posix.sh @@ -1,22 +1,16 @@ #!/bin/bash -#set -vx set -e ONLY=${ONLY:-"$*"} -# bug number for skipped test: -ALWAYS_EXCEPT="$POSIX_EXCEPT" -# UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT! - -[ "$ALWAYS_EXCEPT$EXCEPT" ] && - echo "Skipping tests: $ALWAYS_EXCEPT $EXCEPT" - -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="$POSIX_EXCEPT" +build_test_filter + POSIX_DIR=${POSIX_DIR:-"$LUSTRE/tests/posix"} POSIX_SRC=${POSIX_SRC:-"/usr/src/posix"} BASELINE_FS=${BASELINE_FS:-"ext4"} @@ -34,7 +28,6 @@ if [[ "$mds1_FSTYPE" = zfs ]]; then fi check_and_setup_lustre -build_test_filter cleanup_loop_dev() { local mnt=$1 diff --git a/lustre/tests/racer.sh b/lustre/tests/racer.sh index 03e5130..42eff29 100644 --- a/lustre/tests/racer.sh +++ b/lustre/tests/racer.sh @@ -1,25 +1,25 @@ #!/bin/bash -#set -vx set -e ONLY=${ONLY:-"$*"} -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 +build_test_filter + racer=$LUSTRE/tests/racer/racer.sh echo racer: $racer with $MDSCOUNT MDTs if [ "$SLOW" = "no" ]; then - DURATION=${DURATION:-300} + DURATION=${DURATION:-300} else - DURATION=${DURATION:-900} + DURATION=${DURATION:-900} fi MOUNT_2=${MOUNT_2:-"yes"} -build_test_filter check_and_setup_lustre CLIENTS=${CLIENTS:-$HOSTNAME} diff --git a/lustre/tests/sanity-benchmark.sh b/lustre/tests/sanity-benchmark.sh index ee57119..023f70d 100644 --- a/lustre/tests/sanity-benchmark.sh +++ b/lustre/tests/sanity-benchmark.sh @@ -8,17 +8,18 @@ set -e ONLY=${ONLY:-"$*"} -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 -# bug number: ALWAYS_EXCEPT="$SANITY_BENCHMARK_EXCEPT" +[ "$SLOW" = "no" ] && EXCEPT_SLOW="iozone" + +build_test_filter MAX_THREADS=${MAX_THREADS:-20} -RAMKB=`awk '/MemTotal:/ { print $2 }' /proc/meminfo` +RAMKB=$(awk '/MemTotal:/ { print $2 }' /proc/meminfo) if [ -z "$THREADS" ]; then THREADS=$((RAMKB / 16384)) [ $THREADS -gt $MAX_THREADS ] && THREADS=$MAX_THREADS @@ -31,9 +32,6 @@ DEBUG_OFF=${DEBUG_OFF:-"eval lctl set_param debug=\"$DEBUG_LVL\""} DEBUG_ON=${DEBUG_ON:-"eval lctl set_param debug=0x33f0484"} DIRECTIO=${DIRECTIO:-directio} -[ "$SLOW" = "no" ] && EXCEPT_SLOW="iozone" - -build_test_filter check_and_setup_lustre assert_DIR diff --git a/lustre/tests/sanity-lsnapshot.sh b/lustre/tests/sanity-lsnapshot.sh index 1370711..afa20ca 100755 --- a/lustre/tests/sanity-lsnapshot.sh +++ b/lustre/tests/sanity-lsnapshot.sh @@ -7,16 +7,15 @@ set -e ONLY=${ONLY:-"$*"} -ALWAYS_EXCEPT="$SANITY_LSNAPSHOT_EXCEPT" -[ "$SLOW" = "no" ] && EXCEPT_SLOW="" -# UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT! -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="$SANITY_LSNAPSHOT_EXCEPT " +build_test_filter + [[ "$MDS1_VERSION" -lt $(version_code 2.9.55) ]] || [[ "$OST1_VERSION" -lt $(version_code 2.9.55) ]] && skip "Need server version at least 2.9.55" @@ -33,7 +32,6 @@ do_nodes $(comma_list $(mdts_nodes)) $LCTL set_param debug=+snapshot lss_gen_conf lss_cleanup -build_test_filter test_0() { echo "Create lss_0_0 with default" -- 1.8.3.1