From 0439aaadb1b640225d700aeb2ae894d07e9b3c5b Mon Sep 17 00:00:00 2001 From: Timothy Day Date: Thu, 29 Jun 2023 15:37:21 +0000 Subject: [PATCH] LU-16936 auster: add --client-only option Add flag to auster to run sanity tests only on the client-side. This leverages some existing functionality to avoid having to setup ssh to filesystem hosts and some other tedious setup. Force test-framework.sh to honor the --no-setup flag. Several test suites attempt to setup Lustre even if auster says not to. Some lower level tests, like those related to OBD device loading, require Lustre to be not setup. Change some [ to [[ in test-framework.sh to silence some error messages. Test-Parameters: trivial Signed-off-by: Timothy Day Change-Id: I24de10743c3845b51fe29518ffc993b15a7c2cdd Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/51509 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Arshad Hussain Reviewed-by: Patrick Farrell Reviewed-by: Oleg Drokin --- lustre/tests/auster | 37 ++++++++++++++++++++++++++++++++----- lustre/tests/test-framework.sh | 7 +++++-- 2 files changed, 37 insertions(+), 7 deletions(-) diff --git a/lustre/tests/auster b/lustre/tests/auster index d885bbe..39e621f 100755 --- a/lustre/tests/auster +++ b/lustre/tests/auster @@ -26,6 +26,8 @@ usage() { Usage ${0##*/} [options] suite [suite options] [suite [suite options]] Run Lustre regression tests suites. -c, --config CONFIG Test environment config file + -C, --client-only Run client-side sanity tests against an already setup + filesystem. Users must define FSNAME and mgs_HOST manually. -d, --log-dir LOGDIR Top level directory for logs -D, --full-log-dir FULLLOGDIR Full directory for logs -f, --cfg-name STR Config name (cfg/.sh) @@ -66,6 +68,10 @@ Run all tests in the regression group 5 times using large config. auster -f large -g test-groups/regression -i 5 +Run the client-only tests from sanity. + + FSNAME=myfilesystem mgs_HOST=1.2.3.4 auster -C sanity + EOF exit } @@ -79,7 +85,8 @@ reformat=false script_lang=bash test_logs_dir=/tmp/test_logs/$(date +%Y-%m-%d)/$(date +%H%M%S) export HONOR_EXCEPT= -do_setup=true +export do_setup=true +export client_tests_only=false export "${SLOW:=no}" export "${NAME:=local}" @@ -88,6 +95,7 @@ for arg in "$@"; do shift case "$arg" in --config) set -- "$@" '-c';; + --client-only) set -- "$@" '-C';; --log-dir) set -- "$@" '-d';; --full-log-dir) set -- "$@" '-D';; --group) set -- "$@" '-g';; @@ -108,10 +116,11 @@ for arg in "$@"; do esac done -while getopts "c:d:D:nkf:S:g:Hi:rRslL:Nhv" opt +while getopts "c:Cd:D:nkf:S:g:Hi:rRslL:Nhv" opt do case "$opt" in c) export CONFIG=$OPTARG;; + C) client_tests_only=true;; d) test_logs_dir=$OPTARG/$(date +%Y-%m-%d)/$(date +%H%M%S);; D) test_logs_dir=$OPTARG;; g) test_group_file=$OPTARG;; @@ -153,6 +162,16 @@ STARTTIME=`date +%s` . $LUSTRE/tests/test-framework.sh init_test_env +# Set CLIENTONLY, while trying to discover some common +# variables so the test runner doesn't need do this +# manually +if $client_tests_only; then + export CLIENTONLY=true; + export FSTYPE=${FSTYPE:-ldiskfs}; + export MDSCOUNT="$(( $($LFS mdts | wc -l) - 1 ))" + export OSTCOUNT="$(( $($LFS osts | wc -l) - 1 ))" +fi + print_summary () { trap 0 local form="%-13s %-17s %s\n" @@ -368,9 +387,17 @@ fi export NAME MOUNT START CLEAN . ${CONFIG:-$LUSTRE/tests/cfg/$NAME.sh} -assert_env mds_HOST -assert_env ost_HOST OSTCOUNT -assert_env FSNAME MOUNT MOUNT2 +# Only need to know where (MOUNT) and how (mgs_HOST) to +# mount Lustre for client-side only tests +if $client_tests_only; then + assert_env mgs_HOST +else + assert_env mds_HOST + assert_env ost_HOST OSTCOUNT + assert_env MOUNT2 +fi + +assert_env FSNAME MOUNT echo "Started at `date`" setup_if_needed diff --git a/lustre/tests/test-framework.sh b/lustre/tests/test-framework.sh index 9e36524..eaae1d4 100755 --- a/lustre/tests/test-framework.sh +++ b/lustre/tests/test-framework.sh @@ -1339,8 +1339,8 @@ node_fstypes() { local facet for facet in ${facets//,/ }; do - if [ $node == $(facet_host $facet) ] || - [ $node == "$(facet_failover_host $facet)" ]; then + if [[ $node == $(facet_host $facet) ]] || + [[ $node == "$(facet_failover_host $facet)" ]]; then fstype=$(facet_fstype $facet) if [[ $fstypes != *$fstype* ]]; then fstypes+="${fstypes:+,}$fstype" @@ -5795,6 +5795,9 @@ set_pools_quota () { } do_check_and_setup_lustre() { + # If auster does not want us to setup, then don't. + ! ${do_setup} && return + echo "=== $TESTSUITE: start setup $(date +'%H:%M:%S (%s)') ===" sanitize_parameters -- 1.8.3.1