Skip to contentSkip to conversation

libatomic-ops: add ptest support

PATCH Superseded Pratik Farkase 2 participants 4 messages May 6 – May 21

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libatomic-ops: add ptest support

Add ptest support for libatomic-ops, running the upstream test suite which validates atomic operations, generalized emulation, pthread-based fallbacks, lock-free stack, and memory allocation.

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

---
 .../distro/include/ptest-packagelists.inc     |  1 +
 .../libatomic-ops/libatomic-ops/run-ptest     | 12 ++++++++++++
 .../libatomic-ops/libatomic-ops_7.10.0.bb     | 19 +++++++++++++++++--
 3 files changed, 30 insertions(+), 2 deletions(-)
 create mode 100755 meta/recipes-support/libatomic-ops/libatomic-ops/run-ptest
meta/conf/distro/include/ptest-packagelists.inc +1 -0
index 920e63e4b4..1ce8eda46d 100644
@@ -31,6 +31,7 @@ PTESTS_FAST = "\
     json-glib \
     libarchive \
     libassuan \
+    libatomic-ops \
     libcheck \
     libconfig \
     libconvert-asn1-perl \
meta/recipes-support/libatomic-ops/libatomic-ops/run-ptest new file +12 -0
new file mode 100755
index 0000000000..355908b85d
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+cd "$(dirname "$0")/tests" || exit 1
+
+for test in $(find . -maxdepth 1 -type f -executable | sort); do
+    testname=$(basename "$test")
+    if ./"$test"; then
+        echo "PASS: $testname"
+    else
+        echo "FAIL: $testname"
+    fi
+done
meta/recipes-support/libatomic-ops/libatomic-ops_7.10.0.bb +17 -2
index c31ccac7b0..9971124213 100644
@@ -8,7 +8,9 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
                     file://LICENSE;md5=5700d28353dfa2f191ca9b1bd707865e \
                     "
 
-SRC_URI = "${GITHUB_BASE_URI}/download/v${PV}/libatomic_ops-${PV}.tar.gz"
+SRC_URI = "${GITHUB_BASE_URI}/download/v${PV}/libatomic_ops-${PV}.tar.gz \
+           file://run-ptest \
+           "
 GITHUB_BASE_URI = "https://github.com/bdwgc/libatomic_ops/releases"
 
 SRC_URI[sha256sum] = "0db3ebff755db170f65e74a64ec4511812e9ee3185c232eeffeacd274190dfb0"
@@ -19,6 +21,19 @@ S = "${UNPACKDIR}/libatomic_ops-${PV}"
 
 ALLOW_EMPTY:${PN} = "1"
 
-inherit autotools pkgconfig github-releases
+inherit autotools pkgconfig github-releases ptest
+
+do_compile_ptest() {
+    oe_runmake -C ${B}/tests check TESTS=
+}
+
+do_install_ptest() {
+    install -d ${D}${PTEST_PATH}/tests
+
+    find ${B}/tests -maxdepth 1 -type f -executable \
+        ! -name "*.la" | while read -r t; do
+        ${B}/libtool --mode=install install -m 0755 "$t" ${D}${PTEST_PATH}/tests/
+    done
+}
 
 BBCLASSEXTEND = "native nativesdk"
Signature · 1 line
2.34.1
#1 lore raw

meta/recipes-support/libatomic-ops/libatomic-ops_7.10.0.bb S = "${UNPACKDIR}/libatomic_ops-${PV}" · line 34

Quoted 8 lines

On 6 May 2026, at 09:04, Pratik Farkase via lists.openembedded.org <[email protected]> wrote:diff --git a/meta/recipes-support/libatomic-ops/libatomic-ops_7.10.0.bb b/meta/recipes-support/libatomic-ops/libatomic-ops_7.10.0.bb

