summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGyorgy Sarvari <skandigraun@gmail.com>2025-09-04 13:21:40 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2025-09-11 11:31:57 +0100
commitac337dab5b3c387af749b138514efe341afc27cc (patch)
treeac064b0f7a4c1565c84256c6c0457ef9b8f37508
parent86970c73bf99789b114a78702b9a0629a4583b1d (diff)
downloadpoky-ac337dab5b3c387af749b138514efe341afc27cc.tar.gz
librsvg: add ptest support
The suite is quick, it takes ~5 seconds on my machine to execute. The tests consist of 2 or 3 parts, depending on how one counts them. The apitest PACKAGACONFIG compiles tests for the c-interface, as part of the main meson build. This apitest expects test data to be present in a folder relative the test binary: ../../rsvg/tests folder. ptest-cargo compiles two sets of test: rsvg-convert tests, and generic assorted tests for the library, in multiple binaries. The rsvg-convert tests expect test data to be present in a "tests" folder, in the same folder where the test binaries are. The library tests expect the tests to be in a folder called "tests", that's location is specified by the CARGO_MANIFEST_DIR environment variable. As part of compiling the cargo tests, rsvg-convert is also compiled specifically for the tests, however it is not supposed to be different from the actual binary. It is deleted from the test set, because of two reasons: 1. It is not bit-identical to the actually installed rsvg-convert (it is compiled differently, with cargo only, without meson) 2. ptest-cargo class treated it as a test binary, and tried to execute it, which resulted in failing/hanging test. It is avoided by not installing this binary, but rather use the real rsvg package as a runtime dependency, and create a symlink to it in the run-ptest script. Added liberation-fonts as a runtime dependency to the tests - the rsvg-convert tests require some fonts to be available to be able to render during some svg->pdf conversion tests. (From OE-Core rev: 3aee16beac9b12403babfc7eef02be71b2297e70) Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com> Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/conf/distro/include/ptest-packagelists.inc1
-rw-r--r--meta/recipes-gnome/librsvg/librsvg/run-ptest17
-rw-r--r--meta/recipes-gnome/librsvg/librsvg_2.61.0.bb32
3 files changed, 47 insertions, 3 deletions
diff --git a/meta/conf/distro/include/ptest-packagelists.inc b/meta/conf/distro/include/ptest-packagelists.inc
index 9a7b25a916..e6e725bd25 100644
--- a/meta/conf/distro/include/ptest-packagelists.inc
+++ b/meta/conf/distro/include/ptest-packagelists.inc
@@ -32,6 +32,7 @@ PTESTS_FAST = "\
32 libgpg-error\ 32 libgpg-error\
33 libnl \ 33 libnl \
34 libpcre \ 34 libpcre \
35 librsvg \
35 libssh2 \ 36 libssh2 \
36 libtest-fatal-perl \ 37 libtest-fatal-perl \
37 libtest-needs-perl \ 38 libtest-needs-perl \
diff --git a/meta/recipes-gnome/librsvg/librsvg/run-ptest b/meta/recipes-gnome/librsvg/librsvg/run-ptest
new file mode 100644
index 0000000000..da1c65f1a6
--- /dev/null
+++ b/meta/recipes-gnome/librsvg/librsvg/run-ptest
@@ -0,0 +1,17 @@
1#!/bin/sh
2export CARGO_MANIFEST_DIR="$(cd "$(dirname "$0")" && pwd)"
3cd $CARGO_MANIFEST_DIR
4
5ln -sf `which rsvg-convert` ./rsvg-convert
6
7./api_test/bin/api
8
9if [ $? = 0 ]; then
10 echo PASS: /usr/lib/librsvg/ptest/api_test/bin/api
11 rc=0
12else
13 echo FAIL: /usr/lib/librsvg/ptest/api_test/bin/api
14 rc=1
15fi
16
17# rust tests are appended here by ptest-cargo class
diff --git a/meta/recipes-gnome/librsvg/librsvg_2.61.0.bb b/meta/recipes-gnome/librsvg/librsvg_2.61.0.bb
index dda51abab5..de1853c6d8 100644
--- a/meta/recipes-gnome/librsvg/librsvg_2.61.0.bb
+++ b/meta/recipes-gnome/librsvg/librsvg_2.61.0.bb
@@ -11,9 +11,10 @@ LIC_FILES_CHKSUM = "file://COPYING.LIB;md5=4fbd65380cdd255951079008b364516c"
11 11
12SECTION = "x11/utils" 12SECTION = "x11/utils"
13DEPENDS = "cairo gdk-pixbuf glib-2.0 libxml2 pango python3-docutils-native cargo-c-native" 13DEPENDS = "cairo gdk-pixbuf glib-2.0 libxml2 pango python3-docutils-native cargo-c-native"
14RDEPENDS:${PN}-ptest += "rsvg liberation-fonts"
14BBCLASSEXTEND = "native nativesdk" 15BBCLASSEXTEND = "native nativesdk"
15 16
16inherit cargo_common gnomebase pixbufcache gobject-introspection rust vala gi-docgen cargo-update-recipe-crates 17inherit cargo_common gnomebase pixbufcache gobject-introspection rust vala gi-docgen cargo-update-recipe-crates ptest-cargo
17GIR_MESON_ENABLE_FLAG = 'enabled' 18GIR_MESON_ENABLE_FLAG = 'enabled'
18GIR_MESON_DISABLE_FLAG = 'disabled' 19GIR_MESON_DISABLE_FLAG = 'disabled'
19GIDOCGEN_MESON_OPTION = 'docs' 20GIDOCGEN_MESON_OPTION = 'docs'
@@ -23,7 +24,8 @@ GIDOCGEN_MESON_DISABLE_FLAG = 'disabled'
23require ${BPN}-crates.inc 24require ${BPN}-crates.inc
24 25
25SRC_URI += "file://0001-query-rustc-append-RUSTFLAGS-to-rustc-executable.patch \ 26SRC_URI += "file://0001-query-rustc-append-RUSTFLAGS-to-rustc-executable.patch \
26 file://0001-Revert-meson.build-do-not-force-disable-gdk-pixbuf-l.patch" 27 file://0001-Revert-meson.build-do-not-force-disable-gdk-pixbuf-l.patch \
28 file://run-ptest"
27SRC_URI[archive.sha256sum] = "dbd0db40a1179a382fbb8cc930837671b973d722ba106a3dee2aad0fd858e2c4" 29SRC_URI[archive.sha256sum] = "dbd0db40a1179a382fbb8cc930837671b973d722ba106a3dee2aad0fd858e2c4"
28 30
29UPSTREAM_CHECK_REGEX = "librsvg-(?P<pver>\d+\.\d+\.(?!9\d+)\d+)" 31UPSTREAM_CHECK_REGEX = "librsvg-(?P<pver>\d+\.\d+\.(?!9\d+)\d+)"
@@ -58,17 +60,41 @@ LDFLAGS += " -L${B}/rsvg"
58# needed on ubuntu 20.04/debian 11 to avoid 'undefined reference to `dlsym'' errors 60# needed on ubuntu 20.04/debian 11 to avoid 'undefined reference to `dlsym'' errors
59BUILD_LDFLAGS += " -ldl" 61BUILD_LDFLAGS += " -ldl"
60 62
61PACKAGECONFIG ??= "gdkpixbuf" 63PACKAGECONFIG ??= "gdkpixbuf ${@bb.utils.contains('PTEST_ENABLED', '1', 'apitest', '', d)}"
62PACKAGECONFIG:append:class-target = " ${@bb.utils.contains('GI_DATA_ENABLED', 'True', 'vala', '', d)}" 64PACKAGECONFIG:append:class-target = " ${@bb.utils.contains('GI_DATA_ENABLED', 'True', 'vala', '', d)}"
63# The gdk-pixbuf loader 65# The gdk-pixbuf loader
64PACKAGECONFIG[gdkpixbuf] = "-Dpixbuf-loader=enabled,-Dpixbuf-loader=disabled,gdk-pixbuf-native" 66PACKAGECONFIG[gdkpixbuf] = "-Dpixbuf-loader=enabled,-Dpixbuf-loader=disabled,gdk-pixbuf-native"
65PACKAGECONFIG[vala] = "-Dvala=enabled,-Dvala=disabled" 67PACKAGECONFIG[vala] = "-Dvala=enabled,-Dvala=disabled"
68PACKAGECONFIG[apitest] = "-Dtests=true,-Dtests=false"
66 69
67do_install:append() { 70do_install:append() {
68 # Loadable modules don't need .a or .la on Linux 71 # Loadable modules don't need .a or .la on Linux
69 rm -f ${D}${libdir}/gdk-pixbuf-2.0/*/loaders/*.a ${D}${libdir}/gdk-pixbuf-2.0/*/loaders/*.la 72 rm -f ${D}${libdir}/gdk-pixbuf-2.0/*/loaders/*.a ${D}${libdir}/gdk-pixbuf-2.0/*/loaders/*.la
70} 73}
71 74
75do_compile_ptest_cargo:prepend() {
76 # The packageconfig is for meson, but the rust tests are compiled directly with cargo,
77 # so these arguments don't apply. Note that this is Python, the intendation is intentional.
78 d.setVar('PACKAGECONFIG_CONFARGS', '')
79}
80
81do_compile_ptest:prepend() {
82 # rsvg-convert is the tested binary, which shouldn't be executed as a test.
83 # Beside this, it is not bit-identical to the actual rsvg-convert binary, so
84 # remove it from this list, as create a symlink to the real thing from run-ptest script
85 sed -i '/rsvg-convert$/d' ${CARGO_TEST_BINARIES_FILES}
86}
87
88do_install_ptest:append() {
89 install -d ${D}${PTEST_PATH}/api_test/bin
90 cp -r ${S}/rsvg/tests ${D}${PTEST_PATH}
91 cp -r ${S}/rsvg_convert/tests ${D}${PTEST_PATH}
92 install ${B}/librsvg-c/tests-c/api ${D}${PTEST_PATH}/api_test/bin
93 # the api tests look for the required files in rsvg folder, so simulate it
94 # with a symlink that points to the current folder
95 ln -s . ${D}${PTEST_PATH}/rsvg
96}
97
72PACKAGES =+ "librsvg-gtk rsvg" 98PACKAGES =+ "librsvg-gtk rsvg"
73FILES:rsvg = "${bindir}/rsvg* \ 99FILES:rsvg = "${bindir}/rsvg* \
74 ${datadir}/pixmaps/svg-viewer.svg \ 100 ${datadir}/pixmaps/svg-viewer.svg \