| Message ID | 20251121115420.15308-1-pratik.farkase@est.tech |
|---|---|
| State | New |
| Headers | show |
| Series | [v2] libyaml: add ptest support | expand |
Le ven. 21 nov. 2025 à 12:54, Pratik Farkase via lists.openembedded.org <pratik.farkase=est.tech@lists.openembedded.org> 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 > > 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 > > Changes in v2: > - Remove hardcoded version from test summary > - Remove static XFAIL/XPASS/ERROR lines (always 0) > - Move PTEST_TESTS definition above functions for better readability > - Auto-discover test binaries in run-ptest > ^ this changelog is nice but need to go after the "---" line (that way, it is in mails for review but not in final commit message) > > Signed-off-by: Pratik Farkase <pratik.farkase@est.tech> > --- > .../distro/include/ptest-packagelists.inc | 1 + > .../recipes-support/libyaml/libyaml/run-ptest | 46 +++++++++++++++++++ > meta/recipes-support/libyaml/libyaml_0.2.5.bb | 21 ++++++++- > 3 files changed, 66 insertions(+), 2 deletions(-) > create mode 100755 meta/recipes-support/libyaml/libyaml/run-ptest > > diff --git a/meta/conf/distro/include/ptest-packagelists.inc > b/meta/conf/distro/include/ptest-packagelists.inc > index 06d113e264..6a0c23586e 100644 > --- a/meta/conf/distro/include/ptest-packagelists.inc > +++ b/meta/conf/distro/include/ptest-packagelists.inc > @@ -49,6 +49,7 @@ PTESTS_FAST = "\ > libxml-simple-perl \ > libxml2 \ > libxmlb \ > + libyaml \ > logrotate \ > lua \ > lzo \ > diff --git a/meta/recipes-support/libyaml/libyaml/run-ptest > b/meta/recipes-support/libyaml/libyaml/run-ptest > new file mode 100755 > index 0000000000..a9cbe9cf0d > --- /dev/null > +++ b/meta/recipes-support/libyaml/libyaml/run-ptest > @@ -0,0 +1,46 @@ > +#!/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 > This test is now redundant. You can remove it. > + > + 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 > +} > + > +for test_bin in ./test-*; do > + if [ -x "${test_bin}" ]; then > + test_name=$(basename "${test_bin}") > + run_test "${test_name}" > + fi > +done > + > +echo "# TOTAL: ${TOTAL}" > +echo "# PASS: ${PASS}" > +echo "# SKIP: ${SKIP}" > +echo "# FAIL: ${FAIL}" > + > +test ${FAIL} -eq 0 > diff --git a/meta/recipes-support/libyaml/libyaml_0.2.5.bb > b/meta/recipes-support/libyaml/libyaml_0.2.5.bb > index 0d8e8762d5..9a905215d3 100644 > --- a/meta/recipes-support/libyaml/libyaml_0.2.5.bb > +++ b/meta/recipes-support/libyaml/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" > +SRC_URI = "https://pyyaml.org/download/libyaml/yaml-${PV}.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" > + > +PTEST_TESTS = "test-version test-reader" > + > +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 > +} > -- > 2.43.0 > > -=-=-=-=-=-=-=-=-=-=-=- > Links: You receive all messages sent to this group. > View/Reply Online (#226673): > https://lists.openembedded.org/g/openembedded-core/message/226673 > Mute This Topic: https://lists.openembedded.org/mt/116406209/4316185 > Group Owner: openembedded-core+owner@lists.openembedded.org > Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [ > yoann.congal@smile.fr] > -=-=-=-=-=-=-=-=-=-=-=- > >
diff --git a/meta/conf/distro/include/ptest-packagelists.inc b/meta/conf/distro/include/ptest-packagelists.inc index 06d113e264..6a0c23586e 100644 --- a/meta/conf/distro/include/ptest-packagelists.inc +++ b/meta/conf/distro/include/ptest-packagelists.inc @@ -49,6 +49,7 @@ PTESTS_FAST = "\ libxml-simple-perl \ libxml2 \ libxmlb \ + libyaml \ logrotate \ lua \ lzo \ diff --git a/meta/recipes-support/libyaml/libyaml/run-ptest b/meta/recipes-support/libyaml/libyaml/run-ptest new file mode 100755 index 0000000000..a9cbe9cf0d --- /dev/null +++ b/meta/recipes-support/libyaml/libyaml/run-ptest @@ -0,0 +1,46 @@ +#!/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 +} + +for test_bin in ./test-*; do + if [ -x "${test_bin}" ]; then + test_name=$(basename "${test_bin}") + run_test "${test_name}" + fi +done + +echo "# TOTAL: ${TOTAL}" +echo "# PASS: ${PASS}" +echo "# SKIP: ${SKIP}" +echo "# FAIL: ${FAIL}" + +test ${FAIL} -eq 0 diff --git a/meta/recipes-support/libyaml/libyaml_0.2.5.bb b/meta/recipes-support/libyaml/libyaml_0.2.5.bb index 0d8e8762d5..9a905215d3 100644 --- a/meta/recipes-support/libyaml/libyaml_0.2.5.bb +++ b/meta/recipes-support/libyaml/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" +SRC_URI = "https://pyyaml.org/download/libyaml/yaml-${PV}.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" + +PTEST_TESTS = "test-version test-reader" + +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 +}
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 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 Changes in v2: - Remove hardcoded version from test summary - Remove static XFAIL/XPASS/ERROR lines (always 0) - Move PTEST_TESTS definition above functions for better readability - Auto-discover test binaries in run-ptest Signed-off-by: Pratik Farkase <pratik.farkase@est.tech> --- .../distro/include/ptest-packagelists.inc | 1 + .../recipes-support/libyaml/libyaml/run-ptest | 46 +++++++++++++++++++ meta/recipes-support/libyaml/libyaml_0.2.5.bb | 21 ++++++++- 3 files changed, 66 insertions(+), 2 deletions(-) create mode 100755 meta/recipes-support/libyaml/libyaml/run-ptest