All of lore.kernel.org
 help / color / mirror / Atom feed
* [OE-core][PATCH v1] libffi: add ptest support
@ 2026-05-07  8:52 Pratik Farkase
  2026-05-08 10:24 ` [OE-core][PATCH v2] " Pratik Farkase
  0 siblings, 1 reply; 18+ messages in thread
From: Pratik Farkase @ 2026-05-07  8:52 UTC (permalink / raw)
  To: openembedded-core; +Cc: pratik.farkase, Pratik Farkase

Add ptest support for libffi using the upstream bhaible test suite which
validates FFI call and callback interfaces across various calling
conventions and data types.

Tests are compiled on-target against the installed libffi. Headers and a
linker symlink are installed in the ptest directory to avoid depending on
libffi-dev.

Tested on qemux86-64 with ptest-runner: 2 PASS, 0 FAIL (29s).

Signed-off-by: Pratik Farkase <pratik.farkase@est.tech>
---
 meta/conf/distro/include/ptest-packagelists.inc |  1 +
 meta/recipes-support/libffi/libffi/run-ptest    | 16 ++++++++++++++++
 meta/recipes-support/libffi/libffi_3.5.2.bb     | 16 +++++++++++++++-
 3 files changed, 32 insertions(+), 1 deletion(-)
 create mode 100755 meta/recipes-support/libffi/libffi/run-ptest

diff --git a/meta/conf/distro/include/ptest-packagelists.inc b/meta/conf/distro/include/ptest-packagelists.inc
index 566445187d..0918507ce5 100644
--- a/meta/conf/distro/include/ptest-packagelists.inc
+++ b/meta/conf/distro/include/ptest-packagelists.inc
@@ -36,6 +36,7 @@ PTESTS_FAST = "\
     libconfig \
     libconvert-asn1-perl \
     libexif \
+    libffi \
     libgpg-error\
     libksba \
     libmd \
diff --git a/meta/recipes-support/libffi/libffi/run-ptest b/meta/recipes-support/libffi/libffi/run-ptest
new file mode 100755
index 0000000000..9617977b00
--- /dev/null
+++ b/meta/recipes-support/libffi/libffi/run-ptest
@@ -0,0 +1,16 @@
+#!/bin/sh
+# SPDX-License-Identifier: MIT
+
+PTEST_DIR=$(cd "$(dirname "$0")" && pwd)
+cd "$PTEST_DIR/testsuite/libffi.bhaible" || exit 1
+
+for test in test-call test-callback; do
+    gcc -O2 -Wall -I$PTEST_DIR/include -L$PTEST_DIR/lib -o $test $test.c -lffi
+    if ./$test > $test.out 2>&1 && ! LC_ALL=C uniq -u < $test.out | grep -q .; then
+        echo "PASS: $test"
+    else
+        echo "FAIL: $test"
+        LC_ALL=C uniq -u < $test.out 2>/dev/null
+    fi
+    rm -f $test $test.out
+done
diff --git a/meta/recipes-support/libffi/libffi_3.5.2.bb b/meta/recipes-support/libffi/libffi_3.5.2.bb
index d3aa90d429..719c46865a 100644
--- a/meta/recipes-support/libffi/libffi_3.5.2.bb
+++ b/meta/recipes-support/libffi/libffi_3.5.2.bb
@@ -12,6 +12,7 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=ce4763670c5b7756000561f9af1ab178"
 
 SRC_URI = "${GITHUB_BASE_URI}/download/v${PV}/${BPN}-${PV}.tar.gz \
            file://not-win32.patch \
+           file://run-ptest \
            "
 SRC_URI[sha256sum] = "f3a3082a23b37c293a4fcd1053147b371f2ff91fa7ea1b2a52e335676bac82dc"
 
@@ -19,7 +20,7 @@ EXTRA_OECONF = "--disable-builddir"
 EXTRA_OECONF:class-native += "--with-gcc-arch=generic"
 EXTRA_OEMAKE:class-target = "LIBTOOLFLAGS='--tag=CC'"
 
-inherit autotools texinfo multilib_header github-releases
+inherit autotools texinfo multilib_header github-releases ptest
 
 do_install:append() {
 	oe_multilib_header ffi.h ffitarget.h
@@ -30,3 +31,16 @@ do_install:append() {
 MIPS_INSTRUCTION_SET = "mips"
 
 BBCLASSEXTEND = "native nativesdk"
+
+RDEPENDS:${PN}-ptest += "packagegroup-core-buildessential"
+
+do_install_ptest() {
+    install -d ${D}${PTEST_PATH}/testsuite
+    cp -r ${S}/testsuite/libffi.bhaible ${D}${PTEST_PATH}/testsuite/
+
+    install -d ${D}${PTEST_PATH}/include
+    install -m 0644 ${B}/include/ffi.h ${D}${PTEST_PATH}/include/
+    install -m 0644 ${B}/include/ffitarget.h ${D}${PTEST_PATH}/include/
+    install -d ${D}${PTEST_PATH}/lib
+    ln -sf ${libdir}/libffi.so.8 ${D}${PTEST_PATH}/lib/libffi.so
+}
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2026-05-25  9:30 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-07  8:52 [OE-core][PATCH v1] libffi: add ptest support Pratik Farkase
2026-05-08 10:24 ` [OE-core][PATCH v2] " Pratik Farkase
2026-05-08 11:25   ` Marko, Peter
2026-05-08 11:38     ` Pratik Farkase
2026-05-08 11:36   ` [OE-core][PATCH v3] " Pratik Farkase
2026-05-11  6:09     ` Mathieu Dubois-Briand
2026-05-11  9:00       ` Pratik Farkase
2026-05-11 12:25         ` Mathieu Dubois-Briand
2026-05-12  8:30           ` Pratik Farkase
2026-05-12 15:16             ` Mathieu Dubois-Briand
2026-05-13  5:33               ` Mathieu Dubois-Briand
2026-05-13  8:27                 ` Pratik Farkase
2026-05-13 11:31                   ` Mathieu Dubois-Briand
2026-05-13 13:30                     ` Pratik Farkase
2026-05-13 13:27   ` [OE-core][PATCH v4] " Pratik Farkase
2026-05-20 16:02     ` Ross Burton
2026-05-21  8:30       ` Pratik Farkase
2026-05-25  9:30   ` [OE-core][PATCH v5] " Pratik Farkase

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.