From 2c95e89c71906f8f4f4f1dcab157e39ef150f342 Mon Sep 17 00:00:00 2001 From: Jian Yu Date: Sun, 15 Sep 2024 16:15:16 -0700 Subject: [PATCH] LU-18221 tests: check UBSAN and KASAN in check_dmesg_for_errors() This patch adds checks into check_dmesg_for_errors() for UBSAN and KASAN messages in dmesg and fails the test if they are found. Test-Parameters: trivial mdtcount=4 mdscount=2 \ env=SANITY_EXCEPT="17e 103" \ clientdistro=ubuntu2404 testlist=sanity Test-Parameters: optional clientdistro=ubuntu2404 testgroup=full-part-1 Test-Parameters: optional clientdistro=ubuntu2404 testgroup=full-part-2 Test-Parameters: optional clientdistro=ubuntu2404 testgroup=full-part-3 Change-Id: I4156fb0192e3df152287daf101bc17c228e593b5 Signed-off-by: Jian Yu Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/56359 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Yang Sheng Reviewed-by: James Simmons Reviewed-by: Oleg Drokin --- lustre/tests/test-framework.sh | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/lustre/tests/test-framework.sh b/lustre/tests/test-framework.sh index a6f926c..d0254d3 100755 --- a/lustre/tests/test-framework.sh +++ b/lustre/tests/test-framework.sh @@ -6265,7 +6265,7 @@ 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)') ===" + log "=== $TESTSUITE: start setup $(date +'%H:%M:%S (%s)') ===" sanitize_parameters nfs_client_mode && return @@ -6367,7 +6367,11 @@ do_check_and_setup_lustre() { set_params_clients set_params_mdts set_params_osts - echo "=== $TESTSUITE: finish setup $(date +'%H:%M:%S (%s)') ===" + + TESTNAME="start setup" check_dmesg_for_errors || + TESTNAME="test_setup" error "Error in dmesg detected" + + log "=== $TESTSUITE: finish setup $(date +'%H:%M:%S (%s)') ===" if [[ "$ONLY" == "setup" ]]; then exit 0 @@ -6569,7 +6573,7 @@ log_zfs_info() { } do_check_and_cleanup_lustre() { - echo "=== $TESTSUITE: start cleanup $(date +'%H:%M:%S (%s)') ===" + log "=== $TESTSUITE: start cleanup $(date +'%H:%M:%S (%s)') ===" if [[ "$LFSCK_ALWAYS" == "yes" && "$TESTSUITE" != "sanity-lfsck" && \ "$TESTSUITE" != "sanity-scrub" ]]; then @@ -6599,7 +6603,10 @@ do_check_and_cleanup_lustre() { unset I_MOUNTED fi - echo "=== $TESTSUITE: finish cleanup $(date +'%H:%M:%S (%s)') ===" + TESTNAME="start cleanup" check_dmesg_for_errors || + TESTNAME="test_cleanup" error "Error in dmesg detected" + + log "=== $TESTSUITE: finish cleanup $(date +'%H:%M:%S (%s)') ===" } check_and_cleanup_lustre() { @@ -7492,12 +7499,17 @@ banner() { check_dmesg_for_errors() { local res - local errors="VFS: Busy inodes after unmount of\|\ -ldiskfs_check_descriptors: Checksum for group 0 failed\|\ -group descriptors corrupted" + local errors + local testid=$(tr '_' ' ' <<< $TESTNAME) + + errors="VFS: Busy inodes after unmount of" + errors+="\|ldiskfs_check_descriptors: Checksum for group 0 failed" + errors+="\|group descriptors corrupted" + errors+="\|UBSAN\|KASAN" - res=$(do_nodes -q $(comma_list $(nodes_list)) "dmesg" | grep "$errors") - [ -z "$res" ] && return 0 + res=$(do_nodes -q $(comma_list $(nodes_list)) "dmesg" | + tac | sed "/$testid/,$ d" | grep "$errors") + [[ -n "$res" ]] || return 0 echo "Kernel error detected: $res" return 1 } -- 1.8.3.1