All of lore.kernel.org
 help / color / mirror / Atom feed
* [master][PATCH] libsdl2: Add tests package and ptest support
@ 2025-08-27 22:20 a-christidis
  2025-08-28  6:56 ` [OE-core] " Yoann Congal
                   ` (3 more replies)
  0 siblings, 4 replies; 13+ messages in thread
From: a-christidis @ 2025-08-27 22:20 UTC (permalink / raw)
  To: openembedded-core, mathieu.dubois-briand; +Cc: alex

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>
---
 .../distro/include/ptest-packagelists.inc     |  1 +
 .../libsdl2/libsdl2/run-ptest                 | 15 ++++++++++++++
 .../libsdl2/libsdl2_2.32.8.bb                 | 20 +++++++++++++++++--
 3 files changed, 34 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..1cd1f9ceaf
--- /dev/null
+++ b/meta/recipes-graphics/libsdl2/libsdl2/run-ptest
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+test_array=("testdraw2" "testgeometry" "testsprite2" "testgles2" "testoffscreen")
+
+test_path="/usr/bin/sdl2_tests/"
+
+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..5aeb333bc7 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,7 @@ 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 \
 "
 
 # opengl packageconfig factored out to make it easy for distros
@@ -80,8 +83,21 @@ PACKAGECONFIG[vulkan]    = "-DSDL_VULKAN=ON,-DSDL_VULKAN=OFF"
 PACKAGECONFIG[wayland]    = "-DSDL_WAYLAND=ON,-DSDL_WAYLAND=OFF,wayland-native wayland wayland-protocols libxkbcommon"
 PACKAGECONFIG[x11]        = "-DSDL_X11=ON,-DSDL_X11=OFF,virtual/libx11 libxext libxrandr libxrender"
 
+do_install:append() {
+	install -d ${D}${bindir}/sdl2_tests
+	cp -r ${B}/test/* ${D}${bindir}/sdl2_tests
+
+	# Delete any leftover cmake files within the sdl2_tests dir
+	find ${D}${bindir}/sdl2_tests -type f -name "*.cmake" -delete
+}
+
 CFLAGS:append:class-native = " -DNO_SHARED_MEMORY"
 
+PACKAGE_BEFORE_PN = "${PN}-tests"
+
 FILES:${PN} += "${datadir}/licenses/SDL2/LICENSE.txt"
+FILES:${PN}-tests += "${bindir}/sdl2_tests"
+
+RDEPENDS:${PN}-ptest = "${PN}-tests"
 
 BBCLASSEXTEND = "native nativesdk"
-- 
2.34.1



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

end of thread, other threads:[~2025-09-03 23:57 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-27 22:20 [master][PATCH] libsdl2: Add tests package and ptest support a-christidis
2025-08-28  6:56 ` [OE-core] " Yoann Congal
2025-08-28 12:51   ` Alexander Kanavin
2025-08-28 15:23     ` Yoann Congal
2025-08-28 18:08       ` Alexander Kanavin
2025-09-02 15:22         ` [EXTERNAL] " Antonios Christidis
2025-09-02 16:32           ` Yoann Congal
2025-08-28 12:51 ` Alexander Kanavin
2025-09-02 15:20   ` [EXTERNAL] " Antonios Christidis
2025-09-03 12:46     ` Alexander Kanavin
2025-09-03 23:57       ` Antonios Christidis
2025-08-28 13:29 ` Joao Marcos Costa
2025-09-03  6:48 ` Mathieu Dubois-Briand

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.