From 4d9a2757333636368fb3fb66095c1e23fa15da06 Mon Sep 17 00:00:00 2001 From: Jiaying Song Date: Fri, 21 Nov 2025 13:32:52 +0800 Subject: [PATCH] icu: Add configure option to enable Automake-style ptest output format Added a new configure option `--enable-automake-test-format` to enable Automake-style ptest output format. Signed-off-by: Jiaying Song Signed-off-by: Mathieu Dubois-Briand --- ...utput-compatible-with-Automake-forma.patch | 52 --------- ...tput-compatible-with-Automake-format.patch | 105 ++++++++++++++++++ meta/recipes-support/icu/icu_77-1.bb | 4 +- 3 files changed, 107 insertions(+), 54 deletions(-) delete mode 100644 meta/recipes-support/icu/icu/0001-Make-ICU-ptest-output-compatible-with-Automake-forma.patch create mode 100644 meta/recipes-support/icu/icu/0001-Make-ICU-test-output-compatible-with-Automake-format.patch diff --git a/meta/recipes-support/icu/icu/0001-Make-ICU-ptest-output-compatible-with-Automake-forma.patch b/meta/recipes-support/icu/icu/0001-Make-ICU-ptest-output-compatible-with-Automake-forma.patch deleted file mode 100644 index a3d9b468358..00000000000 --- a/meta/recipes-support/icu/icu/0001-Make-ICU-ptest-output-compatible-with-Automake-forma.patch +++ /dev/null @@ -1,52 +0,0 @@ -From f56e295e936c6c6d9c7219ef649697891cd11382 Mon Sep 17 00:00:00 2001 -From: Jiaying Song -Date: Mon, 3 Nov 2025 11:34:06 +0800 -Subject: [PATCH] Make ICU ptest output compatible with Automake format - -Change test result format to PASS/FAIL for Automake compatibility - -Upstream-Status: Submitted [https://github.com/unicode-org/icu/pull/3764] - -Signed-off-by: Jiaying Song ---- - test/intltest/intltest.cpp | 4 ++-- - tools/ctestfw/ctest.c | 3 ++- - 2 files changed, 4 insertions(+), 3 deletions(-) - -diff --git a/test/intltest/intltest.cpp b/test/intltest/intltest.cpp -index 33829b0..07071ea 100644 ---- a/test/intltest/intltest.cpp -+++ b/test/intltest/intltest.cpp -@@ -830,11 +830,11 @@ UBool IntlTest::runTestLoop( char* testname, char* par, char *baseName ) - saveBaseLoc[0]=0; /* reset path */ - - if (lastErrorCount == errorCount) { -- snprintf( msg, sizeof(msg), " } OK: %s ", name ); -+ snprintf(msg, sizeof(msg), "PASS: %s\n }", name); - if(!no_time) str_timeDelta(msg+strlen(msg),timeStop-timeStart); - lastTestFailed = false; - }else{ -- snprintf(msg, sizeof(msg), " } ERRORS (%li) in %s", static_cast(errorCount - lastErrorCount), name); -+ snprintf(msg, sizeof(msg), "FAIL: %s\n } (ERRORS: %li)", name, static_cast(errorCount - lastErrorCount)); - if(!no_time) str_timeDelta(msg+strlen(msg),timeStop-timeStart); - - for(int i=0;iname, ERROR_COUNT - myERROR_COUNT); - strcpy(ERROR_LOG[ERRONEOUS_FUNCTION_COUNT++], pathToFunction); - } else { -+ log_testinfo_i("\nPASS: %s\n", root->name); - if(!ON_LINE) { /* had some output */ - int spaces = FLAG_INDENT-(depth-1); - log_testinfo_i("} %*s[OK] ", spaces, "---"); --- -2.34.1 - diff --git a/meta/recipes-support/icu/icu/0001-Make-ICU-test-output-compatible-with-Automake-format.patch b/meta/recipes-support/icu/icu/0001-Make-ICU-test-output-compatible-with-Automake-format.patch new file mode 100644 index 00000000000..484e1c7f6f5 --- /dev/null +++ b/meta/recipes-support/icu/icu/0001-Make-ICU-test-output-compatible-with-Automake-format.patch @@ -0,0 +1,105 @@ +From 4779f798463d673dd74623979ec93141eb60d07a Mon Sep 17 00:00:00 2001 +From: Jiaying Song +Date: Fri, 21 Nov 2025 10:47:59 +0800 +Subject: [PATCH] Make ICU test output compatible with Automake format + +Update ICU test output to print each test result in the Automake "simple +test" format[1]: + +result: testname + +Where `result` is one of PASS, FAIL, or SKIP. + +[1] https://wiki.yoctoproject.org/wiki/Ptest + +Upstream-Status: Submitted [https://github.com/unicode-org/icu/pull/3764] + +Signed-off-by: Jiaying Song +--- + configure.ac | 17 +++++++++++++++++ + test/intltest/intltest.cpp | 10 +++++++++- + tools/ctestfw/ctest.c | 9 ++++++++- + 3 files changed, 34 insertions(+), 2 deletions(-) + +diff --git a/configure.ac b/configure.ac +index da4f170..514fa0c 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -1165,6 +1165,21 @@ If set, it will REPLACE any automatic list of libraries.], + *) AC_MSG_ERROR(bad value ${enableval} for --enable-samples) ;; + esac], + samples=true) ++ ++# Enable Automake-compatible test output format ++AC_ARG_ENABLE([automake-test-format], ++ AS_HELP_STRING([--enable-automake-test-format], ++ [Generate test output in Automake format (PASS / FAIL: testname) ]), ++ [ ++ if test "x$enableval" = "xyes"; then ++ UCONFIG_CPPFLAGS="${UCONFIG_CPPFLAGS} -DU_AUTOMAKE_TEST__FORMAT=1" ++ AC_MSG_RESULT([Automake test format is enabled]) ++ else ++ AC_MSG_RESULT([Automake test format is disabled]) ++ fi ++ ], ++ [enable_automake_test_format=no]) ++ + ICU_CONDITIONAL(SAMPLES, test "$samples" = true) + + ICUDATA_CHAR=$U_ENDIAN_CHAR +@@ -1428,3 +1443,5 @@ then + fi + + $as_unset _CXX_CXXSUFFIX ++ ++ +diff --git a/test/intltest/intltest.cpp b/test/intltest/intltest.cpp +index 33829b0..bf3ef56 100644 +--- a/test/intltest/intltest.cpp ++++ b/test/intltest/intltest.cpp +@@ -830,11 +830,19 @@ UBool IntlTest::runTestLoop( char* testname, char* par, char *baseName ) + saveBaseLoc[0]=0; /* reset path */ + + if (lastErrorCount == errorCount) { +- snprintf( msg, sizeof(msg), " } OK: %s ", name ); ++ #ifdef U_AUTOMAKE_TEST__FORMAT ++ snprintf(msg, sizeof(msg), "PASS: %s\n }", name); ++ #else ++ snprintf(msg, sizeof(msg), " } OK: %s ", name ); ++ #endif + if(!no_time) str_timeDelta(msg+strlen(msg),timeStop-timeStart); + lastTestFailed = false; + }else{ ++ #ifdef U_AUTOMAKE_TEST__FORMAT ++ snprintf(msg, sizeof(msg), "FAIL: %s\n } (ERRORS: %li)", name, static_cast(errorCount - lastErrorCount)); ++ #else + snprintf(msg, sizeof(msg), " } ERRORS (%li) in %s", static_cast(errorCount - lastErrorCount), name); ++ #endif + if(!no_time) str_timeDelta(msg+strlen(msg),timeStop-timeStart); + + for(int i=0;iname,ERROR_COUNT - myERROR_COUNT); ++ #else ++ log_testinfo_i("} ---[%d ERRORS in %s] ", ERROR_COUNT - myERROR_COUNT,pathToFunction); ++ #endif + strcpy(ERROR_LOG[ERRONEOUS_FUNCTION_COUNT++], pathToFunction); + } else { ++ #ifdef U_AUTOMAKE_TEST__FORMAT ++ log_testinfo_i("\nPASS: %s\n", root->name); ++ #endif + if(!ON_LINE) { /* had some output */ + int spaces = FLAG_INDENT-(depth-1); + log_testinfo_i("} %*s[OK] ", spaces, "---"); +-- +2.34.1 + diff --git a/meta/recipes-support/icu/icu_77-1.bb b/meta/recipes-support/icu/icu_77-1.bb index 370c14af818..7c9483c9759 100644 --- a/meta/recipes-support/icu/icu_77-1.bb +++ b/meta/recipes-support/icu/icu_77-1.bb @@ -23,7 +23,7 @@ inherit autotools pkgconfig github-releases EXTRA_OECONF = "--with-cross-build=${STAGING_ICU_DIR_NATIVE} --disable-icu-config ac_cv_path_install='install -c'" EXTRA_OECONF:class-native = "--disable-icu-config ac_cv_path_install='install -c'" EXTRA_OECONF:class-nativesdk = "--with-cross-build=${STAGING_ICU_DIR_NATIVE} --disable-icu-config ac_cv_path_install='install -c'" - +EXTRA_OECONF:append:class-target = " --enable-automake-test-format" EXTRA_OECONF:append:class-target = "${@oe.utils.conditional('SITEINFO_ENDIANNESS', 'be', ' --with-data-packaging=archive', '', d)}" TARGET_CXXFLAGS:append = "${@oe.utils.conditional('SITEINFO_ENDIANNESS', 'be', ' -DICU_DATA_DIR=\\""${datadir}/${BPN}/${@icu_install_folder(d)}\\""', '', d)}" @@ -122,7 +122,7 @@ SRC_URI = "${BASE_SRC_URI};name=code \ file://0001-ICU-23120-Mask-UnicodeStringTest-TestLargeMemory-on-.patch \ file://0001-test-Add-support-ptest.patch \ file://run-ptest \ - file://0001-Make-ICU-ptest-output-compatible-with-Automake-forma.patch \ + file://0001-Make-ICU-test-output-compatible-with-Automake-format.patch \ " SRC_URI:append:class-target = "\ -- 2.47.3