On 11/27/23 21:11, [email protected] wrote:
> From: Alison Schofield <[email protected]>
> 
> Using the bash variable 'SECONDS' plus 1 for searching the
> dmesg log sometimes led to one test picking up error messages
> from the previous test when run as a suite. SECONDS alone may
> miss some logs, but SECONDS + 1 is just as often too great.
> 
> Since unit tests in the CXL suite are using common helpers to
> start and stop work, initialize and use a "starttime" variable
> with millisecond granularity for journalctl.
> 
> Signed-off-by: Alison Schofield <[email protected]>

Reviewed-by: Dave Jiang <[email protected]>

> ---
>  test/common | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/test/common b/test/common
> index c20b7e48c2b6..93a280c7c150 100644
> --- a/test/common
> +++ b/test/common
> @@ -156,7 +156,7 @@ check_dmesg()
>  cxl_check_dmesg()
>  {
>       sleep 1
> -     log=$(journalctl -r -k --since "-$((SECONDS+1))s")
> +     log=$(journalctl -r -k --since "$starttime")
>       # 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
> @@ -175,6 +175,7 @@ cxl_common_start()
>       check_prereq "dd"
>       check_prereq "sha256sum"
>       modprobe -r cxl_test
> +     starttime=$(date +"%T.%3N")
>       modprobe cxl_test "$1"
>       rc=1
>  }

Reply via email to