summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDerek Foreman <derekf@osg.samsung.com>2016-01-12 21:12:37 +0100
committerJonas Ådahl <jadahl@gmail.com>2016-01-14 15:49:00 +0800
commitd8cb9c2a8b207ff8ef8e8bd7f3012fd401c049e0 (patch)
treecc5c69726ce7561ad4fa558576854427940f183a
parenta5585f3de3b4847b611b246526ccfe8c4a1473bb (diff)
downloadwayland-protocols-d8cb9c2a8b207ff8ef8e8bd7f3012fd401c049e0.tar.gz
test: add make check
We can now test all the protocol files by running make check (or distcheck) which will pass them through the scanner. Signed-off-by: Derek Foreman <derekf@osg.samsung.com> Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net> Acked-by: Peter Hutterer <peter.hutterer@who-t.net> Acked-by: Jonas Ådahl <jadahl@gmail.com>
-rw-r--r--.gitignore3
-rw-r--r--Makefile.am10
-rw-r--r--configure.ac14
-rwxr-xr-xtests/scan.sh10
4 files changed, 37 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index e6f85d0..ca19ecf 100644
--- a/.gitignore
+++ b/.gitignore
@@ -9,3 +9,6 @@ missing
*.pc
autom4te.cache
aclocal.m4
+*.trs
+*.log
+test-driver
diff --git a/Makefile.am b/Makefile.am
index 5926a41..582b3f2 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -7,6 +7,9 @@ unstable_protocols = \
unstable/xdg-shell/xdg-shell-unstable-v5.xml \
$(NULL)
+stable_protocols = \
+ $(NULL)
+
nobase_dist_pkgdata_DATA = \
$(unstable_protocols) \
$(NULL)
@@ -16,3 +19,10 @@ dist_noinst_DATA = \
$(NULL)
noarch_pkgconfig_DATA = wayland-protocols.pc
+
+dist_check_SCRIPTS = tests/scan.sh
+
+TESTS = $(unstable_protocols) $(stable_protocols)
+TEST_EXTENSIONS = .xml
+AM_TESTS_ENVIRONMENT = SCANNER='$(wayland_scanner)'; export SCANNER;
+XML_LOG_COMPILER = $(srcdir)/tests/scan.sh
diff --git a/configure.ac b/configure.ac
index c51b7fc..61693fb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -15,6 +15,20 @@ AC_CONFIG_MACRO_DIR([m4])
AC_SUBST([WAYLAND_PROTOCOLS_VERSION], [wayland_protocols_version])
+AC_CANONICAL_HOST
+AC_CANONICAL_BUILD
+
+AC_ARG_VAR([wayland_scanner], [The wayland-scanner executable])
+AC_PATH_PROG([wayland_scanner], [wayland-scanner])
+if test x$wayland_scanner = x; then
+ if test x$host = x$build; then
+ PKG_CHECK_MODULES(WAYLAND_SCANNER, [wayland-scanner])
+ wayland_scanner=`$PKG_CONFIG --variable=wayland_scanner wayland-scanner`
+ else
+ AC_MSG_WARN([You are cross compiling without wayland-scanner in your path. make check will fail.])
+ fi
+fi
+
AM_INIT_AUTOMAKE([1.11 foreign no-dist-gzip dist-xz])
AM_SILENT_RULES([yes])
diff --git a/tests/scan.sh b/tests/scan.sh
new file mode 100755
index 0000000..15dd39f
--- /dev/null
+++ b/tests/scan.sh
@@ -0,0 +1,10 @@
+#!/bin/sh -e
+
+if [ "x$SCANNER" = "x" ] ; then
+ echo "No scanner present, test skipped." 1>&2
+ exit 77
+fi
+
+$SCANNER client-header $1 /dev/null
+$SCANNER server-header $1 /dev/null
+$SCANNER code $1 /dev/null