Openembedded Core Discussions
 help / color / mirror / Atom feed
* [master][PATCH v2] libsdl2: Add tests package and ptest support
@ 2025-09-04  0:07 a-christidis
  2025-09-04  8:41 ` Mathieu Dubois-Briand
  2025-09-04 11:27 ` Alexander Kanavin
  0 siblings, 2 replies; 6+ messages in thread
From: a-christidis @ 2025-09-04  0:07 UTC (permalink / raw)
  To: openembedded-core, mathieu.dubois-briand; +Cc: alex, alex.kanavin

From: Antonios Christidis <a-christidis@ti.com>

The SDL2 software comes with its own set of tests. Following that
introduce support for ptest.

Signed-off-by: Antonios Christidis <a-christidis@ti.com>
---
v2:
- Updated run-ptest to be posix compliant 
- Use SDL_INSTALL_TESTS cmake config parameter

 meta/conf/distro/include/ptest-packagelists.inc |  1 +
 meta/recipes-graphics/libsdl2/libsdl2/run-ptest | 16 ++++++++++++++++
 meta/recipes-graphics/libsdl2/libsdl2_2.32.8.bb | 13 +++++++++++--
 3 files changed, 28 insertions(+), 2 deletions(-)
 create mode 100644 meta/recipes-graphics/libsdl2/libsdl2/run-ptest

diff --git a/meta/conf/distro/include/ptest-packagelists.inc b/meta/conf/distro/include/ptest-packagelists.inc
index 9a7b25a916..a5476927b5 100644
--- a/meta/conf/distro/include/ptest-packagelists.inc
+++ b/meta/conf/distro/include/ptest-packagelists.inc
@@ -32,6 +32,7 @@ PTESTS_FAST = "\
     libgpg-error\
     libnl \
     libpcre \
+    libsdl2 \
     libssh2 \
     libtest-fatal-perl \
     libtest-needs-perl \
diff --git a/meta/recipes-graphics/libsdl2/libsdl2/run-ptest b/meta/recipes-graphics/libsdl2/libsdl2/run-ptest
new file mode 100644
index 0000000000..acdfa951e9
--- /dev/null
+++ b/meta/recipes-graphics/libsdl2/libsdl2/run-ptest
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+test_array="testdraw2 testgeometry testsprite2 testgles2 testoffscreen"
+
+
+test_path="/usr/libexec/installed-tests/SDL2/"
+
+for test in ${test_array}
+do
+    timeout --preserve-status 10 "$test_path""$test"
+    if [ $? -eq 0 ]; then
+        echo "PASS: $test"
+    else
+        echo "FAIL: $test"
+    fi
+done
diff --git a/meta/recipes-graphics/libsdl2/libsdl2_2.32.8.bb b/meta/recipes-graphics/libsdl2/libsdl2_2.32.8.bb
index 98291e0f80..9134a408c6 100644
--- a/meta/recipes-graphics/libsdl2/libsdl2_2.32.8.bb
+++ b/meta/recipes-graphics/libsdl2/libsdl2_2.32.8.bb
@@ -21,13 +21,15 @@ LIC_FILES_CHKSUM:append = " ${@bb.utils.contains('PACKAGECONFIG', 'arm-neon', 'f
 
 PROVIDES = "virtual/libsdl2"
 
-SRC_URI = "https://www.libsdl.org/release/SDL2-${PV}.tar.gz"
+SRC_URI = "https://www.libsdl.org/release/SDL2-${PV}.tar.gz \
+           file://run-ptest \
+	   "
 
 S = "${UNPACKDIR}/SDL2-${PV}"
 
 SRC_URI[sha256sum] = "0ca83e9c9b31e18288c7ec811108e58bac1f1bb5ec6577ad386830eac51c787e"
 
-inherit cmake lib_package binconfig-disabled pkgconfig upstream-version-is-even
+inherit cmake lib_package binconfig-disabled pkgconfig upstream-version-is-even ptest
 UPSTREAM_CHECK_REGEX = "SDL2-(?P<pver>\d+\.(\d*[02468])+(\.\d+)+)\.tar"
 
 BINCONFIG = "${bindir}/sdl2-config"
@@ -48,6 +50,8 @@ EXTRA_OECMAKE = "-DSDL_OSS=OFF -DSDL_ESD=OFF -DSDL_ARTS=OFF \
                  -DSDL_X11_XRANDR=OFF \
                  -DSDL_X11_XSCRNSAVER=OFF \
                  -DSDL_X11_XSHAPE=OFF \
+                 -DSDL_TESTS=ON \
+                 -DSDL_INSTALL_TESTS=ON \
 "
 
 # opengl packageconfig factored out to make it easy for distros
@@ -82,6 +86,11 @@ PACKAGECONFIG[x11]        = "-DSDL_X11=ON,-DSDL_X11=OFF,virtual/libx11 libxext l
 
 CFLAGS:append:class-native = " -DNO_SHARED_MEMORY"
 
+PACKAGE_BEFORE_PN = "${PN}-tests"
+
 FILES:${PN} += "${datadir}/licenses/SDL2/LICENSE.txt"
+FILES:${PN}-tests += "${libexecdir} /usr/share/installed-tests/SDL2"
+
+RDEPENDS:${PN}-ptest = "${PN}-tests"
 
 BBCLASSEXTEND = "native nativesdk"
-- 
2.34.1



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

end of thread, other threads:[~2025-09-16  9:45 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-04  0:07 [master][PATCH v2] libsdl2: Add tests package and ptest support a-christidis
2025-09-04  8:41 ` Mathieu Dubois-Briand
2025-09-04  8:52   ` [OE-core] " Joao Marcos Costa
2025-09-04 11:27 ` Alexander Kanavin
2025-09-12 20:54   ` [EXTERNAL] " Antonios Christidis
2025-09-16  9:45     ` Alexander Kanavin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox