Whamcloud - gitweb
LU-1538 tests: standardize test script init – full group 59/36359/9
authorJames Nunez <jnunez@whamcloud.com>
Thu, 3 Oct 2019 15:42:18 +0000 (09:42 -0600)
committerOleg Drokin <green@whamcloud.com>
Fri, 25 Sep 2020 03:13:09 +0000 (03:13 +0000)
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 <jnunez@whamcloud.com>
Change-Id: I6e21a4a5d9e9215d5b452c4fd30467d9c007b5a5
Reviewed-on: https://review.whamcloud.com/36359
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Emoly Liu <emoly@whamcloud.com>
Reviewed-by: Jian Yu <yujian@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/tests/metadata-updates.sh
lustre/tests/obdfilter-survey.sh
lustre/tests/performance-sanity.sh
lustre/tests/posix.sh
lustre/tests/racer.sh
lustre/tests/sanity-benchmark.sh
lustre/tests/sanity-lsnapshot.sh

index d82d0a8..86ae8db 100755 (executable)
@@ -8,18 +8,16 @@ set -e
 
 ONLY=${ONLY:-"$*"}
 
 
 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 $@
 . $LUSTRE/tests/test-framework.sh
 init_test_env $@
-. ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
 init_logging
 
 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)}
 TRACE=${TRACE:-"+x"}
 
 TESTDIR=${TESTDIR:-$DIR/d0.$(basename $0 .sh)}
@@ -50,7 +48,6 @@ NUM_FILES=1000
 log "===== $0 ====== "
 
 check_and_setup_lustre
 log "===== $0 ====== "
 
 check_and_setup_lustre
-build_test_filter
 
 cleanup_prepare () {
 
 
 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
 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
        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"
 
                -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"
 
 }
 run_test 3 "write_disjoint test"
 
index f2ec471..890f0e4 100644 (file)
@@ -1,29 +1,25 @@
 #!/bin/bash
 #!/bin/bash
-#set -x
 set -e
 
 set -e
 
-LUSTRE=${LUSTRE:-`dirname $0`/..}
+LUSTRE=${LUSTRE:-$(dirname $0)/..}
 . $LUSTRE/tests/test-framework.sh
 init_test_env $@
 . $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; }
 
 [ "$SLOW" = no ] && { nobjhi=1; thrhi=4; }
+nobjhi=${nobjhi:-1}
+thrhi=${thrhi:-16}
+size=${size:-1024}
 thrlo=${thrlo:-$(( thrhi / 2))}
 
 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)}
 
 OBDSURVEY=${OBDSURVEY:-$(which obdfilter-survey)}
 
-build_test_filter
 check_and_setup_lustre
 
 # FIXME: the summary file a bit smaller than OSTSIZE, add estimation
 check_and_setup_lustre
 
 # FIXME: the summary file a bit smaller than OSTSIZE, add estimation
index cc27c3e..c4004ff 100644 (file)
@@ -1,28 +1,21 @@
 #!/bin/bash
 #!/bin/bash
-#set -vx
 set -e
 
 set -e
 
-TESTNAME=`basename $0 .sh`
-TMP=${TMP:-/tmp}
+TESTNAME=$(basename $0 .sh)
 LOG=${LOG:-"$TMP/${TESTNAME}.log"}
 
 LOG=${LOG:-"$TMP/${TESTNAME}.log"}
 
-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
 
 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."
 
 [ -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
 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
index 28cde8f..58ef6a3 100755 (executable)
@@ -1,22 +1,16 @@
 #!/bin/bash
 #!/bin/bash
-#set -vx
 set -e
 
 ONLY=${ONLY:-"$*"}
 
 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 $@
 . $LUSTRE/tests/test-framework.sh
 init_test_env $@
-. ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
 init_logging
 
 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"}
 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
 fi
 
 check_and_setup_lustre
-build_test_filter
 
 cleanup_loop_dev() {
     local mnt=$1
 
 cleanup_loop_dev() {
     local mnt=$1
index 03e5130..42eff29 100644 (file)
@@ -1,25 +1,25 @@
 #!/bin/bash
 #!/bin/bash
-#set -vx
 set -e
 
 ONLY=${ONLY:-"$*"}
 set -e
 
 ONLY=${ONLY:-"$*"}
-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
 
+build_test_filter
+
 racer=$LUSTRE/tests/racer/racer.sh
 echo racer: $racer with $MDSCOUNT MDTs
 
 if [ "$SLOW" = "no" ]; then
 racer=$LUSTRE/tests/racer/racer.sh
 echo racer: $racer with $MDSCOUNT MDTs
 
 if [ "$SLOW" = "no" ]; then
-    DURATION=${DURATION:-300}
+       DURATION=${DURATION:-300}
 else
 else
-    DURATION=${DURATION:-900}
+       DURATION=${DURATION:-900}
 fi
 MOUNT_2=${MOUNT_2:-"yes"}
 
 fi
 MOUNT_2=${MOUNT_2:-"yes"}
 
-build_test_filter
 check_and_setup_lustre
 
 CLIENTS=${CLIENTS:-$HOSTNAME}
 check_and_setup_lustre
 
 CLIENTS=${CLIENTS:-$HOSTNAME}
index ee57119..023f70d 100644 (file)
@@ -8,17 +8,18 @@ set -e
 
 ONLY=${ONLY:-"$*"}
 
 
 ONLY=${ONLY:-"$*"}
 
-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
 
-# bug number:
 ALWAYS_EXCEPT="$SANITY_BENCHMARK_EXCEPT"
 ALWAYS_EXCEPT="$SANITY_BENCHMARK_EXCEPT"
+[ "$SLOW" = "no" ] && EXCEPT_SLOW="iozone"
+
+build_test_filter
 
 MAX_THREADS=${MAX_THREADS:-20}
 
 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
 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}
 
 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
 check_and_setup_lustre
 
 assert_DIR
index 1370711..afa20ca 100755 (executable)
@@ -7,16 +7,15 @@
 set -e
 
 ONLY=${ONLY:-"$*"}
 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 $@
 . $LUSTRE/tests/test-framework.sh
 init_test_env $@
-. ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
 init_logging
 
 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"
 [[ "$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
 
 lss_gen_conf
 lss_cleanup
-build_test_filter
 
 test_0() {
        echo "Create lss_0_0 with default"
 
 test_0() {
        echo "Create lss_0_0 with default"