Build liburcu's upstream unit test suite and run it under ptest. The test programs and their shell-script wrappers are enumerated from the Makefile via makefile-getvar and installed with libtool so the real binaries are resolved from .libs.
Tested on qemuriscv64 with ptest-runner: 24 tests, all pass. Signed-off-by: Pratik Farkase <[email protected]> --- .../distro/include/ptest-packagelists.inc | 1 + .../recipes-support/liburcu/liburcu/run-ptest | 17 ++++++++++ .../recipes-support/liburcu/liburcu_0.15.7.bb | 32 +++++++++++++++++-- 3 files changed, 48 insertions(+), 2 deletions(-) create mode 100755 meta/recipes-support/liburcu/liburcu/run-ptest diff --git a/meta/conf/distro/include/ptest-packagelists.inc b/meta/conf/distro/include/ptest-packagelists.inc index a77cf7f5be..74591a34f2 100644 --- a/meta/conf/distro/include/ptest-packagelists.inc +++ b/meta/conf/distro/include/ptest-packagelists.inc @@ -51,6 +51,7 @@ PTESTS_FAST = "\ libtimedate-perl \ libtoml11 \ libtry-tiny-perl \ + liburcu \ libusb1 \ libxml-namespacesupport-perl \ libxml-parser-perl \ diff --git a/meta/recipes-support/liburcu/liburcu/run-ptest b/meta/recipes-support/liburcu/liburcu/run-ptest new file mode 100755 index 0000000000..5f8fb4fcfe --- /dev/null +++ b/meta/recipes-support/liburcu/liburcu/run-ptest @@ -0,0 +1,17 @@ +#!/bin/sh + +PTEST_PATH=$(dirname "$0") +cd "$PTEST_PATH/tests/unit" || exit 1 + +export URCU_TESTS_SRCDIR="$PTEST_PATH/tests" +export URCU_TESTS_BUILDDIR="$PTEST_PATH/tests" +export URCU_TESTS_OS_TYPE="linux" + +for test in $(find . -maxdepth 1 -type f -executable -name "test_*" | sort); do + testname=$(basename "$test") + if ./"$test"; then + echo "PASS: $testname" + else + echo "FAIL: $testname" + fi +done diff --git a/meta/recipes-support/liburcu/liburcu_0.15.7.bb b/meta/recipes-support/liburcu/liburcu_0.15.7.bb index 0aa51903be..18cf6a2e46 100644 --- a/meta/recipes-support/liburcu/liburcu_0.15.7.bb +++ b/meta/recipes-support/liburcu/liburcu_0.15.7.bb @@ -11,15 +11,43 @@ LIC_FILES_CHKSUM = "file://LICENSE.md;md5=c2a92498b6e88e276f986877995425b8 \ file://include/urcu/uatomic/x86.h;beginline=1;endline=6;md5=358d69272ba7b5f85e29e342430d440c \ " -SRC_URI = "http://lttng.org/files/urcu/userspace-rcu-${PV}.tar.bz2" +SRC_URI = "http://lttng.org/files/urcu/userspace-rcu-${PV}.tar.bz2 \ + file://run-ptest \ + " SRC_URI[sha256sum] = "2556b83adc0f9b3ac8024e613e17d014d04c4c49110604ce55fcb14eae32edd3" S = "${UNPACKDIR}/userspace-rcu-${PV}" -inherit autotools multilib_header +inherit autotools multilib_header ptest CPPFLAGS:append:riscv64 = " -pthread -D_REENTRANT" +RDEPENDS:${PN}-ptest += "bash" + do_install:append() { oe_multilib_header urcu/config.h } + +do_compile_ptest() { + oe_runmake -C ${B}/tests/unit check TESTS= +} + +do_install_ptest() { + install -d ${D}${PTEST_PATH}/tests/unit + + # Compiled test programs (libtool resolves the real binary from .libs). + for p in $(makefile-getvar ${B}/tests/unit/Makefile noinst_PROGRAMS); do + ${B}/libtool --mode=install install -m 0755 ${B}/tests/unit/$p \ + ${D}${PTEST_PATH}/tests/unit/ + done + + # Shell-script test wrappers shipped in the source tree (names come from + # the configured build Makefile; the files live in ${S}). + for s in $(makefile-getvar ${B}/tests/unit/Makefile dist_noinst_SCRIPTS); do + install -m 0755 ${S}/tests/unit/$s ${D}${PTEST_PATH}/tests/unit/ + done + + install -d ${D}${PTEST_PATH}/tests/utils + install -m 0644 ${S}/tests/utils/tap.sh ${D}${PTEST_PATH}/tests/utils/ + install -m 0644 ${S}/tests/utils/utils.sh ${D}${PTEST_PATH}/tests/utils/ +} -- 2.43.0
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#248443): https://lists.openembedded.org/g/openembedded-core/message/248443 Mute This Topic: https://lists.openembedded.org/mt/121882653/21656 Group Owner: [email protected] Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]] -=-=-=-=-=-=-=-=-=-=-=-
