From: Alison Schofield <[email protected]>

check_dmesg() is used by CXL unit tests as well as by a few
DAX unit tests. Add a cxl_check_dmesg() version that can be
expanded for CXL special checks like this:

Add a check for an interleave calculation failure. This is
a dev_dbg() message that spews (success or failure) whenever
a user creates a region. It is useful as a regression check
across the entire CXL suite.

Signed-off-by: Alison Schofield <[email protected]>
---
 test/common | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/test/common b/test/common
index 7a4711593624..c20b7e48c2b6 100644
--- a/test/common
+++ b/test/common
@@ -151,6 +151,19 @@ check_dmesg()
        true
 }
 
+# cxl_check_dmesg
+# $1: line number where this is called
+cxl_check_dmesg()
+{
+       sleep 1
+       log=$(journalctl -r -k --since "-$((SECONDS+1))s")
+       # validate no WARN or lockdep report during the run
+       grep -q "Call Trace" <<< "$log" && err "$1"
+       # validate no failures of the interleave calc dev_dbg() check
+       grep -q "Test cxl_calc_interleave_pos(): fail" <<< "$log" && err "$1"
+       true
+}
+
 # cxl_common_start
 # $1: optional module parameter(s) for cxl-test
 cxl_common_start()
@@ -170,6 +183,6 @@ cxl_common_start()
 # $1: line number where this is called
 cxl_common_stop()
 {
-       check_dmesg "$1"
+       cxl_check_dmesg "$1"
        modprobe -r cxl_test
 }
-- 
2.37.3


Reply via email to