diff options
author | Gyorgy Sarvari <skandigraun@gmail.com> | 2025-09-04 13:21:40 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2025-09-11 11:31:57 +0100 |
commit | ac337dab5b3c387af749b138514efe341afc27cc (patch) | |
tree | ac064b0f7a4c1565c84256c6c0457ef9b8f37508 | |
parent | 86970c73bf99789b114a78702b9a0629a4583b1d (diff) | |
download | poky-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.inc | 1 | ||||
-rw-r--r-- | meta/recipes-gnome/librsvg/librsvg/run-ptest | 17 | ||||
-rw-r--r-- | meta/recipes-gnome/librsvg/librsvg_2.61.0.bb | 32 |
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 | ||
2 | export CARGO_MANIFEST_DIR="$(cd "$(dirname "$0")" && pwd)" | ||
3 | cd $CARGO_MANIFEST_DIR | ||
4 | |||
5 | ln -sf `which rsvg-convert` ./rsvg-convert | ||
6 | |||
7 | ./api_test/bin/api | ||
8 | |||
9 | if [ $? = 0 ]; then | ||
10 | echo PASS: /usr/lib/librsvg/ptest/api_test/bin/api | ||
11 | rc=0 | ||
12 | else | ||
13 | echo FAIL: /usr/lib/librsvg/ptest/api_test/bin/api | ||
14 | rc=1 | ||
15 | fi | ||
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 | ||
12 | SECTION = "x11/utils" | 12 | SECTION = "x11/utils" |
13 | DEPENDS = "cairo gdk-pixbuf glib-2.0 libxml2 pango python3-docutils-native cargo-c-native" | 13 | DEPENDS = "cairo gdk-pixbuf glib-2.0 libxml2 pango python3-docutils-native cargo-c-native" |
14 | RDEPENDS:${PN}-ptest += "rsvg liberation-fonts" | ||
14 | BBCLASSEXTEND = "native nativesdk" | 15 | BBCLASSEXTEND = "native nativesdk" |
15 | 16 | ||
16 | inherit cargo_common gnomebase pixbufcache gobject-introspection rust vala gi-docgen cargo-update-recipe-crates | 17 | inherit cargo_common gnomebase pixbufcache gobject-introspection rust vala gi-docgen cargo-update-recipe-crates ptest-cargo |
17 | GIR_MESON_ENABLE_FLAG = 'enabled' | 18 | GIR_MESON_ENABLE_FLAG = 'enabled' |
18 | GIR_MESON_DISABLE_FLAG = 'disabled' | 19 | GIR_MESON_DISABLE_FLAG = 'disabled' |
19 | GIDOCGEN_MESON_OPTION = 'docs' | 20 | GIDOCGEN_MESON_OPTION = 'docs' |
@@ -23,7 +24,8 @@ GIDOCGEN_MESON_DISABLE_FLAG = 'disabled' | |||
23 | require ${BPN}-crates.inc | 24 | require ${BPN}-crates.inc |
24 | 25 | ||
25 | SRC_URI += "file://0001-query-rustc-append-RUSTFLAGS-to-rustc-executable.patch \ | 26 | SRC_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" | ||
27 | SRC_URI[archive.sha256sum] = "dbd0db40a1179a382fbb8cc930837671b973d722ba106a3dee2aad0fd858e2c4" | 29 | SRC_URI[archive.sha256sum] = "dbd0db40a1179a382fbb8cc930837671b973d722ba106a3dee2aad0fd858e2c4" |
28 | 30 | ||
29 | UPSTREAM_CHECK_REGEX = "librsvg-(?P<pver>\d+\.\d+\.(?!9\d+)\d+)" | 31 | UPSTREAM_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 |
59 | BUILD_LDFLAGS += " -ldl" | 61 | BUILD_LDFLAGS += " -ldl" |
60 | 62 | ||
61 | PACKAGECONFIG ??= "gdkpixbuf" | 63 | PACKAGECONFIG ??= "gdkpixbuf ${@bb.utils.contains('PTEST_ENABLED', '1', 'apitest', '', d)}" |
62 | PACKAGECONFIG:append:class-target = " ${@bb.utils.contains('GI_DATA_ENABLED', 'True', 'vala', '', d)}" | 64 | PACKAGECONFIG:append:class-target = " ${@bb.utils.contains('GI_DATA_ENABLED', 'True', 'vala', '', d)}" |
63 | # The gdk-pixbuf loader | 65 | # The gdk-pixbuf loader |
64 | PACKAGECONFIG[gdkpixbuf] = "-Dpixbuf-loader=enabled,-Dpixbuf-loader=disabled,gdk-pixbuf-native" | 66 | PACKAGECONFIG[gdkpixbuf] = "-Dpixbuf-loader=enabled,-Dpixbuf-loader=disabled,gdk-pixbuf-native" |
65 | PACKAGECONFIG[vala] = "-Dvala=enabled,-Dvala=disabled" | 67 | PACKAGECONFIG[vala] = "-Dvala=enabled,-Dvala=disabled" |
68 | PACKAGECONFIG[apitest] = "-Dtests=true,-Dtests=false" | ||
66 | 69 | ||
67 | do_install:append() { | 70 | do_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 | ||
75 | do_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 | |||
81 | do_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 | |||
88 | do_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 | |||
72 | PACKAGES =+ "librsvg-gtk rsvg" | 98 | PACKAGES =+ "librsvg-gtk rsvg" |
73 | FILES:rsvg = "${bindir}/rsvg* \ | 99 | FILES:rsvg = "${bindir}/rsvg* \ |
74 | ${datadir}/pixmaps/svg-viewer.svg \ | 100 | ${datadir}/pixmaps/svg-viewer.svg \ |