diff options
-rw-r--r-- | tests/Makefile.am | 4 | ||||
-rwxr-xr-x | tests/gi-tester | 39 | ||||
-rw-r--r-- | tests/scanner/Headeronly-1.0-expected.gir | 21 | ||||
-rw-r--r-- | tests/scanner/Makefile.am | 29 |
4 files changed, 72 insertions, 21 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am index 56fc4796..26fe83bb 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 00000000..496b947b --- /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 00000000..179d9816 --- /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 a1c0ecfa..bf7afc92 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 \ |