summaryrefslogtreecommitdiff
path: root/test/c_glib
diff options
context:
space:
mode:
authorRandy Abernethy <ra@apache.org>2015-10-09 12:28:57 -0700
committerRandy Abernethy <ra@apache.org>2015-10-09 12:28:57 -0700
commit983bf7de419dca19dac755970218a7d09bea8553 (patch)
treef34d57bae8b86e70af01fdc246b872322b01edeb /test/c_glib
parentf124b55e6d974b97a68b045d4dffc152e00040af (diff)
downloadthrift-983bf7de419dca19dac755970218a7d09bea8553.tar.gz
THRIFT-3373: cross test cleanup
Client: build, node, c_glib, cpp, hs, py, rb Patch: Nobuaki Sukegawa Github Pull Request: This closes #641 commit 338f1a502961a4f63b0bd4b3dae4099062d6d17f Author: Nobuaki Sukegawa <nsukeg@gmail.com> Date: 2015-10-09T17:25:18Z THRIFT-3373 Various fixes for cross test servers and clients
Diffstat (limited to 'test/c_glib')
-rwxr-xr-xtest/c_glib/Makefile.am2
-rw-r--r--test/c_glib/src/thrift_test_handler.c14
-rw-r--r--test/c_glib/src/thrift_test_handler.h4
3 files changed, 14 insertions, 6 deletions
diff --git a/test/c_glib/Makefile.am b/test/c_glib/Makefile.am
index 7559fd607..4f9a119f0 100755
--- a/test/c_glib/Makefile.am
+++ b/test/c_glib/Makefile.am
@@ -29,7 +29,7 @@ nodist_libtestcglib_la_SOURCES = \
libtestcglib_la_LIBADD = $(top_builddir)/lib/c_glib/libthrift_c_glib.la
-precross: test_client test_server
+precross: libtestcglib.la test_client test_server
check_PROGRAMS = \
test_client \
diff --git a/test/c_glib/src/thrift_test_handler.c b/test/c_glib/src/thrift_test_handler.c
index a9983b5e6..69ddbc17e 100644
--- a/test/c_glib/src/thrift_test_handler.c
+++ b/test/c_glib/src/thrift_test_handler.c
@@ -68,7 +68,7 @@ thrift_test_handler_test_bool (TTestThriftTestIf *iface,
THRIFT_UNUSED_VAR (iface);
THRIFT_UNUSED_VAR (error);
- printf ("testByte(%s)\n", thing ? "true" : "false");
+ printf ("testBool(%s)\n", thing ? "true" : "false");
*_return = thing;
return TRUE;
@@ -144,7 +144,7 @@ thrift_test_handler_test_binary (TTestThriftTestIf *iface,
THRIFT_UNUSED_VAR (error);
printf ("testBinary()\n"); // TODO: hex output
- g_byte_array_append( *_return, thing->data, thing->len);
+ *_return = thing;
return TRUE;
}
@@ -701,16 +701,17 @@ thrift_test_handler_test_multi_exception (TTestThriftTestIf *iface,
g_assert (*err1 == NULL);
g_assert (*err2 == NULL);
- if (strncmp (arg0, "Xception", 9) == 0) {
+ if (strncmp (arg0, "Xception", 8) == 0 && strlen(arg0) == 8) {
*err1 = g_object_new (T_TEST_TYPE_XCEPTION,
"errorCode", 1001,
"message", g_strdup ("This is an Xception"),
NULL);
result = FALSE;
}
- else if (strncmp (arg0, "Xception2", 10) == 0) {
+ else if (strncmp (arg0, "Xception2", 9) == 0) {
*err2 = g_object_new (T_TEST_TYPE_XCEPTION2,
- "errorCode", 2002);
+ "errorCode", 2002,
+ NULL);
g_object_get (*err2,
"struct_thing", &struct_thing,
@@ -783,6 +784,9 @@ thrift_test_handler_class_init (ThriftTestHandlerClass *klass)
base_class->test_double =
klass->test_double =
thrift_test_handler_test_double;
+ base_class->test_binary =
+ klass->test_binary =
+ thrift_test_handler_test_binary;
base_class->test_struct =
klass->test_struct =
thrift_test_handler_test_struct;
diff --git a/test/c_glib/src/thrift_test_handler.h b/test/c_glib/src/thrift_test_handler.h
index 957bbda5d..b64cb16f2 100644
--- a/test/c_glib/src/thrift_test_handler.h
+++ b/test/c_glib/src/thrift_test_handler.h
@@ -86,6 +86,10 @@ struct _ThriftTestHandlerClass {
gdouble*_return,
const gdouble thing,
GError **error);
+ gboolean (*test_binary) (TTestThriftTestIf *iface,
+ GByteArray **_return,
+ const GByteArray *thing,
+ GError **error);
gboolean (*test_struct) (TTestThriftTestIf *iface,
TTestXtruct **_return,
const TTestXtruct *thing,