diff --git a/tests/Makefile.am b/tests/Makefile.am index c5de671..a753208 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1,12 +1,31 @@ +generated_sources = searpc-signature.h searpc-marshal.h AM_CFLAGS = @GLIB_CFLAGS@ \ - -I${top_srcdir}/lib + -I${top_srcdir}/lib \ + -I${top_srcdir}/json-glib + +# we need to generate the first +BUILT_SOURCES = gensource check_PROGRAMS = test-searpc test_searpc_SOURCES = test-searpc.c test_searpc_LDADD = @GLIB_LIBS@ \ - $(top_builddir)/lib/libsearpc.la + $(top_builddir)/lib/libsearpc.la \ + ${top_builddir}/json-glib/json-glib/libsearpc-json-glib.la test_searpc_LDFLAGS = -static TESTS = test-searpc + +EXTRA_DIST = rpc_table.py + +gensource: ${generated_sources} + +${generated_sources}: rpc_table.py + @echo "[libsearpc]: generating rpc header files" + python ${top_srcdir}/lib/searpc-codegen.py rpc_table.py + @echo "[libsearpc]: done" + +clean-local: + -rm ${generated_sources} + diff --git a/tests/rpc_table.py b/tests/rpc_table.py new file mode 100644 index 0000000..5b61093 --- /dev/null +++ b/tests/rpc_table.py @@ -0,0 +1,10 @@ +""" +Define RPC functions needed to generate +""" + +# [ , [] ] +func_table = [ + [ "string", ["string", "int"] ], + [ "object", ["string"] ], + [ "objlist", ["string", "int"] ], +] diff --git a/tests/test-searpc.c b/tests/test-searpc.c index 9490fa9..72f262d 100644 --- a/tests/test-searpc.c +++ b/tests/test-searpc.c @@ -4,6 +4,8 @@ #include #include +#include + #define DFT_DOMAIN g_quark_from_string("TEST") #include "searpc-server.h" @@ -331,13 +333,16 @@ void test_simple_call_async (void *fixture, const void *data) 2, "string", "hello", "int", 10); } +#include "searpc-signature.h" +#include "searpc-marshal.h" + int main (int argc, char *argv[]) { g_type_init (); g_test_init (&argc, &argv, NULL); - searpc_server_init (); + searpc_server_init (register_marshals); searpc_create_service ("test"); searpc_server_register_function ("test", get_substring, "get_substring", searpc_signature_string__string_int());