summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Reiter <reiter.christoph@gmail.com>2018-06-23 08:53:26 +0000
committerChristoph Reiter <reiter.christoph@gmail.com>2018-06-23 08:53:26 +0000
commit2c13f051ce8bf530d73f20ad75a49692454b4c0a (patch)
tree5f2ed3b84190b7a46b5be2478e931661a04461b9
parent4e5a9500d0771d54a5f2336d3e94e0037f343bbc (diff)
parent3c42334292d088fc9ec2d047a6260c4be231a312 (diff)
downloadgobject-introspection-2c13f051ce8bf530d73f20ad75a49692454b4c0a.tar.gz
Merge branch 'meson-warn-tests' into 'master'
meson: Add the giscanner warning tests See merge request GNOME/gobject-introspection!40
-rw-r--r--tests/meson.build1
-rw-r--r--tests/warn/Makefile.am2
-rw-r--r--tests/warn/meson.build41
-rw-r--r--tests/warn/warningtester.py6
4 files changed, 48 insertions, 2 deletions
diff --git a/tests/meson.build b/tests/meson.build
index dcb0fc90..458af2bb 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -16,3 +16,4 @@ installed_sources = [
install_data(installed_sources, install_dir: join_paths(get_option('datadir'), 'gobject-introspection-1.0', 'tests'))
### TODO: actually test
+subdir('warn')
diff --git a/tests/warn/Makefile.am b/tests/warn/Makefile.am
index 5f47df0a..7cdcc007 100644
--- a/tests/warn/Makefile.am
+++ b/tests/warn/Makefile.am
@@ -24,4 +24,4 @@ TESTS = \
LOG_COMPILER = env PYTHONPATH=$(top_builddir):$(top_srcdir) TOP_BUILDDIR=$(top_builddir) UNINSTALLED_INTROSPECTION_SRCDIR=$(top_srcdir) \
$(PYTHON) $(srcdir)/warningtester.py
-EXTRA_DIST = warningtester.py common.h $(TESTS)
+EXTRA_DIST = warningtester.py common.h meson.build $(TESTS)
diff --git a/tests/warn/meson.build b/tests/warn/meson.build
new file mode 100644
index 00000000..53d00cc7
--- /dev/null
+++ b/tests/warn/meson.build
@@ -0,0 +1,41 @@
+warn_tests = [
+ 'annotationparser.h',
+ 'callback-invalid-scope.h',
+ 'callback-missing-scope.h',
+ 'invalid-allow-none.h',
+ 'invalid-array.h',
+ 'invalid-closure.h',
+ 'invalid-constructor.h',
+ 'invalid-element-type.h',
+ 'invalid-method.h',
+ 'invalid-nullable.h',
+ 'invalid-optional.h',
+ 'invalid-option.h',
+ 'invalid-out.h',
+ 'invalid-return.h',
+ 'invalid-transfer.h',
+ 'missing-element-type.h',
+ 'return-gobject.h',
+ 'unknown-parameter.h',
+ 'unresolved-type.h',
+]
+
+warn_test_env = environment()
+warn_test_env.set('UNINSTALLED_INTROSPECTION_SRCDIR', meson.source_root())
+warn_test_env.set('TOP_BUILDDIR', meson.build_root())
+warn_test_env.set(
+ 'PYTHONPATH',
+ meson.build_root(),
+ join_paths(meson.build_root(), 'giscanner'))
+
+# FIXME: Windows
+if host_system != 'windows'
+ foreach warn_fn : warn_tests
+ test(
+ 'warn-' + warn_fn.split('.')[0], files(python3.path()),
+ workdir: meson.current_source_dir(),
+ env: warn_test_env,
+ args: ['warningtester.py', warn_fn],
+ )
+ endforeach
+endif
diff --git a/tests/warn/warningtester.py b/tests/warn/warningtester.py
index 1f7f91ec..6b0ae7d4 100644
--- a/tests/warn/warningtester.py
+++ b/tests/warn/warningtester.py
@@ -109,7 +109,11 @@ def check(args):
logger.enable_warnings((WARNING, ERROR, FATAL))
transformer = Transformer(namespace)
- transformer.set_include_paths([os.path.join(top_srcdir, 'gir'), top_builddir])
+ transformer.set_include_paths([
+ os.path.join(top_srcdir, 'gir'),
+ top_builddir,
+ os.path.join(top_builddir, 'gir'),
+ ])
transformer.register_include(Include.from_string('GObject-2.0'))
ss = SourceScanner()