[gobject-introspection] tests: Use Automake test harness for scanner diff tests
- From: Colin Walters <walters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gobject-introspection] tests: Use Automake test harness for scanner diff tests
- Date: Sun, 29 Dec 2013 19:04:30 +0000 (UTC)
commit 3160f642dbed35b4af8e4d9314c60e4a037884c8
Author: Simon Feltman <sfeltman src gnome org>
Date: Fri Dec 20 03:38:37 2013 -0800
tests: Use Automake test harness for scanner diff tests
Add gi-tester script for dispatching various scanner diff tests based on
their target suffix. Hook the dispatcher script into the Automake test
harness which is passed the diff test target name. Remove usage of
check-local which is always run regardless of whether or not the TESTS
variable is set from the command line. This allows for both the ability to
use the harnesses XFAIL_TESTS variable for expected failures as well as
testing of targets individually, for example:
cd tests/scanner
make check TESTS=GtkFrob-1.0.gir
make check TESTS=Regress-1.0-Python
Add Headeronly-1.0-expected.gir for validating the results of the header
only gir creation test.
https://bugzilla.gnome.org/show_bug.cgi?id=720713
tests/Makefile.am | 4 ++-
tests/gi-tester | 39 +++++++++++++++++++++++++++++
tests/scanner/Headeronly-1.0-expected.gir | 21 +++++++++++++++
tests/scanner/Makefile.am | 29 ++++++---------------
4 files changed, 72 insertions(+), 21 deletions(-)
---
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 56fc479..26fe83b 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -21,7 +21,9 @@ check_LTLIBRARIES = libeverything-1.0.la libgimarshallingtests-1.0.la
libeverything_1_0_la_SOURCES = everything.c
libgimarshallingtests_1_0_la_SOURCES = gimarshallingtests.c
-EXTRA_DIST += gimarshallingtests.h
+EXTRA_DIST += \
+ gimarshallingtests.h \
+ gi-tester
BUILT_SOURCES += everything.c everything.h
diff --git a/tests/gi-tester b/tests/gi-tester
new file mode 100755
index 0000000..496b947
--- /dev/null
+++ b/tests/gi-tester
@@ -0,0 +1,39 @@
+#!/usr/bin/env bash
+
+targetname=$1
+
+# Note the target name for the documentation targets (-C, -Python, -Gjs)
+# incorrectly include a relative path to the srcdir, strip that off for usage
+# in directory diffs.
+targetbase=${targetname##*/}
+
+case $targetname in
+*.gir)
+ diff -u -U 10 ${srcdir}/${targetname::-4}-expected.gir ${builddir}/${targetname}
+ exit $?
+ ;;
+*.typelib)
+ # Do nothing for typelibs, this just ensures they build as part of the tests
+ exit 0
+ ;;
+*-C)
+ diff -r -u -w -B -U 10 ${srcdir}/${targetbase}-expected ${builddir}/${targetbase}
+ exit $?
+ ;;
+*-Python)
+ diff -r -u -w -B -U 10 ${srcdir}/${targetbase}-expected ${builddir}/${targetbase}
+ exit $?
+ ;;
+*-Gjs)
+ diff -r -u -w -B -U 10 ${srcdir}/${targetbase}-expected ${builddir}/${targetbase}
+ exit $?
+ ;;
+*-sections.txt)
+ diff -u -w -B -U 10 ${srcdir}/${targetname::-4}-expected.txt ${builddir}/${targetname}
+ exit $?
+ ;;
+*)
+ echo $"Usage: gi-tester <targetname>"
+ exit 1
+ ;;
+esac
diff --git a/tests/scanner/Headeronly-1.0-expected.gir b/tests/scanner/Headeronly-1.0-expected.gir
new file mode 100644
index 0000000..179d981
--- /dev/null
+++ b/tests/scanner/Headeronly-1.0-expected.gir
@@ -0,0 +1,21 @@
+<?xml version="1.0"?>
+<!-- This file was automatically generated from C sources - DO NOT EDIT!
+To affect the contents of this file, edit the original C definitions,
+and/or use gtk-doc annotations. -->
+<repository version="1.2"
+ xmlns="http://www.gtk.org/introspection/core/1.0"
+ xmlns:c="http://www.gtk.org/introspection/c/1.0"
+ xmlns:glib="http://www.gtk.org/introspection/glib/1.0">
+ <namespace name="Headeronly"
+ version="1.0"
+ shared-library=""
+ c:identifier-prefixes="Headeronly"
+ c:symbol-prefixes="headeronly">
+ <enumeration name="ExampleEnum" c:type="HeaderonlyExampleEnum">
+ <member name="foo" value="0" c:identifier="HEADERONLY_FOO">
+ </member>
+ <member name="bar" value="1" c:identifier="HEADERONLY_BAR">
+ </member>
+ </enumeration>
+ </namespace>
+</repository>
diff --git a/tests/scanner/Makefile.am b/tests/scanner/Makefile.am
index a1c0ecf..bf7afc9 100644
--- a/tests/scanner/Makefile.am
+++ b/tests/scanner/Makefile.am
@@ -67,7 +67,7 @@ endif
# .gir --[scanner]-> .typelib
GIRS =
TYPELIBS = $(GIRS:.gir=.typelib)
-CHECKGIRS = $(GIRS:.gir=.gir.check)
+CHECKGIRS = $(GIRS)
EXPECTEDGIRS = $(GIRS:.gir=-expected.gir)
INTROSPECTION_GIRS = $(GIRS)
CLEANFILES = $(TYPELIBS) $(GIRS)
@@ -141,20 +141,19 @@ Bar_1_0_gir_SCANNERFLAGS = --accept-unprefixed
GIRS += Bar-1.0.gir
endif
-EXTRA_DIST += headeronly.h
+EXTRA_DIST += \
+ headeronly.h \
+ Headeronly-1.0-expected.gir
CLEANFILES += Headeronly-1.0.gir
Headeronly-1.0.gir: headeronly.h
$(AM_V_GEN) $(INTROSPECTION_SCANNER) $(INTROSPECTION_SCANNER_ARGS) --warn-all --warn-error
--reparse-validate --namespace=Headeronly --nsversion=1.0 --header-only --output=$@ $<
-%.gir.check: %.gir
- @diff -u -U 10 $(srcdir)/$*-expected.gir $*.gir && echo " TEST $*.gir"
-
if BUILD_DOCTOOL
DOCGIRS = Regress-1.0.gir
-CHECKDOCS = $(DOCGIRS:.gir=-C.page.check) $(DOCGIRS:.gir=-Python.page.check) $(DOCGIRS:.gir=-Gjs.page.check)
$(DOCGIRS:.gir=-sections.txt.page.check)
+CHECKDOCS = $(DOCGIRS:.gir=-C) $(DOCGIRS:.gir=-Python) $(DOCGIRS:.gir=-Gjs) $(DOCGIRS:.gir=-sections.txt)
MALLARD_DIRS = $(DOCGIRS:.gir=-C) $(DOCGIRS:.gir=-Python) $(DOCGIRS:.gir=-Gjs)
-MALLARD_CLEAN = $(DOCGIRS:.gir=-C)/* $(DOCGIRS:.gir=-Python)/* $(DOCGIRS:.gir=-Gjs)/*
+MALLARD_CLEAN = $(DOCGIRS:.gir=-C)/* $(DOCGIRS:.gir=-Python)/* $(DOCGIRS:.gir=-Gjs)/*
$(DOCGIRS:.gir=-sections.txt)
EXPECTED_MALLARD_DIRS = $(MALLARD_DIRS:=-expected)
CLEANFILES += $(MALLARD_CLEAN)
@@ -173,23 +172,13 @@ CLEANFILES += $(MALLARD_CLEAN)
%-sections.txt: %.gir
$(AM_V_GEN)$(INTROSPECTION_DOCTOOL) $(INTROSPECTION_DOCTOOL_ARGS) --write-sections-file $*.gir -o $@
-%-C.page.check: %-C
- @diff -r -u -w -B -U 10 $(srcdir)/$*-C-expected $(builddir)/$*-C && echo " TEST $*-C"
-
-%-Python.page.check: %-Python
- @diff -r -u -w -B -U 10 $(srcdir)/$*-Python-expected $(builddir)/$*-Python && echo " TEST $*-Python"
-
-%-Gjs.page.check: %-Gjs
- @diff -r -u -w -B -U 10 $(srcdir)/$*-Gjs-expected $(builddir)/$*-Gjs && echo " TEST $*-Gjs"
-
-%-sections.txt.page.check: %-sections.txt
- @diff -u -w -B -U 10 $(srcdir)/$*-sections-expected.txt $*-sections.txt && echo " TEST $*-C"
-
else
CHECKDOCS =
endif
-check-local: Headeronly-1.0.gir $(CHECKGIRS) $(CHECKDOCS) $(TYPELIBS)
+TESTS = Headeronly-1.0.gir $(CHECKGIRS) $(CHECKDOCS) $(TYPELIBS)
+TESTS_ENVIRONMENT = srcdir=$(srcdir) top_srcdir=$(top_srcdir) builddir=$(builddir)
top_builddir=$(top_builddir) \
+ $(top_srcdir)/tests/gi-tester
EXTRA_DIST += \
annotationparser/README \
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]