diff options
author | Emmanuele Bassi <ebassi@gnome.org> | 2017-08-02 13:14:29 +0100 |
---|---|---|
committer | Emmanuele Bassi <ebassi@gnome.org> | 2017-08-02 13:14:29 +0100 |
commit | 5e669da4a655868d74833a6e3cc89a803f430aad (patch) | |
tree | 6f3397f1db23c7b1fc5a27f952c70e9f5aed8e28 /tests | |
parent | 5571ecd6a82b3d56c4a107f2c2bda0c14d67cb6f (diff) | |
download | gdk-pixbuf-5e669da4a655868d74833a6e3cc89a803f430aad.tar.gz |
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.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/gen-installed-test.py | 21 | ||||
-rw-r--r-- | tests/meson.build | 49 |
2 files changed, 69 insertions, 1 deletions
diff --git a/tests/gen-installed-test.py b/tests/gen-installed-test.py new file mode 100644 index 000000000..745abf339 --- /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 91e2f8863..50d4b1d19 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, |