[vala/wip/test-bindings] vapi/tests: Support compile and runtime testing of bindings




commit 8b94b65eb07db5019a99b2351ae42760f1d34cee
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Sun Dec 6 16:46:55 2020 +0100

    vapi/tests: Support compile and runtime testing of bindings

 configure.ac                                       |  7 ++++
 vapi/Makefile.am                                   |  4 +++
 vapi/tests/.gitignore                              |  2 ++
 vapi/tests/Makefile.am                             | 38 ++++++++++++++++++++++
 vapi/tests/gstreamer-1.0/gvalue.vala               |  2 ++
 .../tests/gstreamer-1.0/tests-extra-environment.sh |  1 +
 6 files changed, 54 insertions(+)
---
diff --git a/configure.ac b/configure.ac
index 88555f7c4..4f7c7db4a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -224,6 +224,12 @@ AM_CONDITIONAL(HAVE_WEASYPRINT, [test x$WEASYPRINT = xweasyprint])
 AC_CHECK_PROG([HELP2MAN], [help2man], [help2man])
 AM_CONDITIONAL([HAVE_HELP2MAN], [test x$HELP2MAN = xhelp2man])
 
+
+# Optional dependencies for runtime testing of bindings
+PKG_CHECK_EXISTS([gstreamer-1.0], found_gstreamer=yes, found_gstreamer=no)
+AM_CONDITIONAL([HAVE_GSTREAMER], test "x$found_gstreamer" = "xyes")
+
+
 m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
 
 AC_CONFIG_FILES([Makefile
@@ -234,6 +240,7 @@ AC_CONFIG_FILES([Makefile
            codegen/Makefile
            compiler/Makefile
            vapi/Makefile
+           vapi/tests/Makefile
            tests/Makefile
            tests/fastvapi/Makefile
            tests/girwriter/Makefile
diff --git a/vapi/Makefile.am b/vapi/Makefile.am
index 0f1bb0a3d..2af0a2e7c 100644
--- a/vapi/Makefile.am
+++ b/vapi/Makefile.am
@@ -1,5 +1,9 @@
 NULL =
 
+SUBDIRS = \
+       tests \
+       $(NULL)
+
 check: $(top_builddir)/compiler/valac
        echo "void main () {}" > test.vala; \
        for vapi in `ls *.vapi | sed -e "s/\.vapi//g"`; do \
diff --git a/vapi/tests/.gitignore b/vapi/tests/.gitignore
new file mode 100644
index 000000000..7e563b8b3
--- /dev/null
+++ b/vapi/tests/.gitignore
@@ -0,0 +1,2 @@
+*.log
+*.trs
diff --git a/vapi/tests/Makefile.am b/vapi/tests/Makefile.am
new file mode 100644
index 000000000..11cd44626
--- /dev/null
+++ b/vapi/tests/Makefile.am
@@ -0,0 +1,38 @@
+NULL =
+
+BUILT_SOURCES = \
+       $(NULL)
+noinst_PROGRAMS = \
+       $(NULL)
+
+TEST_EXTENSIONS = .vala
+
+TEST_RUNNER = $(abs_top_srcdir)/build-aux/testrunner.sh
+VALA_LOG_COMPILER = $(TEST_RUNNER)
+GS_LOG_COMPILER = $(TEST_RUNNER)
+TEST_LOG_COMPILER = $(TEST_RUNNER)
+
+AM_TESTS_ENVIRONMENT = \
+       export EXEEXT=$(EXEEXT); \
+       export CFLAGS='$(CFLAGS)'; \
+       export CPPFLAGS='$(CPPFLAGS)'; \
+       export LDFLAGS='$(LDFLAGS)'; \
+       export TEST_CFLAGS='$(TEST_CFLAGS)'; \
+       export abs_top_srcdir='$(abs_top_srcdir)'; \
+       export abs_top_builddir='$(abs_top_builddir)'; \
+       export abs_srcdir='$(abs_srcdir)'; \
+       export abs_builddir='$(abs_builddir)'; \
+       export CC='$(CC)';
+
+TESTS = $(NULL)
+
+if HAVE_GSTREAMER
+TESTS += \
+       gstreamer-1.0/gvalue.vala \
+       $(NULL)
+endif
+
+EXTRA_DIST = \
+       gstreamer-1.0/tests-extra-environment.sh \
+       $(TESTS) \
+       $(NULL)
diff --git a/vapi/tests/gstreamer-1.0/gvalue.vala b/vapi/tests/gstreamer-1.0/gvalue.vala
new file mode 100644
index 000000000..0b2c54c41
--- /dev/null
+++ b/vapi/tests/gstreamer-1.0/gvalue.vala
@@ -0,0 +1,2 @@
+void main () {
+}
diff --git a/vapi/tests/gstreamer-1.0/tests-extra-environment.sh 
b/vapi/tests/gstreamer-1.0/tests-extra-environment.sh
new file mode 100644
index 000000000..06bf977e5
--- /dev/null
+++ b/vapi/tests/gstreamer-1.0/tests-extra-environment.sh
@@ -0,0 +1 @@
+PACKAGES="gstreamer-1.0"


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