summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRico Tzschichholz <ricotz@ubuntu.com>2020-12-06 16:46:55 +0100
committerRico Tzschichholz <ricotz@ubuntu.com>2020-12-06 16:46:55 +0100
commit8b94b65eb07db5019a99b2351ae42760f1d34cee (patch)
treebfd04c28f63905204b901d5c8f9404e2b4af08b4
parente94cbcd6cfa0756688a053ea54089508357ff27f (diff)
downloadvala-wip/test-bindings.tar.gz
vapi/tests: Support compile and runtime testing of bindingswip/test-bindings
-rw-r--r--configure.ac7
-rw-r--r--vapi/Makefile.am4
-rw-r--r--vapi/tests/.gitignore2
-rw-r--r--vapi/tests/Makefile.am38
-rw-r--r--vapi/tests/gstreamer-1.0/gvalue.vala2
-rw-r--r--vapi/tests/gstreamer-1.0/tests-extra-environment.sh1
6 files changed, 54 insertions, 0 deletions
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"