diff mbox series

icu: use automake ptest output format

Message ID 20251024072750.2756709-1-jiaying.song.cn@windriver.com
State New
Headers show
Series icu: use automake ptest output format | expand

Commit Message

Song, Jiaying (CN) Oct. 24, 2025, 7:27 a.m. UTC
From: Jiaying Song <jiaying.song.cn@windriver.com>

Make ICU ptest output compatible with the Automake format, and log the
ICU test output to a date-stamped file with a test summary appended.

Signed-off-by: Jiaying Song <jiaying.song.cn@windriver.com>
---
 meta/recipes-support/icu/icu/run-ptest | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

Comments

Alexander Kanavin Oct. 24, 2025, 11:30 a.m. UTC | #1
On Fri, 24 Oct 2025 at 09:27, Song, Jiaying (CN) via
lists.openembedded.org
<Jiaying.Song.CN=windriver.com@lists.openembedded.org> wrote:
> -       ./$t
> -       if [ "$?" = "0" ]; then
> -               echo "PASS: $t"
> -       else
> -               echo "FAIL: $t"
> -       fi
> +    ./"$t" 2>&1 | sed -e '/---\[OK\]/ s/^/PASS: /' \
> +                      -e '/} OK:/ s/^/PASS: /' \
> +                      -e '/---\[[0-9]* ERRORS in / s/^/FAIL: /' \
> +                      -e '/} ERRORS/ s/^/FAIL: /' | tee -a "${LOG}"

This sed expression is both hard to read and brittle: if upstream
subtly changes the output, will it still capture the results
correctly?

If any of $t fails but prints nothing, will this be reported as a
failure? This changes the logic that is based on return codes into
logic that relies on correct and useful output by any individual test,
and I think the new approach is less reliable.

I'd rather change the icu code itself to produce the needed output
(perhaps subject to a command line option), and offer that patch
upstream.

Alex
Song, Jiaying (CN) Oct. 31, 2025, 6:52 a.m. UTC | #2
Hi Alex,

Thanks for your feedback.In v2 I implemented the change by modifying the ICU source code itself to produce Automake-compatible ptest output, instead of using a sed post-processing step. The updated patch (v2) has been submitted.

Best regards,
Jiaying

-----Original Message-----
From: Alexander Kanavin <alex.kanavin@gmail.com> 
Sent: Friday, October 24, 2025 7:30 PM
To: Song, Jiaying (CN) <Jiaying.Song.CN@windriver.com>
Cc: openembedded-core@lists.openembedded.org
Subject: Re: [OE-core] [PATCH] icu: use automake ptest output format

CAUTION: This email comes from a non Wind River email account!
Do not click links or open attachments unless you recognize the sender and know the content is safe.

On Fri, 24 Oct 2025 at 09:27, Song, Jiaying (CN) via lists.openembedded.org <Jiaying.Song.CN=windriver.com@lists.openembedded.org> wrote:
> -       ./$t
> -       if [ "$?" = "0" ]; then
> -               echo "PASS: $t"
> -       else
> -               echo "FAIL: $t"
> -       fi
> +    ./"$t" 2>&1 | sed -e '/---\[OK\]/ s/^/PASS: /' \
> +                      -e '/} OK:/ s/^/PASS: /' \
> +                      -e '/---\[[0-9]* ERRORS in / s/^/FAIL: /' \
> +                      -e '/} ERRORS/ s/^/FAIL: /' | tee -a "${LOG}"

This sed expression is both hard to read and brittle: if upstream subtly changes the output, will it still capture the results correctly?

If any of $t fails but prints nothing, will this be reported as a failure? This changes the logic that is based on return codes into logic that relies on correct and useful output by any individual test, and I think the new approach is less reliable.

I'd rather change the icu code itself to produce the needed output (perhaps subject to a command line option), and offer that patch upstream.

Alex
diff mbox series

Patch

diff --git a/meta/recipes-support/icu/icu/run-ptest b/meta/recipes-support/icu/icu/run-ptest
index e5bf27a822..0c845f2be7 100755
--- a/meta/recipes-support/icu/icu/run-ptest
+++ b/meta/recipes-support/icu/icu/run-ptest
@@ -2,12 +2,20 @@ 
 
 TOPDIR=$(dirname "$(realpath $0)")
 cd ${TOPDIR}/test/tests
+LOG="${TOPDIR}/ptest_$(date +%Y%m%d-%H%M%S).log"
 TESTS=$(find . -executable -type f)
 for t in ${TESTS}; do
-	./$t
-	if [ "$?" = "0" ]; then
-		echo "PASS: $t"
-	else
-		echo "FAIL: $t"
-	fi
+    ./"$t" 2>&1 | sed -e '/---\[OK\]/ s/^/PASS: /' \
+                      -e '/} OK:/ s/^/PASS: /' \
+                      -e '/---\[[0-9]* ERRORS in / s/^/FAIL: /' \
+                      -e '/} ERRORS/ s/^/FAIL: /' | tee -a "${LOG}"
 done
+
+passed=$(grep '^PASS:' "${LOG}" | wc -l)
+failed=$(grep '^FAIL:' "${LOG}" | wc -l)
+total=$((passed + failed))
+
+echo "=== Test Summary ===" | tee -a "${LOG}"
+echo "TOTAL: ${total}" | tee -a "${LOG}"
+echo "PASSED: ${passed}" | tee -a "${LOG}"
+echo "FAILED: ${failed}" | tee -a "${LOG}"