Add ptest support for liburcu, running the upstream unit test suite
(674 TAP assertions across 24 tests). This covers architecture checks,
atomic operations, multiflavor builds, sysfs helpers, and build
verification tests.

Tested on qemux86-64 with ptest-runner: 24 PASS, 0 FAIL.

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.6.bb | 30 +++++++++++++++++--
 3 files changed, 46 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 50b6a8a41e..ed89f9dc76 100644
--- a/meta/conf/distro/include/ptest-packagelists.inc
+++ b/meta/conf/distro/include/ptest-packagelists.inc
@@ -48,6 +48,7 @@ PTESTS_FAST = "\
     libtest-warnings-perl \
     libtimedate-perl \
     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.6.bb 
b/meta/recipes-support/liburcu/liburcu_0.15.6.bb
index 1cb349f55d..e02f797041 100644
--- a/meta/recipes-support/liburcu/liburcu_0.15.6.bb
+++ b/meta/recipes-support/liburcu/liburcu_0.15.6.bb
@@ -11,15 +11,41 @@ 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] = 
"850b192096eb11ebf2c70e8f97bc7da7479ee41da1bebeb44e3986908bac414f"
 
 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
+
+    find ${B}/tests/unit -maxdepth 1 -type f -executable \
+        ! -name "*.la" | while read -r t; do
+        ${B}/libtool --mode=install install -m 0755 "$t" 
${D}${PTEST_PATH}/tests/unit/
+    done
+
+    install -m 0755 ${S}/tests/unit/test_get_cpu_mask_from_sysfs 
${D}${PTEST_PATH}/tests/unit/
+    install -m 0755 ${S}/tests/unit/test_get_cpu_mask_from_sysfs_cxx 
${D}${PTEST_PATH}/tests/unit/
+    install -m 0755 ${S}/tests/unit/test_get_max_cpuid_from_sysfs 
${D}${PTEST_PATH}/tests/unit/
+    install -m 0755 ${S}/tests/unit/test_get_max_cpuid_from_sysfs_cxx 
${D}${PTEST_PATH}/tests/unit/
+
+    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.44.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#236481): 
https://lists.openembedded.org/g/openembedded-core/message/236481
Mute This Topic: https://lists.openembedded.org/mt/119158461/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to