-----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...@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...@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

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#109954): 
https://lists.openembedded.org/g/openembedded-devel/message/109954
Mute This Topic: https://lists.openembedded.org/mt/105532398/21656
Group Owner: openembedded-devel+ow...@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to