1
0
mirror of https://github.com/haiwen/libsearpc.git synced 2025-08-01 21:07:44 +00:00

Make check pass.

This commit is contained in:
gnehzuil 2012-06-23 11:43:42 +08:00
parent f2b0236d40
commit c91f143fdc
3 changed files with 37 additions and 3 deletions

View File

@ -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}

10
tests/rpc_table.py Normal file
View File

@ -0,0 +1,10 @@
"""
Define RPC functions needed to generate
"""
# [ <ret-type>, [<arg_types>] ]
func_table = [
[ "string", ["string", "int"] ],
[ "object", ["string"] ],
[ "objlist", ["string", "int"] ],
]

View File

@ -4,6 +4,8 @@
#include <glib.h>
#include <glib-object.h>
#include <searpc.h>
#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());