meta/recipes-support/libatomic-ops/libatomic-ops_7.10.0.bb +5 -0
+do_install_ptest() {
+    install -d ${D}${PTEST_PATH}/tests
+
+    find ${B}/tests -maxdepth 1 -type f -executable \
+        ! -name "*.la" | while read -r t; do

Can you use makefile-getvar to get the right list?

Ross

#2 lore raw

Fixed this in v2.

Best Regards,
Pratik

________________________________________
From: Ross Burton <[email protected]>
Sent: Wednesday, May 20, 2026 6:34 PM
To: Pratik Farkase
Cc: [email protected]; [email protected]
Subject: Re: [OE-core][PATCH v1] libatomic-ops: add ptest support

meta/recipes-support/libatomic-ops/libatomic-ops_7.10.0.bb S = "${UNPACKDIR}/libatomic_ops-${PV}" · line 34

Quoted 6 lines

On 6 May 2026, at 09:04, Pratik Farkase via lists.openembedded.org <[email protected]> wrote:diff --git a/meta/recipes-support/libatomic-ops/libatomic-ops_7.10.0.bb b/meta/recipes-support/libatomic-ops/libatomic-ops_7.10.0.bb

meta/recipes-support/libatomic-ops/libatomic-ops_7.10.0.bb +5 -0
+do_install_ptest() {
+    install -d ${D}${PTEST_PATH}/tests
+
+    find ${B}/tests -maxdepth 1 -type f -executable \
+        ! -name "*.la" | while read -r t; do

Can you use makefile-getvar to get the right list?

Ross

#3 lore raw

PATCH v2 1/1 libatomic-ops: add ptest support

In reply to Pratik Farkase

Add ptest support for libatomic-ops, running the upstream test suite which validates atomic operations, generalized emulation, pthread-based fallbacks, lock-free stack, and memory allocation.

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

---
Changes in v2:
- Use makefile-getvar to get check_PROGRAMS instead of find

 .../conf/distro/include/ptest-packagelists.inc |  1 +
 .../libatomic-ops/libatomic-ops/run-ptest      | 12 ++++++++++++
 .../libatomic-ops/libatomic-ops_7.10.0.bb      | 18 ++++++++++++++++--
 3 files changed, 29 insertions(+), 2 deletions(-)
 create mode 100755 meta/recipes-support/libatomic-ops/libatomic-ops/run-ptest
meta/conf/distro/include/ptest-packagelists.inc +1 -0
index 50b6a8a41e..5238013c6b 100644
@@ -30,6 +30,7 @@ PTESTS_FAST = "\
     json-glib \
     libarchive \
     libassuan \
+    libatomic-ops \
     libcheck \
     libconfig \
     libconvert-asn1-perl \
meta/recipes-support/libatomic-ops/libatomic-ops/run-ptest new file +12 -0
new file mode 100755
index 0000000000..355908b85d
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+cd "$(dirname "$0")/tests" || exit 1
+
+for test in $(find . -maxdepth 1 -type f -executable | sort); do
+    testname=$(basename "$test")
+    if ./"$test"; then
+        echo "PASS: $testname"
+    else
+        echo "FAIL: $testname"
+    fi
+done
meta/recipes-support/libatomic-ops/libatomic-ops_7.10.0.bb +16 -2
index c31ccac7b0..82adf417a3 100644
@@ -8,7 +8,9 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
                     file://LICENSE;md5=5700d28353dfa2f191ca9b1bd707865e \
                     "
 
-SRC_URI = "${GITHUB_BASE_URI}/download/v${PV}/libatomic_ops-${PV}.tar.gz"
+SRC_URI = "${GITHUB_BASE_URI}/download/v${PV}/libatomic_ops-${PV}.tar.gz \
+           file://run-ptest \
+           "
 GITHUB_BASE_URI = "https://github.com/bdwgc/libatomic_ops/releases"
 
 SRC_URI[sha256sum] = "0db3ebff755db170f65e74a64ec4511812e9ee3185c232eeffeacd274190dfb0"
@@ -19,6 +21,18 @@ S = "${UNPACKDIR}/libatomic_ops-${PV}"
 
 ALLOW_EMPTY:${PN} = "1"
 
-inherit autotools pkgconfig github-releases
+inherit autotools pkgconfig github-releases ptest
+
+do_compile_ptest() {
+    oe_runmake -C ${B}/tests check TESTS=
+}
+
+do_install_ptest() {
+    install -d ${D}${PTEST_PATH}/tests
+
+    for t in $(makefile-getvar ${B}/tests/Makefile check_PROGRAMS); do
+        ${B}/libtool --mode=install install -m 0755 ${B}/tests/$t ${D}${PTEST_PATH}/tests/
+    done
+}
 
 BBCLASSEXTEND = "native nativesdk"
Signature · 1 line
2.34.1