[gobject-introspection: 1/2] meson: Add the giscanner warning tests



commit 3c42334292d088fc9ec2d047a6260c4be231a312
Author: Christoph Reiter <reiter christoph gmail com>
Date:   Tue Jun 19 17:37:04 2018 +0200

    meson: Add the giscanner warning tests
    
    I couldn't get it to work on Windows, so skip that for now.

 tests/meson.build           |  1 +
 tests/warn/Makefile.am      |  2 +-
 tests/warn/meson.build      | 41 +++++++++++++++++++++++++++++++++++++++++
 tests/warn/warningtester.py |  6 +++++-
 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()


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