diff mbox series

[ndctl,v2,1/6] ndctl/cxl-events: Don't fail test until event counts are reported

Message ID 20241104-dcd-region2-v2-1-be057b479eeb@intel.com (mailing list archive)
State New
Headers show
Series ndctl: DCD additions | expand

Commit Message

Ira Weiny Nov. 5, 2024, 2:10 a.m. UTC
In testing DCD event modifications a failed cxl-event test lacked
details on the event counts.  This was because the greps were failing
the test rather than the check against the counts.

Suppress the grep failure and rely on event count checks for pass/fail
of the test.

Signed-off-by: Ira Weiny <ira.weiny@intel.com>
---
 test/cxl-events.sh | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Dave Jiang Nov. 5, 2024, 3:44 p.m. UTC | #1
On 11/4/24 7:10 PM, Ira Weiny wrote:
> In testing DCD event modifications a failed cxl-event test lacked
> details on the event counts.  This was because the greps were failing
> the test rather than the check against the counts.
> 
> Suppress the grep failure and rely on event count checks for pass/fail
> of the test.
> 
> Signed-off-by: Ira Weiny <ira.weiny@intel.com>
Reviewed-by: Dave Jiang <dave.jiang@intel.com>

> ---
>  test/cxl-events.sh | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/test/cxl-events.sh b/test/cxl-events.sh
> index ff4f3fdff1d8f6fd80f093126a27bf14b52d167f..c216d6aa9148c938a649cb22656127b3df440039 100644
> --- a/test/cxl-events.sh
> +++ b/test/cxl-events.sh
> @@ -71,10 +71,10 @@ echo 0 > /sys/kernel/tracing/tracing_on
>  echo "TEST: Events seen"
>  trace_out=$(cat /sys/kernel/tracing/trace)
>  
> -num_overflow=$(grep -c "cxl_overflow" <<< "${trace_out}")
> -num_fatal=$(grep -c "log=Fatal" <<< "${trace_out}")
> -num_failure=$(grep -c "log=Failure" <<< "${trace_out}")
> -num_info=$(grep -c "log=Informational" <<< "${trace_out}")
> +num_overflow=$(grep -c "cxl_overflow" <<< "${trace_out}" || true)
> +num_fatal=$(grep -c "log=Fatal" <<< "${trace_out}" || true)
> +num_failure=$(grep -c "log=Failure" <<< "${trace_out}" || true)
> +num_info=$(grep -c "log=Informational" <<< "${trace_out}" || true)
>  echo "     LOG     (Expected) : (Found)"
>  echo "     overflow      ($num_overflow_expected) : $num_overflow"
>  echo "     Fatal         ($num_fatal_expected) : $num_fatal"
>
diff mbox series

Patch

diff --git a/test/cxl-events.sh b/test/cxl-events.sh
index ff4f3fdff1d8f6fd80f093126a27bf14b52d167f..c216d6aa9148c938a649cb22656127b3df440039 100644
--- a/test/cxl-events.sh
+++ b/test/cxl-events.sh
@@ -71,10 +71,10 @@  echo 0 > /sys/kernel/tracing/tracing_on
 echo "TEST: Events seen"
 trace_out=$(cat /sys/kernel/tracing/trace)
 
-num_overflow=$(grep -c "cxl_overflow" <<< "${trace_out}")
-num_fatal=$(grep -c "log=Fatal" <<< "${trace_out}")
-num_failure=$(grep -c "log=Failure" <<< "${trace_out}")
-num_info=$(grep -c "log=Informational" <<< "${trace_out}")
+num_overflow=$(grep -c "cxl_overflow" <<< "${trace_out}" || true)
+num_fatal=$(grep -c "log=Fatal" <<< "${trace_out}" || true)
+num_failure=$(grep -c "log=Failure" <<< "${trace_out}" || true)
+num_info=$(grep -c "log=Informational" <<< "${trace_out}" || true)
 echo "     LOG     (Expected) : (Found)"
 echo "     overflow      ($num_overflow_expected) : $num_overflow"
 echo "     Fatal         ($num_fatal_expected) : $num_fatal"