[gdk-pixbuf/wip/ebassi/no-autotools: 1/2] meson: Support installed tests
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gdk-pixbuf/wip/ebassi/no-autotools: 1/2] meson: Support installed tests
- Date: Wed, 2 Aug 2017 12:52:48 +0000 (UTC)
commit 5e669da4a655868d74833a6e3cc89a803f430aad
Author: Emmanuele Bassi <ebassi gnome org>
Date: Wed Aug 2 13:14:29 2017 +0100
meson: Support installed tests
We want to be able to run the gdk-pixbuf tests after installing them in
a known system location, especially when running CI.
gdk-pixbuf/meson.build | 2 +-
meson.build | 2 +
tests/gen-installed-test.py | 21 ++++++++++++++++++
tests/meson.build | 49 ++++++++++++++++++++++++++++++++++++++++++-
4 files changed, 72 insertions(+), 2 deletions(-)
---
diff --git a/gdk-pixbuf/meson.build b/gdk-pixbuf/meson.build
index 1ec8e10..c527282 100644
--- a/gdk-pixbuf/meson.build
+++ b/gdk-pixbuf/meson.build
@@ -34,7 +34,7 @@ gdk_pixbuf_cflags = [
'-DBUILT_MODULES_DIR="@0@"'.format(meson.current_build_dir()),
]
-gdk_pixbuf_api_path = join_paths('gdk-pixbuf-@0@'.format(gdk_pixbuf_api_version), 'gdk-pixbuf')
+gdk_pixbuf_api_path = join_paths(gdk_pixbuf_api_name, 'gdk-pixbuf')
gdkpixbuf_features_conf = configuration_data()
gdkpixbuf_features_conf.set('GDK_PIXBUF_MAJOR', gdk_pixbuf_version_major)
diff --git a/meson.build b/meson.build
index 77757be..b0be82a 100644
--- a/meson.build
+++ b/meson.build
@@ -23,6 +23,8 @@ gdk_pixbuf_version_micro = version_arr[2].to_int()
gdk_pixbuf_api_version = '2.0'
gdk_pixbuf_binary_version = '2.10.0'
+gdk_pixbuf_api_name = '@0@-@1@'.format(meson.project_name(), gdk_pixbuf_api_version)
+
if gdk_pixbuf_version_minor.is_odd()
gdk_pixbuf_interface_age = 0
else
diff --git a/tests/gen-installed-test.py b/tests/gen-installed-test.py
new file mode 100644
index 0000000..745abf3
--- /dev/null
+++ b/tests/gen-installed-test.py
@@ -0,0 +1,21 @@
+#!/usr/bin/env python3
+
+import sys
+import os
+import argparse
+
+def write_template(filename, data):
+ with open(filename, 'w') as f:
+ f.write(data)
+
+def build_template(bindir, binname):
+ return "[Test]\nType=session\nExec={}\n".format(os.path.join(bindir, binname))
+
+argparser = argparse.ArgumentParser(description='Generate installed-test data.')
+argparser.add_argument('--testbindir', metavar='dir', help='Installed test directory')
+argparser.add_argument('--testbin', metavar='name', help='Installed test name')
+argparser.add_argument('output', help='Output file')
+
+args = argparser.parse_args()
+
+write_template(args.output, build_template(args.testbindir, args.testbin))
diff --git a/tests/meson.build b/tests/meson.build
index 91e2f88..50d4b1d 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -58,7 +58,40 @@ installed_tests = [
[ 'pixbuf-area-updated' ],
]
+test_data = [
+ 'test-image.png',
+ 'test-animation.gif',
+ '1_partyanimsm2.gif',
+ 'test-animation.ani',
+ 'icc-profile.jpeg',
+ 'icc-profile.png',
+ 'dpi.jpeg',
+ 'dpi.png',
+ 'dpi.tiff',
+ 'premature-end.png',
+ 'premature-end.jpg',
+ 'bug143608-comment.jpg',
+ 'bug725582-testrotate.jpg',
+ 'bug725582-testrotate.png',
+ 'cve-2015-4491.bmp',
+ 'large.png',
+ 'large.jpg',
+ 'bug775218.jpg',
+ 'test-image.pixdata',
+ 'test-image-rle.pixdata',
+ 'bug775693.pixdata',
+ 'aero.gif',
+]
+
+gen_installed_test = find_program('gen-installed-test.py')
+
+installed_test_bindir = join_paths(gdk_pixbuf_libexecdir, 'installed-tests', gdk_pixbuf_api_name)
+installed_test_datadir = join_paths(gdk_pixbuf_datadir, 'installed-tests', gdk_pixbuf_api_name)
+
+install_data(test_data, install_dir: installed_test_bindir)
+
test_deps = gdk_pixbuf_deps + [ gdkpixbuf_dep ]
+
foreach t: installed_tests
test_name = t[0]
test_sources = [ test_name + '.c', 'test-common.c' ]
@@ -67,9 +100,23 @@ foreach t: installed_tests
test_sources += [ resources_c, resources_h ]
endif
+ custom_target(test_name + '.test',
+ output: test_name + '.test',
+ command: [
+ gen_installed_test,
+ '--testbindir=@0@'.format(installed_test_bindir),
+ '--testbin=@0@'.format(test_name),
+ '@OUTPUT@',
+ ],
+ install: true,
+ install_dir: installed_test_datadir)
+
test_bin = executable(test_name, test_sources,
dependencies: test_deps,
- include_directories: [ root_inc, include_directories('../gdk-pixbuf') ],
+ include_directories: [
+ root_inc,
+ include_directories('../gdk-pixbuf')
+ ],
c_args: common_cflags)
test(test_name, test_bin,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]