From: "Verma, Vishal L" <vishal.l.verma@intel.com>
To: "Schofield, Alison" <alison.schofield@intel.com>
Cc: "linux-cxl@vger.kernel.org" <linux-cxl@vger.kernel.org>,
"nvdimm@lists.linux.dev" <nvdimm@lists.linux.dev>
Subject: Re: [ndctl PATCH 2/3] cxl/test: add a cxl_ derivative of check_dmesg()
Date: Tue, 28 Nov 2023 22:11:50 +0000 [thread overview]
Message-ID: <3ecd689239aace48707499eb21362d8b29a428cc.camel@intel.com> (raw)
In-Reply-To: <39c11efdefeb12c3c928f36e9c59eeb40a841e72.1701143039.git.alison.schofield@intel.com>
On Mon, 2023-11-27 at 20:11 -0800, alison.schofield@intel.com wrote:
> From: Alison Schofield <alison.schofield@intel.com>
>
> 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 <alison.schofield@intel.com>
> ---
> 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
> +}
I like the idea of adding new checks - how about a generic helper that
greps on a list of strings passed to it, and wrappers on top of it can
have their own custom set of strings.
Something like this (untested):
# __check_dmesg
# $1: line number where this is called
# $2.. : strings to check for
__check_dmesg()
{
line="$1"
shift
strings=( "$@" )
sleep 1
log=$(journalctl -r -k --since "-$((SECONDS+1))s")
for string in "${strings[@]}"; do
if grep -q "$string" <<< $log; then
err "$line"
fi
done
true
}
check_dmesg()
{
line="$1"
shift
strings=( "$@" )
__check_dmesg "$line" "Call Trace" "${strings[@]}"
}
cxl_check_dmesg()
{
line="$1"
shift
strings=( "$@" )
check_dmesg "$line" \
"Test cxl_calc_interleave_pos(): fail" \
"${strings[@]}"
}
This lets tests opt in to any 'level' of checks, and lets them add any
of their own test-specific strings to be checked at any stage as well.
> +
> # 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
> }
next prev parent reply other threads:[~2023-11-28 22:12 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-28 4:11 [ndctl PATCH 0/3] cxl/test: CXL unit test helpers alison.schofield
2023-11-28 4:11 ` [ndctl PATCH 1/3] cxl/test: add and use cxl_common_[start|stop] helpers alison.schofield
2023-11-28 18:14 ` Dave Jiang
2023-11-28 21:50 ` Verma, Vishal L
2023-11-28 4:11 ` [ndctl PATCH 2/3] cxl/test: add a cxl_ derivative of check_dmesg() alison.schofield
2023-11-28 18:18 ` Dave Jiang
2023-11-28 22:11 ` Verma, Vishal L [this message]
2023-11-28 4:11 ` [ndctl PATCH 3/3] cxl/test: use an explicit --since time in journalctl alison.schofield
2023-11-28 18:19 ` Dave Jiang
2023-11-28 22:18 ` Verma, Vishal L
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3ecd689239aace48707499eb21362d8b29a428cc.camel@intel.com \
--to=vishal.l.verma@intel.com \
--cc=alison.schofield@intel.com \
--cc=linux-cxl@vger.kernel.org \
--cc=nvdimm@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox