Skip to contentSkip to conversation

c-ares: Improve the ptest output

PATCH In review [email protected] 2 participants 2 messages Apr 15, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 c-ares: Improve the ptest output

From: Mingli Yu <[email protected]>

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]
---
 meta-oe/recipes-support/c-ares/c-ares/run-ptest | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
meta-oe/recipes-support/c-ares/c-ares/run-ptest +1 -5
index 46572111b..66ffd5388 100644
@@ -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
Signature · 1 line
2.25.1
#1 lore raw

-----Original Message-----
From: [email protected] <[email protected]> On Behalf Of Yu, Mingli via lists.openembedded.org
Sent: Monday, April 15, 2024 11:08
To: [email protected]
Subject: [oe] [meta-oe][PATCH] c-ares: Improve the ptest output

Quoted 30 lines

From: Mingli Yu <[email protected]>

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]
---
 meta-oe/recipes-support/c-ares/c-ares/run-ptest | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
meta-oe/recipes-support/c-ares/c-ares/run-ptest +0 -0
index 46572111b..66ffd5388 100644

meta-oe/recipes-support/c-ares/c-ares/run-ptest line 2

Quoted 2 lines
meta-oe/recipes-support/c-ares/c-ares/run-ptest +1 -0
@@ -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...

Quoted 8 lines
meta-oe/recipes-support/c-ares/c-ares/run-ptest +0 -5
-if ./arestest --gtest_filter=-*.Live*; then
-	echo "PASS: c-ares"
-else
-	echo "FAIL: c-ares"
-fi
Signature · 1 line
2.25.1