| Message ID | 20250819221357.997067-1-a-christidis@ti.com |
|---|---|
| State | New |
| Headers | show |
| Series | [master] libsdl2: Add PACKAGECONFIG option for tests | expand |
On Wed, 20 Aug 2025 at 00:14, Antonios Christidis via lists.openembedded.org <a-christidis=ti.com@lists.openembedded.org> wrote: > +do_install:append() { > + if ${@bb.utils.contains('PACKAGECONFIG', 'tests', 'true', 'false', d)}; then > + 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 > + fi > +} The PACKAGECONFIG is okay, but this isn't. If you want to install the tests, you should also add run-ptest script, ptest package, and ensure they pass. Ideally, you should also make a patch to sdl that does the installation and offer that to upstream, rather than do it in a custom do_install snippet. Alex
Dear Alex, Thank you for the feedback. This is my first time working with ptest so I have some implementation questions: Texas Instrument does all of its testing without ptest, so what if the recipe creates a PN-tests package ? In the above scenario, the recipe checks if PACKAGECONFIG includes tests and DISTRO_FEATURES doesn't include ptest, if so create a package called PN-tests. Use the do_install:append task I have included in the 1st version of patch. Use FILES variable to package the right binaries. Now, I still want to introduce support for ptest, if that is the case there should be a path to not create a PN-tests package and instead create a PN-ptest package. I'll do that by introducing a do_install_ptest task, where files are installed under PTEST_PATH variable as expected, and then packaged automatically under PN-ptest package. I'll also add a conditional within PACKAGECONFIG ??= , to add "tests" automatically if DISTRO_FEATURES includes ptest. Let me know what you think, and/or if I have see any flaws in logic/assumptions. Kind Regards, Antonios On 8/20/25 2:14 AM, Alexander Kanavin wrote: > On Wed, 20 Aug 2025 at 00:14, Antonios Christidis via > lists.openembedded.org <a-christidis=ti.com@lists.openembedded.org> > wrote: >> +do_install:append() { >> + if ${@bb.utils.contains('PACKAGECONFIG', 'tests', 'true', 'false', d)}; then >> + 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 >> + fi >> +} > The PACKAGECONFIG is okay, but this isn't. If you want to install the > tests, you should also add run-ptest script, ptest package, and ensure > they pass. Ideally, you should also make a patch to sdl that does the > installation and offer that to upstream, rather than do it in a custom > do_install snippet. > > Alex
On Thu, 21 Aug 2025 at 00:09, Antonios Christidis <a-christidis@ti.com> wrote: > Thank you for the feedback. This is my first time working with ptest so > I have some implementation questions: > > Texas Instrument does all of its testing without ptest, so what if the > recipe creates a PN-tests package ? > > In the above scenario, the recipe checks if PACKAGECONFIG includes tests > and DISTRO_FEATURES doesn't include ptest, if so create a package called > PN-tests. > Use the do_install:append task I have included in the 1st version of > patch. Use FILES variable to package the right binaries. Putting tests in PN-tests package is always okay, and there is no need to make it conditional. If nothing can be packaged, then the package will not be created. > Now, I still want to introduce support for ptest, if that is the case > there should be a path to not create a PN-tests package and instead > create a PN-ptest package. No. Instead, you add run-ptest script and inherit ptest class, then add RDEPENDS:${PN}-ptest = "$PN-tests" (so ptest package pulls in the tests), and set PACKAGECONFIG so that tests option is enabled subject to ptest distro feature (there are examples for all of this in oe-core). > I'll do that by introducing a do_install_ptest task, where files are > installed under PTEST_PATH variable as expected, and then packaged > automatically under PN-ptest package. There is no need to do that, see above. I would still suggest you make a patch for upstream's cmake files that installs the tests directly, perhaps subject to an option (e.g. SDL_INSTALL_TESTS). Note that libsdl2 is deprecated, and all development work is on libsdl3, it's just that we don't have uses for libsdl3 in core yet. > I'll also add a conditional within PACKAGECONFIG ??= , to add "tests" > automatically if DISTRO_FEATURES includes ptest. Correct. Alex
diff --git a/meta/recipes-graphics/libsdl2/libsdl2_2.32.8.bb b/meta/recipes-graphics/libsdl2/libsdl2_2.32.8.bb index 98291e0f80..01f834aba9 100644 --- a/meta/recipes-graphics/libsdl2/libsdl2_2.32.8.bb +++ b/meta/recipes-graphics/libsdl2/libsdl2_2.32.8.bb @@ -79,9 +79,20 @@ PACKAGECONFIG[pulseaudio] = "-DSDL_PULSEAUDIO=ON,-DSDL_PULSEAUDIO=OFF,pulseaudio 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" +PACKAGECONFIG[tests] = "-DSDL_TESTS=ON,-DSDL_TESTS=OFF" CFLAGS:append:class-native = " -DNO_SHARED_MEMORY" +do_install:append() { + if ${@bb.utils.contains('PACKAGECONFIG', 'tests', 'true', 'false', d)}; then + 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 + fi +} + FILES:${PN} += "${datadir}/licenses/SDL2/LICENSE.txt" BBCLASSEXTEND = "native nativesdk"