diff mbox series

[vsp-tests,v2,1/2] scripts: Fix computation of the total number of tests

Message ID 20231114131211.24462-1-laurent.pinchart@ideasonboard.com (mailing list archive)
State New
Delegated to: Kieran Bingham
Headers show
Series [vsp-tests,v2,1/2] scripts: Fix computation of the total number of tests | expand

Commit Message

Laurent Pinchart Nov. 14, 2023, 1:12 p.m. UTC
If a test scripts outputs a line that doesn't match the
pass/fail/skipped criteria, the line is counted in the total number of
tests run, but not attributed to any individual category. This results
in a summary message such as

	189 tests: 170 passed, 0 failed, 3 skipped

Fix it by ignoring those lines.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
Changes since v1:

- Don't drop skipped tests handling
---
 scripts/vsp-tests.sh | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)


base-commit: 9a37e24c2456103d146e0251765ae43df6f72f7e

Comments

Kieran Bingham Nov. 22, 2023, 3:44 p.m. UTC | #1
Quoting Laurent Pinchart (2023-11-14 13:12:10)
> If a test scripts outputs a line that doesn't match the
> pass/fail/skipped criteria, the line is counted in the total number of
> tests run, but not attributed to any individual category. This results
> in a summary message such as
> 
>         189 tests: 170 passed, 0 failed, 3 skipped
> 
> Fix it by ignoring those lines.

Eugh - indeed.

Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>

> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> ---
> Changes since v1:
> 
> - Don't drop skipped tests handling
> ---
>  scripts/vsp-tests.sh | 16 ++++++++++++----
>  1 file changed, 12 insertions(+), 4 deletions(-)
> 
> diff --git a/scripts/vsp-tests.sh b/scripts/vsp-tests.sh
> index e6cae04ebf0b..7805f1b7de1c 100755
> --- a/scripts/vsp-tests.sh
> +++ b/scripts/vsp-tests.sh
> @@ -29,10 +29,18 @@ run_test() {
>  
>         local output=$(./$script 2>&1 | tee /proc/self/fd/2)
>         for line in $output ; do
> -               (echo "$line" | grep -q 'fail$') && num_fail=$((num_fail+1))
> -               (echo "$line" | grep -q 'pass$') && num_pass=$((num_pass+1))
> -               (echo "$line" | grep -q 'skipped$') && num_skip=$((num_skip+1))
> -               num_test=$((num_test+1))
> +               local pass=0
> +               local fail=0
> +               local skipped=0
> +
> +               (echo "$line" | grep -q ': fail$') && fail=1
> +               (echo "$line" | grep -q ': pass$') && pass=1
> +               (echo "$line" | grep -q ': skipped$') && skipped=1
> +
> +               num_fail=$((num_fail+fail))
> +               num_pass=$((num_pass+pass))
> +               num_skipped=$((num_skipped+skipped))
> +               num_test=$((num_test+pass+fail+skipped))
>         done
>  
>         if [ $(ls *.bin 2>/dev/null | wc -l) != 0 ] ; then
> 
> base-commit: 9a37e24c2456103d146e0251765ae43df6f72f7e
> -- 
> Regards,
> 
> Laurent Pinchart
>
diff mbox series

Patch

diff --git a/scripts/vsp-tests.sh b/scripts/vsp-tests.sh
index e6cae04ebf0b..7805f1b7de1c 100755
--- a/scripts/vsp-tests.sh
+++ b/scripts/vsp-tests.sh
@@ -29,10 +29,18 @@  run_test() {
 
 	local output=$(./$script 2>&1 | tee /proc/self/fd/2)
 	for line in $output ; do
-		(echo "$line" | grep -q 'fail$') && num_fail=$((num_fail+1))
-		(echo "$line" | grep -q 'pass$') && num_pass=$((num_pass+1))
-		(echo "$line" | grep -q 'skipped$') && num_skip=$((num_skip+1))
-		num_test=$((num_test+1))
+		local pass=0
+		local fail=0
+		local skipped=0
+
+		(echo "$line" | grep -q ': fail$') && fail=1
+		(echo "$line" | grep -q ': pass$') && pass=1
+		(echo "$line" | grep -q ': skipped$') && skipped=1
+
+		num_fail=$((num_fail+fail))
+		num_pass=$((num_pass+pass))
+		num_skipped=$((num_skipped+skipped))
+		num_test=$((num_test+pass+fail+skipped))
 	done
 
 	if [ $(ls *.bin 2>/dev/null | wc -l) != 0 ] ; then