check that typelib -> gir -> typelib transformation is lossless (it's not)
authorTommi Komulainen <tommi.komulainen@iki.fi>
Wed, 15 Oct 2008 22:18:37 +0000 (22:18 +0000)
committerTommi Komulainen <tko@src.gnome.org>
Wed, 15 Oct 2008 22:18:37 +0000 (22:18 +0000)
2008-10-15  Tommi Komulainen  <tommi.komulainen@iki.fi>

* gir/Makefile.am (check-local): check that typelib -> gir -> typelib
transformation is lossless (it's not)

svn path=/trunk/; revision=720

ChangeLog
gir/Makefile.am

index c7fa17e..6f0f525 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2008-10-15  Tommi Komulainen  <tommi.komulainen@iki.fi>
 
+       * gir/Makefile.am (check-local): check that typelib -> gir -> typelib
+       transformation is lossless (it's not)
+
+2008-10-15  Tommi Komulainen  <tommi.komulainen@iki.fi>
+
        * tests/Makefile.am: fix tests to compare xml to xml instead of
        typelib to xml, and stop on error
 
index dbe52a9..be69033 100644 (file)
@@ -117,3 +117,24 @@ dist_gir_DATA = $(BUILT_SOURCES)
 typelibsdir = $(datadir)/girepository
 typelibs_DATA = GLib-2.0.typelib GModule-2.0.typelib GObject-2.0.typelib Gio-2.0.typelib
 CLEANFILES += $(typelibs_DATA)
+
+# Check that typelib -> gir -> typelib transformation is lossless.
+# Comparing gir files is relatively fragile (whitespace, attribute default
+# values, etc.) but the typelibs should identical as long as the gir files are
+# semantically equivalent.
+
+%.test.gir: %.typelib $(top_builddir)/tools/g-ir-generate$(EXEEXT) Makefile
+       $(DEBUG) $(top_builddir)/tools/g-ir-generate$(EXEEXT) --includedir=. $< -o $@
+
+testlib-%: %.test.gir $(top_builddir)/tools/g-ir-generate$(EXEEXT) Makefile
+       $(DEBUG) $(top_builddir)/tools/g-ir-compiler$(EXEEXT) --includedir=. $(G_IR_COMPILER_OPTS) $< -o $*.test.typelib
+       cmp $*.typelib $*.test.typelib && rm $*.test.typelib
+
+testgir-%: %.test.gir
+       diff -u $*.gir $< && rm $<
+
+CLEANFILES += $(typelibs_DATA:%.typelib=%.test.gir)
+CLEANFILES += $(typelibs_DATA:%.typelib=%.test.typelib)
+
+check-local: $(typelibs_DATA:%.typelib=testlib-%)
+check-gir: $(typelibs_DATA:%.typelib=testgir-%)