summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim-Philipp Müller <tim@centricular.com>2017-05-02 17:04:58 +0100
committerMatthias Clasen <mclasen@redhat.com>2017-07-13 19:03:39 -0400
commit2e9fd74b2576d276e246655aef7c40e04e51ea9e (patch)
treea166bcfaad31eb56f6478f5e1da2e0ac86b66a56
parent6af4f1752a44384290f378594c9fb7f655e31682 (diff)
downloadglib-2e9fd74b2576d276e246655aef7c40e04e51ea9e.tar.gz
meson: add tests/gobject and tests/refcount
-rw-r--r--meson.build3
-rw-r--r--tests/gobject/meson.build59
-rw-r--r--tests/meson.build14
-rw-r--r--tests/refcount/meson.build29
4 files changed, 104 insertions, 1 deletions
diff --git a/meson.build b/meson.build
index ec3ac4cf8..f2c5ac244 100644
--- a/meson.build
+++ b/meson.build
@@ -1,6 +1,6 @@
project('glib', 'c', 'cpp',
version : '2.51.2',
- meson_version : '>= 0.37.1',
+ meson_version : '>= 0.38.1',
default_options : [
'warning_level=1',
'c_std=gnu89'
@@ -1387,6 +1387,7 @@ subdir('gio')
if xgettext.found()
subdir('po')
endif
+subdir('tests')
# Configure and install pkg-config files
pc_files = [
diff --git a/tests/gobject/meson.build b/tests/gobject/meson.build
new file mode 100644
index 000000000..e10a34590
--- /dev/null
+++ b/tests/gobject/meson.build
@@ -0,0 +1,59 @@
+gobject_tests = [
+ ['gvalue-test'],
+ ['paramspec-test'],
+ ['deftype'],
+ ['defaultiface', ['defaultiface.c', 'testmodule.c']],
+ ['dynamictype', ['dynamictype.c', 'testmodule.c']],
+ ['override'],
+ ['signals'],
+ ['singleton'],
+ ['references'],
+]
+
+# The marshal test requires running a binary, which means we cannot
+# build it when cross-compiling
+if not meson.is_cross_build() or meson.has_exe_wrapper()
+ gnome = import('gnome')
+
+ testmarshal_srcs = gnome.genmarshal('testmarshal',
+ sources : 'testmarshal.list',
+ prefix : 'test_marshal')
+
+ gobject_tests += [
+ ['accumulator', ['accumulator.c', testmarshal_srcs]],
+ ]
+endif
+
+foreach t : gobject_tests
+ test_name = t.get(0)
+ test_src = t.get(1, test_name + '.c')
+ test_extra_cargs = t.get(2, [])
+ test_timeout = t.get(3, 30)
+
+ # FIXME? $(GLIB_DEBUG_FLAGS)
+ exe = executable(test_name, test_src,
+ c_args : test_cargs + test_extra_cargs + ['-DGLIB_DISABLE_DEPRECATION_WARNINGS'],
+ dependencies : [libm, thread_dep, libglib_dep, libgobject_dep],
+ install : false,
+ )
+ # FIXME? TESTS_ENVIRONMENT = LIBCHARSET_ALIAS_DIR=$(top_builddir)/glib/libcharset
+ test(test_name, exe, env : test_env, timeout : test_timeout)
+endforeach
+
+# Don't install these ones, and keep them out of 'make check' because they take too long...
+executable('performance', 'performance.c',
+ c_args : test_cargs + test_extra_cargs + ['-DGLIB_DISABLE_DEPRECATION_WARNINGS'],
+ dependencies : [libm, thread_dep, libglib_dep, libgobject_dep],
+ install : false)
+
+executable('performance-threaded', 'performance-threaded.c',
+ c_args : test_cargs + test_extra_cargs + ['-DGLIB_DISABLE_DEPRECATION_WARNINGS'],
+ dependencies : [libm, thread_dep, libglib_dep, libgobject_dep],
+ install : false)
+
+if host_system != 'windows' and host_system != 'minix'
+ executable('timeloop-closure', 'timeloop-closure.c',
+ c_args : test_cargs + test_extra_cargs + ['-DGLIB_DISABLE_DEPRECATION_WARNINGS'],
+ dependencies : [libm, thread_dep, libglib_dep, libgobject_dep],
+ install : false)
+endif
diff --git a/tests/meson.build b/tests/meson.build
new file mode 100644
index 000000000..694e1790f
--- /dev/null
+++ b/tests/meson.build
@@ -0,0 +1,14 @@
+# tests
+
+test_env = [
+ 'G_TEST_SRCDIR=' + meson.current_source_dir(),
+ 'G_TEST_BUILDDIR=' + meson.current_build_dir(),
+ 'G_DEBUG=gc-friendly',
+ 'MALLOC_CHECK_=2',
+ 'MALLOC_PERTURB_=@0@'.format(random_number % 256),
+]
+
+test_cargs = ['-DHAVE_CONFIG_H=1', '-DG_LOG_DOMAIN="GLib"']
+
+subdir('gobject')
+subdir('refcount')
diff --git a/tests/refcount/meson.build b/tests/refcount/meson.build
new file mode 100644
index 000000000..64c0cfbfd
--- /dev/null
+++ b/tests/refcount/meson.build
@@ -0,0 +1,29 @@
+refcount_tests = [
+ ['closures', 'closures.c', []],
+ ['objects', 'objects.c', []],
+ ['objects2', 'objects2.c', []],
+ ['properties', 'properties.c', []],
+ ['properties2', 'properties2.c', []],
+ ['properties3', 'properties3.c', [], 90], # extra long timeout
+ ['properties4', 'properties4.c', []],
+ ['signal1', 'signals.c', ['-DTESTNUM=1']],
+ ['signal2', 'signals.c', ['-DTESTNUM=2']],
+ ['signal3', 'signals.c', ['-DTESTNUM=3']],
+ ['signal4', 'signals.c', ['-DTESTNUM=4']],
+]
+
+foreach t : refcount_tests
+ test_name = t.get(0)
+ test_src = t.get(1)
+ test_extra_cargs = t.get(2)
+ test_timeout = t.get(3, 30)
+
+ # FIXME? $(GLIB_DEBUG_FLAGS)
+ exe = executable(test_name + '-test', test_src,
+ c_args : test_cargs + test_extra_cargs + ['-DGLIB_DISABLE_DEPRECATION_WARNINGS'],
+ dependencies : [libm, thread_dep, libglib_dep, libgobject_dep],
+ install : false,
+ )
+ # FIXME? TESTS_ENVIRONMENT = LIBCHARSET_ALIAS_DIR=$(top_builddir)/glib/libcharset
+ test(test_name, exe, env : test_env, timeout : test_timeout)
+endforeach