gobject-introspection r120 - in trunk: . tests tests/invoke



Author: robtaylor
Date: Thu Feb 28 00:37:01 2008
New Revision: 120
URL: http://svn.gnome.org/viewvc/gobject-introspection?rev=120&view=rev

Log:
2008-02-21  Mark Doffman  <mark doffman codethink co uk>

	reviewed by: Rob Taylor  <rob taylor codethink co uk>
	reviewed by: Johan Dahlin  <johan gnome org>

	* tests/Makefile.am:
	* tests/roundtrips.sh:
	Modify the roundtrips test so that they do not use the
	--raw option of the gidl compiler but instead compile a
	shared library to use with g_module.

	* tests/invoke/Makefile.am:
	* tests/invoke/invoke.c:
	Modify the invoke tests to build a shared library rather
	than use the --raw option.

	* tests/invoke/invoke-namespace-find.sh: Removed:
	Noone knows why this was here, so removed.


Added:
   trunk/tests/constant.test
   trunk/tests/types.test
Removed:
   trunk/tests/invoke/invoke-namespace-find.sh
Modified:
   trunk/ChangeLog
   trunk/tests/Makefile.am
   trunk/tests/invoke/Makefile.am
   trunk/tests/invoke/invoke.c
   trunk/tests/roundtrips.sh

Modified: trunk/tests/Makefile.am
==============================================================================
--- trunk/tests/Makefile.am	(original)
+++ trunk/tests/Makefile.am	Thu Feb 28 00:37:01 2008
@@ -1,9 +1,10 @@
-SUBDIRS = . invoke parser
+SUBDIRS = invoke parser
 
 EXTRA_DIST = \
 	roundtrips.sh	\
 	array.test	\
 	boxed.test	\
+	constant.test	\
 	enum.test	\
 	errors.test	\
 	function.test	\
@@ -11,8 +12,16 @@
 	interface.test	\
 	object.test	\
 	struct.test	\
+	types.test	\
 	union.test	\
 	xref1.test	\
 	xref2.test
 
+TESTS_ENVIRONMENT = \
+	LIBTOOL="$(LIBTOOL)" \
+	GIREPO_CFLAGS="$(GIREPO_CFLAGS)" \
+	GIREPO_LIBS="$(GIREPO_LIBS)" \
+	CC="$(CC)" \
+	GIREPOPATH="."
+
 TESTS = roundtrips.sh

Added: trunk/tests/constant.test
==============================================================================
--- (empty file)
+++ trunk/tests/constant.test	Thu Feb 28 00:37:01 2008
@@ -0,0 +1,10 @@
+<?xml version="1.0"?>
+<api version="1.0">
+  <namespace name="Foo">
+    <constant name="constant1" type="gint" value="42" />
+    <constant name="constant2" type="guint" value="42" />
+    <constant name="constant3" type="guint64" value="42" />
+    <constant name="constant4" type="gint32" value="42" />
+    <constant name="constant5" type="gfloat" value="42.000000" />
+  </namespace>
+</api>

Modified: trunk/tests/invoke/Makefile.am
==============================================================================
--- trunk/tests/invoke/Makefile.am	(original)
+++ trunk/tests/invoke/Makefile.am	Thu Feb 28 00:37:01 2008
@@ -5,29 +5,24 @@
 testlibdir = /tmp
 install-testlibLTLIBRARIES: # prevent it from being installed
 
-
-testfns_la_SOURCES =				\
-	testfns.c				\
+testfns_la_SOURCES =\
+	testfns.c\
 	testfns-metadata.c
 testfns_la_CFLAGS = $(GIREPO_CFLAGS) -I$(top_srcdir)/girepository
 testfns_la_LDFLAGS = -module -avoid-version
 testfns_la_LIBADD = $(GIREPO_LIBS) $(top_builddir)/girepository/libgirepository.la
 
-BUILT_SOURCES = testfns-metadata.c test.repo
-CLEANFILES = testfns-metadata.c test.repo
+BUILT_SOURCES = testfns-metadata.c
+CLEANFILES = testfns-metadata.c
 
 testfns-metadata.c: testfns.xml
 	$(top_builddir)/tools/g-idl-compiler $(srcdir)/testfns.xml -o testfns-metadata.c
 
-test.repo: testfns.xml
-	$(top_builddir)/tools/g-idl-compiler --shared-library testfns.la $< --raw -o $@
-
 invoke_SOURCES = invoke.c
 invoke_CFLAGS = $(GIREPO_CFLAGS)  -I$(top_srcdir)/girepository
 invoke_LDADD = $(GIREPO_LIBS) $(top_builddir)/girepository/libgirepository.la
 
