Hi Yoann, Thank you for the quick review and helpful feedback!
I've addressed all your comments in v2: - Removed hardcoded "0.2.5" version from test summary - Removed static XFAIL/XPASS/ERROR lines (always 0) - Moved PTEST_TESTS definition above the functions for better readability - Changed run-ptest to auto-discover test binaries instead of hardcoding names v2 patch is sent separately. Thanks again for the review! Best Regards, Pratik ________________________________________ From: Yoann Congal <[email protected]> Sent: Friday, November 21, 2025 12:22 PM To: Pratik Farkase Cc: [email protected]; [email protected] Subject: Re: [OE-core][PATCH] libyaml: add ptest support Hello, Le ven. 21 nov. 2025 à 11:56, Pratik Farkase via lists.openembedded.org<http://lists.openembedded.org> <[email protected]<mailto:[email protected]>> a écrit : Add ptest support for libyaml to enable running the test suite on target devices. This includes: - test-version: Verifies library version information - test-reader: Tests YAML reading functionality The tests are built from the upstream test suite using the autotools check_PROGRAMS infrastructure. All 2 upstream tests pass successfully: START: ptest-runner BEGIN: /usr/lib/libyaml/ptest PASS: test-version PASS: test-reader DURATION: 0 END: /usr/lib/libyaml/ptest STOP: ptest-runner Signed-off-by: Pratik Farkase <[email protected]> --- .../recipes-support/libyaml/libyaml/run-ptest | 49 +++++++++++++++++++ meta/recipes-support/libyaml/libyaml_0.2.5.bb<http://libyaml_0.2.5.bb> | 21 +++++++- 2 files changed, 68 insertions(+), 2 deletions(-) create mode 100755 meta/recipes-support/libyaml/libyaml/run-ptest diff --git a/meta/recipes-support/libyaml/libyaml/run-ptest b/meta/recipes-support/libyaml/libyaml/run-ptest new file mode 100755 index 0000000000..885e4b68d5 --- /dev/null +++ b/meta/recipes-support/libyaml/libyaml/run-ptest @@ -0,0 +1,49 @@ +#!/bin/sh + +# run-ptest - Execute libyaml test suite + +cd tests || exit 1 + +TOTAL=0 +PASS=0 +FAIL=0 +SKIP=0 + +run_test() { + test_name="$1" + test_bin="./${test_name}" + + TOTAL=$((TOTAL + 1)) + + if [ ! -x "${test_bin}" ]; then + echo "SKIP: ${test_name}" + SKIP=$((SKIP + 1)) + return + fi + + if ${test_bin} >/dev/null 2>&1; then + echo "PASS: ${test_name}" + PASS=$((PASS + 1)) + else + echo "FAIL: ${test_name}" + FAIL=$((FAIL + 1)) + return 1 + fi +} + +run_test "test-version" +run_test "test-reader" This is the duplication of PTEST_TESTS. Is there any way to avoid the repetition? Run every binary in tests/ maybe? + +echo "============================================================================" +echo "Testsuite summary for yaml 0.2.5" This hard-coded "0.2.5" version will most likely *not* be updated on future upgrades. Either remove it (my recommendation) or generate it from $PV. +echo "============================================================================" +echo "# TOTAL: ${TOTAL}" +echo "# PASS: ${PASS}" +echo "# SKIP: ${SKIP}" +echo "# XFAIL: 0" +echo "# FAIL: ${FAIL}" +echo "# XPASS: 0" +echo "# ERROR: 0" +echo "============================================================================" The lines forced to "0" are not used by any tools (that I know of) and provide little info (being static). How about removing them? + +test ${FAIL} -eq 0 diff --git a/meta/recipes-support/libyaml/libyaml_0.2.5.bb<http://libyaml_0.2.5.bb> b/meta/recipes-support/libyaml/libyaml_0.2.5.bb<http://libyaml_0.2.5.bb> index 0d8e8762d5..1d950572ab 100644 --- a/meta/recipes-support/libyaml/libyaml_0.2.5.bb<http://libyaml_0.2.5.bb> +++ b/meta/recipes-support/libyaml/libyaml_0.2.5.bb<http://libyaml_0.2.5.bb> @@ -7,14 +7,31 @@ SECTION = "libs/devel" LICENSE = "MIT" LIC_FILES_CHKSUM = "file://License;md5=7bbd28caa69f81f5cd5f48647236663d" -SRC_URI = "https://pyyaml.org/download/libyaml/yaml-${PV}.tar.gz<https://pyyaml.org/download/libyaml/yaml-$%7BPV%7D.tar.gz>" +SRC_URI = "https://pyyaml.org/download/libyaml/yaml-${PV}.tar.gz<https://pyyaml.org/download/libyaml/yaml-$%7BPV%7D.tar.gz> \ + file://run-ptest \ +" SRC_URI[sha256sum] = "c642ae9b75fee120b2d96c712538bd2cf283228d2337df2cf2988e3c02678ef4" S = "${UNPACKDIR}/yaml-${PV}" -inherit autotools +inherit autotools ptest DISABLE_STATIC:class-nativesdk = "" DISABLE_STATIC:class-native = "" BBCLASSEXTEND = "native nativesdk" + +do_compile_ptest() { + oe_runmake -C tests ${PTEST_TESTS} +} + +do_install_ptest() { + install -d ${D}${PTEST_PATH}/tests + for test in ${PTEST_TESTS}; do + if [ -f ${B}/tests/.libs/${test} ]; then + install -m 0755 ${B}/tests/.libs/${test} ${D}${PTEST_PATH}/tests/ + fi + done +} + +PTEST_TESTS = "test-version test-reader" Can you put this definition above the tasks where it is used? That would make the code easier to read. Thanks! -- 2.43.0 -- Yoann Congal Smile ECS
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#226674): https://lists.openembedded.org/g/openembedded-core/message/226674 Mute This Topic: https://lists.openembedded.org/mt/116405792/21656 Group Owner: [email protected] Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]] -=-=-=-=-=-=-=-=-=-=-=-
