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
diff --git a/test/c_glib/Makefile.am b/test/c_glib/Makefile.am
index 7559fd6..4f9a119 100755
--- a/test/c_glib/Makefile.am
+++ b/test/c_glib/Makefile.am
@@ -29,7 +29,7 @@
 
 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 a9983b5..69ddbc1 100644
--- a/test/c_glib/src/thrift_test_handler.c
+++ b/test/c_glib/src/thrift_test_handler.c
@@ -68,7 +68,7 @@
   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_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 @@
   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 @@
   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 957bbda..b64cb16 100644
--- a/test/c_glib/src/thrift_test_handler.h
+++ b/test/c_glib/src/thrift_test_handler.h
@@ -86,6 +86,10 @@
                                     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,