[glib/meson-for-merge] meson: add tests/gobject and tests/refcount



commit 2e9fd74b2576d276e246655aef7c40e04e51ea9e
Author: Tim-Philipp Müller <tim centricular com>
Date:   Tue May 2 17:04:58 2017 +0100

    meson: add tests/gobject and tests/refcount

 meson.build                |    3 +-
 tests/gobject/meson.build  |   59 ++++++++++++++++++++++++++++++++++++++++++++
 tests/meson.build          |   14 ++++++++++
 tests/refcount/meson.build |   29 +++++++++++++++++++++
 4 files changed, 104 insertions(+), 1 deletions(-)
---
diff --git a/meson.build b/meson.build
index ec3ac4c..f2c5ac2 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 0000000..e10a345
--- /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 0000000..694e179
--- /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 0000000..64c0cfb
--- /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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]