From: Andreas Dilger Date: Fri, 12 Apr 2024 01:18:28 +0000 (-0600) Subject: LU-16915 tests: improve distro type checking X-Git-Tag: 2.15.63~24 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=1ffbec13c0f745d0b9c6b91959b1afa52f99d63b;p=fs%2Flustre-release.git LU-16915 tests: improve distro type checking Improve lustre_os_release() infrastructure to reduce redundant code and make it easier to use. Test-Parameters: trivial Test-Parameters: testlist=sanity-sec env=ONLY=51,HONOR_EXCEPT=y serverdistro=el9.3 Test-Parameters: testlist=sanity env=ONLY=906,HONOR_EXCEPT=y serverdistro=el9.3 Fixes: b881bd1051 ("LU-16915 tests: except sanity-sec test_51") Signed-off-by: Andreas Dilger Change-Id: Id02223752df4eb3fd3b62b339e8c417eb33ebbe5 Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/54790 Reviewed-by: Arshad Hussain Reviewed-by: Jian Yu Reviewed-by: Oleg Drokin Tested-by: jenkins Tested-by: Maloo --- diff --git a/lustre/tests/sanity-sec.sh b/lustre/tests/sanity-sec.sh index da0f525..c248713 100755 --- a/lustre/tests/sanity-sec.sh +++ b/lustre/tests/sanity-sec.sh @@ -15,12 +15,12 @@ init_test_env $@ init_logging ALWAYS_EXCEPT="$SANITY_SEC_EXCEPT " -if [[ "$MDS1_OS_ID" == "rhel" || "$MDS1_OS_ID_LIKE" =~ "rhel" ]] && +if [[ "$MDS1_OS_ID_LIKE" =~ "rhel" ]] && (( $MDS1_OS_VERSION_CODE == $(version_code 9.3) )); then always_except LU-16915 51 fi -[ "$SLOW" = "no" ] && EXCEPT_SLOW="26" +[[ "$SLOW" == "no" ]] && EXCEPT_SLOW="26" NODEMAP_TESTS=$(seq 7 26) diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index 3ff6c03..8868245 100755 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -80,12 +80,9 @@ if [[ "$ost1_FSTYPE" = "zfs" ]]; then always_except LU-9054 312 fi -proc_regexp="/{proc,sys}/{fs,sys,kernel/debug}/{lustre,lnet}/" - -if [ -r /etc/redhat-release ]; then - rhel_version=$(cat /etc/redhat-release | - sed -e 's/^[^0-9.]*//g' | sed -e 's/[ ].*//') - if (( $(version_code $rhel_version) >= $(version_code 9.3.0) )); then +# Check if running on specific distros to skip certain subtests +if [[ "$CLIENT_OS_ID_LIKE" =~ "rhel" ]]; then + if (( $CLIENT_OS_VERSION_CODE == $(version_code 9.3.0) )); then # disable test_906 temporarily until rhel9.3 solves the # failure on fio io_uring I/O engine. always_except LU-17289 906 @@ -95,6 +92,8 @@ fi build_test_filter FAIL_ON_ERROR=false +proc_regexp="/{proc,sys}/{fs,sys,kernel/debug}/{lustre,lnet}/" + cleanup() { echo -n "cln.." pgrep ll_sa > /dev/null && { echo "There are ll_sa thread not exit!"; exit 20; } diff --git a/lustre/tests/test-framework.sh b/lustre/tests/test-framework.sh index ad523fa..d4ff821 100755 --- a/lustre/tests/test-framework.sh +++ b/lustre/tests/test-framework.sh @@ -389,10 +389,10 @@ get_lustre_env() { # MDS1_OS_VERSION_ID, MDS1_OS_ID, MDS1_OS_ID_LIKE, # OST1_OS_VERSION_ID, OST1_OS_ID, OST1_OS_ID_LIKE, # CLIENT_OS_VERSION_ID, CLIENT_OS_ID, CLIENT_OS_ID_LIKE - lustre_os_release "eval export" mgs - lustre_os_release "eval export" mds1 - lustre_os_release "eval export" ost1 - lustre_os_release "eval export" client + lustre_os_release mgs + lustre_os_release mds1 + lustre_os_release ost1 + lustre_os_release client fi # Prefer using "mds1" directly instead of SINGLEMDS. @@ -773,24 +773,30 @@ lustre_version_code() { # generates $facet_OS_ID, $facet_OS_ID_LIKE, $facet_VERSION_ID # and also $facet_OS_VERSION_CODE=$(version_code $facet_VERSION_ID) lustre_os_release() { - local action=${1:-echo} - local facet=$2 - local FACET_OS=$(tr "[:lower:]" "[:upper:]" <<<$facet)_OS_ - - [[ "$action" == "echo" ]] && - echo "$facet: $(do_facet $facet "cat /etc/system-release")" - do_facet $facet "[[ -r /etc/os-release ]] || ls -s /etc/*release" 1>&2 + local facet=$1 + local facet_os=$(tr "[:lower:]" "[:upper:]" <<<$facet)_OS_ + local facet_version=${facet_os}VERSION_ + local line + + echo "$facet: $(do_facet $facet "cat /etc/system-release")" + do_facet $facet "test -r /etc/os-release" || { + echo "$facet: has no /etc/os-release" + do_facet $facet "uname -a; ls -s /etc/*release" + return 0 + } - while read LINE; do - case $LINE in - VERSION_ID=*|ID=*|ID_LIKE=*) $action ${FACET_OS}$LINE ;; - esac + while read line; do + # more variables in os-release could be exported, but these + # are the ones that looked enough for our needs here + case $line in + VERSION_ID=*|ID=*|ID_LIKE=*) eval export ${facet_os}$line ;; + esac done < <(do_facet $facet "cat /etc/os-release") - [[ "$action" == "echo" ]] && return 0 - - local facet_version=${FACET_OS}VERSION - $action ${facet_version}_CODE=\$\(version_code \$${facet_version}_ID\) + eval export ${facet_version}CODE=\$\(version_code \$${facet_version}ID\) + # add in the "self" ID to ID_LIKE so only one needs to be checked + eval export ${facet_os}ID_LIKE+=\" \$${facet_os}ID\" + env | grep "${facet_os}" } module_loaded () { @@ -9593,11 +9599,8 @@ init_logging() { # log actual client and server versions if needed for debugging log "Client: $(lustre_build_version client)" - lustre_os_release echo client log "MDS: $(lustre_build_version mds1)" - lustre_os_release echo mds1 log "OSS: $(lustre_build_version ost1)" - lustre_os_release echo ost1 } log_test() {