On 22/12/2015 19:19, Derek Foreman wrote:
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 <[email protected]>
---
Changes from v1:
Use #~/bin/sh -e and drop the && from each line in the script
Discover the scanner's location and use it

  .gitignore    | 3 +++
  Makefile.am   | 7 +++++++
  configure.ac  | 6 ++++++
  tests/scan.sh | 5 +++++
  4 files changed, 21 insertions(+)
  create mode 100755 tests/scan.sh

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..dc44c28 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -16,3 +16,10 @@ dist_noinst_DATA =                                           
                \
        $(NULL)

  noarch_pkgconfig_DATA = wayland-protocols.pc
+
+EXTRA_DIST = tests/scan.sh

dist_check_SCRIPTS maybe? :-)


+
+TESTS = $(unstable_protocols)

Why not all the variables already?


+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..dc5d899 100644
--- a/configure.ac
+++ b/configure.ac
@@ -15,6 +15,12 @@ AC_CONFIG_MACRO_DIR([m4])

  AC_SUBST([WAYLAND_PROTOCOLS_VERSION], [wayland_protocols_version])

+AC_PATH_PROG([wayland_scanner], [wayland-scanner])

It makes me wonder… Do we expect wayland-scanner to generate arch-independent code? If so, it’s ok. If not, it should be AC_PATH_TOOL.


+if test x$wayland_scanner = x; then
+        PKG_CHECK_MODULES(WAYLAND_SCANNER, [wayland-scanner])
+        wayland_scanner=`$PKG_CONFIG --variable=wayland_scanner 
wayland-scanner`

Ok, this is a good idea (and maybe am I the one originally writing it like that, or reviewing something similar) but it can lead to strange situations while cross-compiling.

If you cross-compile from x86 to arm64, with no scanner installed for x86, it will try to run the arm64 scanner, which is not possible.

I see the need for it in the “$HOME testing environment” but then we should at least check that $host == $build.


+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..fd92bec
--- /dev/null
+++ b/tests/scan.sh
@@ -0,0 +1,5 @@
+#!/bin/sh -e
+
+$SCANNER client-header $1 /dev/null
+$SCANNER server-header $1 /dev/null
+$SCANNER code $1 /dev/null



--

Quentin “Sardem FF7” Glidic
_______________________________________________
wayland-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/wayland-devel

Reply via email to