-TESTS = invoke invoke-namespace-find.sh
-
-EXTRA_DIST = invoke-namespace-find.sh testfns.xml
+EXTRA_DIST = testfns.xml
+TESTS = invoke
 
 TESTS_ENVIRONMENT = GIREPOPATH="."

Modified: trunk/tests/invoke/invoke.c
==============================================================================
--- trunk/tests/invoke/invoke.c	(original)
+++ trunk/tests/invoke/invoke.c	Thu Feb 28 00:37:01 2008
@@ -30,24 +30,11 @@
 	   testfns,
 	   g_irepository_get_n_infos (rep, "test"));
 
-  if (argc == 1)
+  handle = g_module_open (testfns, 0);
+  if (!handle)
     {
-      handle = g_module_open (testfns, 0);
-      if (!handle)
-	{
-	  g_error ("module open failed: %s\n", g_module_error ());
-	  return;
-	}
-    }
-  else
-    {
-      name = g_irepository_register_file (rep, "test", &error);
-      if (error)
-	{
-	  g_error ("Unable to load metadata 'test': %s", error->message);
-	  return;
-	}
-      g_print ("Loaded %s from test.gmeta\n", name);
+      g_error ("module open failed: %s\n", g_module_error ());
+      return;
     }
 
   g_print ("after dlopening %s: %d infos in the repository\n", 

Modified: trunk/tests/roundtrips.sh
==============================================================================
--- trunk/tests/roundtrips.sh	(original)
+++ trunk/tests/roundtrips.sh	Thu Feb 28 00:37:01 2008
@@ -1,26 +1,12 @@
-#! /bin/sh
-
-SIMPLE_TESTS="array.test boxed.test enum.test errors.test function.test interface.test struct.test union.test"
+#! /bin/sh -x
+#
+SIMPLE_TESTS="enum.test struct.test constant.test union.test array.test types.test boxed.test errors.test function.test interface.test object.test xref1.test xref2.test"
 
 for i in $SIMPLE_TESTS; do
-	echo $i
-	../tools/g-idl-compiler --raw $srcdir/$i > $i.1; 
-	../tools/g-idl-generate --raw $i.1 > $i.2; 
-	diff -u $srcdir/$i $i.2 || exit 1; 
-	rm $i.1 $i.2
+	../tools/g-idl-compiler -o $i.c $srcdir/$i
+	$LIBTOOL --tag=CC --mode=compile $CC -c $GIREPO_CFLAGS -I$srcdir/../girepository $i.c
+	$LIBTOOL --tag=CC --mode=link $CC -module -avoid-version -rpath /tmp -o $i.la $i.lo ../girepository/libgirepository.la $GIREPO_LIBS
+	../tools/g-idl-generate $i.la > $i.res; 
+	diff -u $srcdir/$i $i.res || exit 1; 
+	rm -f $i.res $i.la $i.lo $i.o $i.c
 done
-
-../tools/g-idl-compiler --raw --module=Foo $srcdir/object.test $srcdir/gobject.test > object.test.1
-../tools/g-idl-generate --raw object.test.1 > object.test.2
-diff -u $srcdir/object.test object.test.2 || exit 1
-rm object.test.1 object.test.2
-
-../tools/g-idl-compiler --raw --module=Foo $srcdir/xref1.test $srcdir/xref2.test > xref1.test.1
-../tools/g-idl-generate --raw xref1.test.1 > xref1.test.2
-diff -u $srcdir/xref1.test xref1.test.2 || exit 1
-rm xref1.test.1 xref1.test.2
-
-../tools/g-idl-compiler --raw --module=Bar $srcdir/xref1.test $srcdir/xref2.test > xref2.test.1
-../tools/g-idl-generate --raw xref2.test.1 > xref2.test.2
-diff -u $srcdir/xref2.test xref2.test.2 || exit 1
-rm xref2.test.1 xref2.test.2

Added: trunk/tests/types.test
==============================================================================
--- (empty file)
+++ trunk/tests/types.test	Thu Feb 28 00:37:01 2008
@@ -0,0 +1,14 @@
+<?xml version="1.0"?>
+<api version="1.0">
+  <namespace name="Foo">
+    <function name="lart" symbol="lart">
+      <return-type type="gboolean" />
+      <parameters>
+        <parameter name="box" type="gint*" transfer="full" direction="in" />
+        <parameter name="val" type="gint*" transfer="full" direction="inout" />
+        <parameter name="w" type="GList<gint*>*" transfer="full" direction="in" />
+        <parameter name="t" type="GHashTable<utf8,gint64>*" transfer="full" direction="in" />
+      </parameters>
+    </function>
+  </namespace>
+</api>



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]