Whamcloud - gitweb
LU-18221 tests: check UBSAN and KASAN in check_dmesg_for_errors() 59/56359/5
authorJian Yu <yujian@whamcloud.com>
Sun, 15 Sep 2024 23:15:16 +0000 (16:15 -0700)
committerOleg Drokin <green@whamcloud.com>
Tue, 8 Oct 2024 06:23:45 +0000 (06:23 +0000)
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 <yujian@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/56359
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Yang Sheng <ys@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/tests/test-framework.sh

index a6f926c..d0254d3 100755 (executable)
@@ -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
 }