xdg-dbus-proxy: use VIRTUAL-RUNTIME_dbus for ptest RDEPENDS
PATCH 1/9 xdg-dbus-proxy: use VIRTUAL-RUNTIME_dbus for ptest RDEPENDS
From: Khem Raj <[email protected]>
Hardcoding "dbus" makes the ptest image unbuildable on any distro that selects a different system bus implementation. On a systemd distro setting VIRTUAL-RUNTIME_dbus = "dbus-broker", do_rootfs fails to solve:
package dbus-broker-37 conflicts with dbus provided by dbus-1-1.16.2 package systemd requires dbus-broker, but none of the providers can
be installed
package xdg-dbus-proxy-ptest requires dbus, but none of the providers
can be installed
Depend on ${VIRTUAL-RUNTIME_dbus} instead so the ptest package pulls in whichever bus the distro actually uses.
--- meta-oe/recipes-support/xdg-dbus-proxy/xdg-dbus-proxy_0.1.7.bb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
meta-oe/recipes-support/xdg-dbus-proxy/xdg-dbus-proxy_0.1.7.bb +1 -1
@@ -23,6 +23,6 @@ CVE_STATUS[CVE-2026-34080] = "fixed-version: fixed in 0.1.7" PACKAGECONFIG = "${@bb.utils.contains('PTEST_ENABLED', '1', 'tests', '', d)}" PACKAGECONFIG[tests] = "-Dtests=true -Dinstalled_tests=true,-Dtests=false -Dinstalled_tests=false" -RDEPENDS:${PN}-ptest += "dbus" +RDEPENDS:${PN}-ptest += "${VIRTUAL-RUNTIME_dbus}" BBCLASSEXTEND = "native"
PATCH 2/9 fwupd: use VIRTUAL-RUNTIME_dbus for ptest RDEPENDS
From: Khem Raj <[email protected]>
Same problem as xdg-dbus-proxy: the hardcoded "dbus" RDEPENDS makes meta-oe-image-ptest-fwupd fail do_rootfs on a distro whose VIRTUAL-RUNTIME_dbus is dbus-broker, since dbus-broker RCONFLICTS with the dbus provided by dbus-1 while systemd requires dbus-broker.
--- meta-oe/recipes-bsp/fwupd/fwupd_2.1.7.bb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
meta-oe/recipes-bsp/fwupd/fwupd_2.1.7.bb +1 -1
@@ -81,7 +81,7 @@ FILES:${PN} += "\ FILES:${PN}-ptest += "${libexecdir}/installed-tests/ \ ${datadir}/installed-tests/" -RDEPENDS:${PN}-ptest += "gnome-desktop-testing python3 dbus" +RDEPENDS:${PN}-ptest += "gnome-desktop-testing python3 ${VIRTUAL-RUNTIME_dbus}" # ESP mounting, not strictly necessary RRECOMMENDS:${PN} += "${@bb.utils.contains('DISTRO_FEATURES', 'polkit', 'udisks2', '', d)}"
PATCH 3/9 postgresql: drop bashisms from ptest runner
In reply to Khem RajFrom: Khem Raj <[email protected]>
run-ptest has a #!/bin/sh shebang but used two constructs that are not available in the target /bin/sh (dash), so the suite died immediately after starting the server and reported no test results at all:
run-ptest: line 54: stdbuf: not found
run-ptest: line 58: syntax error: bad substitution
ERROR: Exit status is 2
${PIPESTATUS[0]} is a bash array reference; dash has no PIPESTATUS and fails with "bad substitution". stdbuf is coreutils-only and is not guaranteed to be installed on the target.
Capture pg_regress output to a temporary file and use $? directly instead of piping live into sed, which removes the need for both PIPESTATUS and stdbuf while keeping the same PASS:/FAIL: translation.
--- .../recipes-dbs/postgresql/files/run-ptest | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-)
meta-oe/recipes-dbs/postgresql/files/run-ptest +14 -7
@@ -37,24 +37,31 @@ mkdir -p "${TESTDIR}/testtablespace" chmod 0700 "${TESTDIR}/testtablespace" chown postgres:postgres "${TESTDIR}/testtablespace" -# Disable set -e before the pipe so we can capture PIPESTATUS +# Disable set -e so we can capture the regression run's exit status set +e -# Run the regression tests. +# Run the regression tests, capturing output to a plain file instead of +# piping live into sed: ${PIPESTATUS[0]} is a bashism this script's +# "#!/bin/sh" shebang can't rely on (target /bin/sh is dash, which has no +# PIPESTATUS array and fails with "bad substitution"), and batching +# through a file avoids needing stdbuf, which isn't guaranteed installed. # --dlpath points to the standard PostgreSQL package library directory # where regress.so and contrib modules (autoinc.so, refint.so, etc.) # are installed, so that CREATE FUNCTION ... AS tests can locate them. +REGRESS_LOG=$(mktemp /tmp/postgresql-ptest.XXXXXX) su - postgres -c "cd ${TESTDIR} && \ ${TESTDIR}/pg_regress \ --inputdir=. \ --bindir=${PGBIN} \ --dlpath=${PKGLIBDIR} \ --max-concurrent-tests=20 \ - --schedule=parallel_schedule" 2>&1 | \ - stdbuf -oL sed -n \ - -e 's/^ok [0-9]\+\s\+[+* ]\?\s*/PASS: /p' \ - -e 's/^not ok [0-9]\+\s\+[+* ]\?\s*/FAIL: /p' -RESULT=${PIPESTATUS[0]} + --schedule=parallel_schedule" > "${REGRESS_LOG}" 2>&1 +RESULT=$? + +sed -n \ + -e 's/^ok [0-9]\+\s\+[+* ]\?\s*/PASS: /p' \ + -e 's/^not ok [0-9]\+\s\+[+* ]\?\s*/FAIL: /p' "${REGRESS_LOG}" +rm -f "${REGRESS_LOG}" if [ "${RESULT}" = "0" ]; then echo "PASS: all tests passed"
PATCH 4/9 pegtl: install ptest data files where the tests look for them
In reply to Khem RajFrom: Khem Raj <[email protected]>
14 of the 257 pegtl tests failed - every test that reads a data file (input_file_input, input_mmap_input, internal_file_mapper, internal_read_file_stdio, stream_*_input, example_json, ...) while the 243 tests that parse in-memory strings passed.
Upstream runs its tests from the source root:
src/test/CMakeLists.txt:299
add_test(NAME ${exename} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} ...)so the tests open their data with CWD-relative literals - grepping the test sources shows src/test/data/duseltronik.txt (7 references), src/test/data/test_data.txt (4) and src/test/data/{blns,pass1-3, fail1-39}.json. run-ptest executes the binaries from ${PTEST_PATH}, so the data has to be at ${PTEST_PATH}/src/test/data/.
The recipe instead installed it to src/test/pegtl/data - one directory too deep - and copied only *.json, so test_data.txt and duseltronik.txt were missing entirely. Install all of src/test/data to the path the tests actually use. The binaries stay in src/test/pegtl, which is where run-ptest globs for them.
--- meta-oe/recipes-extended/pegtl/pegtl_4.0.1.bb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
meta-oe/recipes-extended/pegtl/pegtl_4.0.1.bb +4 -3
@@ -12,8 +12,9 @@ SRCREV = "9ec6da187f840d8e804d42b9b7867f79d5d6adc2" inherit cmake ptest do_install_ptest () { - install -d ${D}${PTEST_PATH}/src/test/pegtl/data + install -d ${D}${PTEST_PATH}/src/test/pegtl + install -d ${D}${PTEST_PATH}/src/test/data install -m 0755 ${B}/src/test/pegtl-test-* ${D}${PTEST_PATH}/src/test/pegtl - install ${S}/src/test/file_*.txt ${D}${PTEST_PATH}/src/test/pegtl - install ${S}/src/test/data/*.json ${D}${PTEST_PATH}/src/test/pegtl/data + install -m 0644 ${S}/src/test/file_*.txt ${D}${PTEST_PATH}/src/test/ + install -m 0644 ${S}/src/test/data/* ${D}${PTEST_PATH}/src/test/data/ }
PATCH 5/9 libdbi-perl: add missing perl module ptest RDEPENDS
In reply to Khem RajFrom: Khem Raj <[email protected]>
All 6 ptest failures (t/31methcache, t/35thrclone, t/40profile, t/41prof_dump, t/42prof_data, t/43prof_env) are missing runtime perl modules, in two groups:
Module::Load, required by DBI/Profile.pm line 682:
Can't locate Module/Load.pm in @INC ... at /usr/lib/perl5/vendor_perl/5.44.0/aarch64-linux/DBI/Profile.pm line 682.
This breaks t/40profile and t/43prof_env directly, and cascades into t/41prof_dump and t/42prof_data: once DBI/Profile.pm fails to compile, %INC is poisoned, so those two report "Attempt to reload DBI/Profile.pm aborted" and a missing DBI::Profile->flush_to_disk method rather than the underlying cause. Provided by perl-module-load.
Test2::Util::Sig, required by Test2/IPC/Driver/Files.pm line 18, which Test::Builder pulls in when a test enables Test2 IPC (threads/forking):
Can't locate Test2/Util/Sig.pm in @INC ... at /usr/lib/perl5/5.44.0/Test2/IPC/Driver/Files.pm line 18.
This makes Test::More unusable in t/31methcache and t/35thrclone, which is why only those two of the many Test::More-based tests fail. Provided by perl-module-test2-util-sig.
--- meta-oe/recipes-devtools/perl/libdbi-perl_1.651.bb | 2 ++ 1 file changed, 2 insertions(+)
meta-oe/recipes-devtools/perl/libdbi-perl_1.651.bb +2 -0
@@ -53,6 +53,7 @@ RDEPENDS:${PN}-ptest += " \ perl-module-file-copy \ perl-module-file-path \ perl-module-lib \ + perl-module-load \ perl-module-perlio \ perl-module-perlio-encoding \ perl-module-perlio-scalar \
@@ -61,6 +62,7 @@ RDEPENDS:${PN}-ptest += " \ perl-module-storable \ perl-module-test-more \ perl-module-test2-ipc-driver \ + perl-module-test2-util-sig \ perl-module-threads \ perl-module-utf8 \ "
PATCH 6/9 freerdp3: install cmdline-tests data for ptest
In reply to Khem RajFrom: Khem Raj <[email protected]>
TestCommandLineToCommaSeparatedValues fails because its JSON test cases are never installed.
With no arguments the test runs runJsonTests(), which globs TEST_SOURCE_DIR/cmdline-tests/*.json via FindFirstFileA and returns -1 when the directory cannot be opened. do_configure:prepend already rewrites TEST_SOURCE_DIR for this CMakeLists to ${PTEST_PATH}/test, and the built driver confirms it:
$ strings Testing/TestWinPRUtils | grep -e cmdline-tests -e ptest/test cmdline-tests cmdline-tests%c*.json /usr/lib/freerdp3/ptest/test
but do_install_ptest only copies *bmp out of winpr/libwinpr/utils/test, so /usr/lib/freerdp3/ptest/test/cmdline-tests does not exist on target and the glob always fails. Copy the directory alongside the other test data.
--- meta-oe/recipes-support/freerdp/freerdp3_3.30.0.bb | 1 + 1 file changed, 1 insertion(+)
meta-oe/recipes-support/freerdp/freerdp3_3.30.0.bb +1 -0
@@ -86,6 +86,7 @@ do_install_ptest() { cp -r ${B}/Testing ${D}${PTEST_PATH} # test data cp ${S}/winpr/libwinpr/utils/test/*bmp ${D}${PTEST_PATH}/test/ + cp -r ${S}/winpr/libwinpr/utils/test/cmdline-tests ${D}${PTEST_PATH}/test/ cp ${S}/libfreerdp/codec/test/*bmp ${D}${PTEST_PATH}/test/ cp -r ${S}/client/common/test/* ${D}${PTEST_PATH}/test/ cp -r ${S}/resources ${D}${PTEST_PATH}
PATCH 7/9 xdg-dbus-proxy: skip ptest when dbus-daemon is unavailable
In reply to Khem RajFrom: Khem Raj <[email protected]>
tests/test-proxy.c setup() spawns the reference bus implementation directly:
g_subprocess_launcher_spawn (launcher, &error, "dbus-daemon",
"--session", "--print-address=1",
"--nofork", NULL);so the test aborts on distros that select a different VIRTUAL-RUNTIME_dbus:
ERROR:../tests/test-proxy.c:75:setup: assertion failed (error == NULL):
Failed to execute child process "dbus-daemon" (No such file or directory)
FAIL: xdg-dbus-proxy/test-proxy.test (Child process killed by signal 6)
dbus-daemon is packaged only in dbus, and dbus-broker carries "RCONFLICTS:dbus-broker: dbus", so the two cannot be co-installed; dbus-broker-launch is not CLI-compatible and cannot stand in. The existing RDEPENDS on ${VIRTUAL-RUNTIME_dbus} already pulls in dbus (and hence dbus-daemon) on distros that use it, so report the test as skipped rather than failed when the daemon genuinely is not installable.
--- .../xdg-dbus-proxy/xdg-dbus-proxy/run-ptest | 9 +++++++++ 1 file changed, 9 insertions(+)
meta-oe/recipes-support/xdg-dbus-proxy/xdg-dbus-proxy/run-ptest +9 -0
@@ -1,2 +1,11 @@ #!/bin/sh +# tests/test-proxy.c spawns the reference bus implementation directly as +# "dbus-daemon --session --print-address=1 --nofork". Distros that select a +# different VIRTUAL-RUNTIME_dbus (e.g. dbus-broker, which RCONFLICTS with dbus) +# have no dbus-daemon and no CLI-compatible replacement, so the test cannot run. +if ! command -v dbus-daemon >/dev/null 2>&1; then + echo "SKIP: xdg-dbus-proxy/test-proxy.test (no dbus-daemon; requires VIRTUAL-RUNTIME_dbus = dbus)" + exit 0 +fi + gnome-desktop-testing-runner xdg-dbus-proxy
PATCH 8/9 hunspell: add missing gconv ptest RDEPENDS
In reply to Khem RajFrom: Khem Raj <[email protected]>
All 25 ptest failures are missing glibc character-set converters. With run-ptest no longer discarding test.sh output, the cause is explicit:
error - iconv_open: ISO8859-1 -> UTF-8
error - iconv_open: UTF-8 -> ISO8859-1
=============================================
Fail in allcaps3.good. Good words recognised as wrong:
Aggregated over the run: 382 ISO8859-1 and 10 ISO8859-15 iconv_open failures, and every one of the 25 failing tests reports them.
Only glibc-gconv-iso8859-2 was pulled in, but the test corpus needs more than that. Dictionaries with no SET line in their .aff fall back to ISO8859-1 in both consumers of the default:
csutil.hxx:99 #define SPELL_ENCODING "ISO8859-1" affixmgr.cxx:3502 if (encoding.empty()) encoding = SPELL_ENCODING; hashmgr.cxx:97 if (!csconv) csconv = get_current_cs(SPELL_ENCODING);
and 92 of the 144 installed .aff files have no SET, which is why tests with pure-ASCII data and no SET line still needed a converter. The encodings actually referenced across the corpus are ISO8859-1, ISO8859-15, ISO-8859-15, ISO8859-2 and UTF-8; UTF-8 is built into glibc, so add the two missing ISO8859 modules.
--- meta-oe/recipes-support/hunspell/hunspell_1.7.3.bb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
meta-oe/recipes-support/hunspell/hunspell_1.7.3.bb +6 -1
@@ -34,6 +34,11 @@ do_install_ptest() { sed -i 's|alias analyze=.*ANALYZE.*|alias analyze="$ANALYZE"|' ${D}${PTEST_PATH}/tests/test.sh } -RDEPENDS:${PN}-ptest += "bash glibc-gconv-iso8859-2" +RDEPENDS:${PN}-ptest += " \ + bash \ + glibc-gconv-iso8859-1 \ + glibc-gconv-iso8859-2 \ + glibc-gconv-iso8859-15 \ +" BBCLASSEXTEND = "native"
PATCH 9/9 hunspell: keep ptest failure diagnostics instead of discarding them
In reply to Khem RajFrom: Khem Raj <[email protected]>
run-ptest ran each case as "./test.sh $test > /dev/null 2>&1", throwing away the only thing that explains a failure: test.sh prints which check failed and which words were misrecognised, e.g.
Fail in base.good. Good words recognised as wrong:
<words>
Without it a failing hunspell ptest reports a bare "FAIL: <name>" and gives no way to tell a packaging problem from a real defect when the suite runs on target.
Capture the output and print it, indented, under the FAIL line, and take test.sh's exit status directly rather than reading $? inside the else branch of the if that consumed it.
--- .../recipes-support/hunspell/files/run-ptest | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-)
meta-oe/recipes-support/hunspell/files/run-ptest +13 -8
@@ -16,15 +16,20 @@ for test in $tests; do if echo "$SKIP_TESTS" | grep -qw "$test"; then continue fi - - if ./test.sh "$test" > /dev/null 2>&1; then + + # Capture test.sh output rather than discarding it: on failure it + # reports which check failed and which words were misrecognised, + # which is the only usable diagnostic when running on target. + output=$(./test.sh "$test" 2>&1) + status=$? + + if [ $status -eq 0 ]; then echo "PASS: $test" + elif [ $status -eq 3 ]; then + echo "SKIP: $test" else - status=$? - if [ $status -eq 3 ]; then - echo "SKIP: $test" - else - echo "FAIL: $test" - fi + echo "FAIL: $test" + # Indent so ptest-runner does not mistake diagnostics for results. + printf '%s\n' "$output" | sed 's/^/ /' fi done