diff mbox series

[meta-oe] c-ares: Improve the ptest output

Message ID 20240415090750.2727038-1-mingli.yu@windriver.com
State Accepted
Headers show
Series [meta-oe] c-ares: Improve the ptest output | expand

Commit Message

Yu, Mingli April 15, 2024, 9:07 a.m. UTC
From: Mingli Yu <mingli.yu@windriver.com>

Before the patch:
 # ./run-ptest
[snip]
[ DISABLED ] LibraryTest.DISABLED_ParseAReplyVariantCnameLast
[ RUN      ] LibraryTest.ParseAReplyErrors
[       OK ] LibraryTest.ParseAReplyErrors (4 ms)
[ RUN      ] LibraryTest.ParseAReplyAllocFail
[       OK ] LibraryTest.ParseAReplyAllocFail (0 ms)
[snip]

After the patch:
 # ./run-ptest
[snip]
SKIP:  LibraryTest.DISABLED_ParseAReplyVariantCnameLast
PASS:  LibraryTest.ParseAReplyErrors
PASS:  LibraryTest.ParseAReplyAllocFail
[snip]

Signed-off-by: Mingli Yu <mingli.yu@windriver.com>
---
 meta-oe/recipes-support/c-ares/c-ares/run-ptest | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

Comments

Marko, Peter April 15, 2024, 9:40 a.m. UTC | #1
-----Original Message-----
From: openembedded-devel@lists.openembedded.org <openembedded-devel@lists.openembedded.org> On Behalf Of Yu, Mingli via lists.openembedded.org
Sent: Monday, April 15, 2024 11:08
To: openembedded-devel@lists.openembedded.org
Subject: [oe] [meta-oe][PATCH] c-ares: Improve the ptest output

> From: Mingli Yu <mingli.yu@windriver.com>
>
> Before the patch:
>  # ./run-ptest
> [snip]
> [ DISABLED ] LibraryTest.DISABLED_ParseAReplyVariantCnameLast
> [ RUN      ] LibraryTest.ParseAReplyErrors
> [       OK ] LibraryTest.ParseAReplyErrors (4 ms)
> [ RUN      ] LibraryTest.ParseAReplyAllocFail
> [       OK ] LibraryTest.ParseAReplyAllocFail (0 ms)
> [snip]
>
> After the patch:
>  # ./run-ptest
> [snip]
> SKIP:  LibraryTest.DISABLED_ParseAReplyVariantCnameLast
> PASS:  LibraryTest.ParseAReplyErrors
> PASS:  LibraryTest.ParseAReplyAllocFail
> [snip]
>
> Signed-off-by: Mingli Yu <mingli.yu@windriver.com>
> ---
>  meta-oe/recipes-support/c-ares/c-ares/run-ptest | 6 +-----
>  1 file changed, 1 insertion(+), 5 deletions(-)
>
> diff --git a/meta-oe/recipes-support/c-ares/c-ares/run-ptest b/meta-oe/recipes-support/c-ares/c-ares/run-ptest
> index 46572111b..66ffd5388 100644
> --- a/meta-oe/recipes-support/c-ares/c-ares/run-ptest
> +++ b/meta-oe/recipes-support/c-ares/c-ares/run-ptest
> @@ -1,7 +1,3 @@
>  #!/bin/sh
> +./arestest --gtest_filter=-*.Live* --gtest_print_time=0 | sed -E  '/^\[ RUN/d ; s/\[       OK \]/PASS: / ; s/\[ DISABLED \]/SKIP: / ; s/\[ FAILED \]/FAIL: /'

There is a general problem with piping the test output that the result code of the test is ignored (result code of sed is used).
I tend to use "(test || echo 'FAIL: exit code') | sed ...", but that usually adds another failed testcase printed in addition to the real failed testcase.
However I have seen that test binary can fail without printing test failure (e.g. wrong path, missing executable rights, segmentation fault, ...) so exit code is important to be checked.

I'd appreciate if yocto elders would give some hints about how the run-ptest should be written if it does not support automake output format.
I'm rewriting lot of gtest based ptests right now when preparing upgrade from kirkstone to scarthgap due to test output format enforcement and this is giving me headaches...

>  
> -if ./arestest --gtest_filter=-*.Live*; then
> -	echo "PASS: c-ares"
> -else
> -	echo "FAIL: c-ares"
> -fi
> -- 
> 2.25.1
diff mbox series

Patch

diff --git a/meta-oe/recipes-support/c-ares/c-ares/run-ptest b/meta-oe/recipes-support/c-ares/c-ares/run-ptest
index 46572111b..66ffd5388 100644
--- a/meta-oe/recipes-support/c-ares/c-ares/run-ptest
+++ b/meta-oe/recipes-support/c-ares/c-ares/run-ptest
@@ -1,7 +1,3 @@ 
 #!/bin/sh
+./arestest --gtest_filter=-*.Live* --gtest_print_time=0 | sed -E  '/^\[ RUN/d ; s/\[       OK \]/PASS: / ; s/\[ DISABLED \]/SKIP: / ; s/\[ FAILED \]/FAIL: /'
 
-if ./arestest --gtest_filter=-*.Live*; then
-	echo "PASS: c-ares"
-else
-	echo "FAIL: c-ares"
-fi