You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hawq.apache.org by rl...@apache.org on 2016/09/06 05:17:56 UTC
[09/51] [partial] incubator-hawq git commit: HAWQ-959. revert thrift
build commands.
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/72ea8afd/depends/thirdparty/thrift/lib/c_glib/test/testcontainertest.c
----------------------------------------------------------------------
diff --git a/depends/thirdparty/thrift/lib/c_glib/test/testcontainertest.c b/depends/thirdparty/thrift/lib/c_glib/test/testcontainertest.c
deleted file mode 100644
index 852254b..0000000
--- a/depends/thirdparty/thrift/lib/c_glib/test/testcontainertest.c
+++ /dev/null
@@ -1,530 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#include "gen-c_glib/t_test_container_test_types.h"
-#include "gen-c_glib/t_test_container_service.h"
-
-#include <thrift/c_glib/thrift.h>
-#include <thrift/c_glib/protocol/thrift_binary_protocol_factory.h>
-#include <thrift/c_glib/protocol/thrift_binary_protocol.h>
-#include <thrift/c_glib/protocol/thrift_protocol_factory.h>
-#include <thrift/c_glib/server/thrift_server.h>
-#include <thrift/c_glib/server/thrift_simple_server.h>
-#include <thrift/c_glib/transport/thrift_buffered_transport_factory.h>
-#include <thrift/c_glib/transport/thrift_buffered_transport.h>
-#include <thrift/c_glib/transport/thrift_server_socket.h>
-#include <thrift/c_glib/transport/thrift_server_transport.h>
-#include <thrift/c_glib/transport/thrift_socket.h>
-
-#include <glib-object.h>
-#include <glib.h>
-
-#include <unistd.h>
-#include <signal.h>
-#include <string.h>
-#include <sys/wait.h>
-#include <sys/types.h>
-
-#define TEST_SERVER_HOSTNAME "localhost"
-#define TEST_SERVER_PORT 9090
-
-/* --------------------------------------------------------------------------
- The ContainerService handler we'll use for testing */
-
-G_BEGIN_DECLS
-
-GType test_container_service_handler_get_type (void);
-
-#define TYPE_TEST_CONTAINER_SERVICE_HANDLER \
- (test_container_service_handler_get_type ())
-
-#define TEST_CONTAINER_SERVICE_HANDLER(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
- TYPE_TEST_CONTAINER_SERVICE_HANDLER, \
- TestContainerServiceHandler))
-#define TEST_CONTAINER_SERVICE_HANDLER_CLASS(c) \
- (G_TYPE_CHECK_CLASS_CAST ((c), \
- TYPE_TEST_CONTAINER_SERVICE_HANDLER, \
- TestContainerServiceHandlerClass))
-#define IS_TEST_CONTAINER_SERVICE_HANDLER(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
- TYPE_TEST_CONTAINER_SERVICE_HANDLER))
-#define IS_TEST_CONTAINER_SERVICE_HANDLER_CLASS(c) \
- (G_TYPE_CHECK_CLASS_TYPE ((c), \
- TYPE_TEST_CONTAINER_SERVICE_HANDLER))
-#define TEST_CONTAINER_SERVICE_HANDLER_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS ((obj), \
- TYPE_TEST_CONTAINER_SERVICE_HANDLER, \
- TestContainerServiceHandlerClass))
-
-struct _TestContainerServiceHandler {
- TTestContainerServiceHandler parent_instance;
-
- /* private */
- GPtrArray *string_list;
-};
-typedef struct _TestContainerServiceHandler TestContainerServiceHandler;
-
-struct _TestContainerServiceHandlerClass {
- TTestContainerServiceHandlerClass parent_class;
-};
-typedef struct _TestContainerServiceHandlerClass
- TestContainerServiceHandlerClass;
-
-G_END_DECLS
-
-/* -------------------------------------------------------------------------- */
-
-G_DEFINE_TYPE (TestContainerServiceHandler,
- test_container_service_handler,
- T_TEST_TYPE_CONTAINER_SERVICE_HANDLER)
-
-/* A helper function used to append copies of strings to a string list */
-static void append_string_to_ptr_array (gpointer element, gpointer ptr_array)
-{
- g_ptr_array_add ((GPtrArray *)ptr_array, g_strdup ((gchar *)element));
-}
-
-/* Accept a string list from the client and append its contents to our internal
- list */
-static gboolean
-test_container_service_handler_receive_string_list (TTestContainerServiceIf *iface,
- const GPtrArray *stringList,
- GError **error)
-{
- TestContainerServiceHandler *self = TEST_CONTAINER_SERVICE_HANDLER (iface);
-
- /* Append the client's strings to our own internal string list */
- g_ptr_array_foreach ((GPtrArray *)stringList,
- append_string_to_ptr_array,
- self->string_list);
-
- g_clear_error (error);
- return TRUE;
-}
-
-/* Return the contents of our internal string list to the client */
-static gboolean
-test_container_service_handler_return_string_list (TTestContainerServiceIf *iface,
- GPtrArray **_return,
- GError **error)
-{
- TestContainerServiceHandler *self = TEST_CONTAINER_SERVICE_HANDLER (iface);
-
- /* Return (copies of) the strings contained in our list */
- g_ptr_array_foreach (self->string_list,
- append_string_to_ptr_array,
- *_return);
-
- g_clear_error (error);
- return TRUE;
-}
-
-static gboolean
-test_container_service_handler_return_list_string_list (TTestContainerServiceIf *iface,
- GPtrArray **_return,
- GError **error)
-{
- TestContainerServiceHandler *self = TEST_CONTAINER_SERVICE_HANDLER (iface);
- GPtrArray *nested_list;
-
- /* Return a list containing our list of strings */
- nested_list
- = g_ptr_array_new_with_free_func ((GDestroyNotify)g_ptr_array_unref);
- g_ptr_array_add (nested_list, self->string_list);
- g_ptr_array_ref (self->string_list);
-
- g_ptr_array_add (*_return, nested_list);
-
- g_clear_error (error);
- return TRUE;
-}
-
-static gboolean
-test_container_service_handler_return_typedefd_list_string_list (TTestContainerServiceIf *iface,
- TTestListStringList **_return,
- GError **error)
-{
- TestContainerServiceHandler *self = TEST_CONTAINER_SERVICE_HANDLER (iface);
- TTestStringList *nested_list;
-
- /* Return a list containing our list of strings */
- nested_list
- = g_ptr_array_new_with_free_func ((GDestroyNotify)g_ptr_array_unref);
- g_ptr_array_add (nested_list, self->string_list);
- g_ptr_array_ref (self->string_list);
-
- g_ptr_array_add (*_return, nested_list);
-
- g_clear_error (error);
- return TRUE;
-}
-
-static void
-test_container_service_handler_finalize (GObject *object) {
- TestContainerServiceHandler *self = TEST_CONTAINER_SERVICE_HANDLER (object);
-
- /* Destroy our internal containers */
- g_ptr_array_unref (self->string_list);
- self->string_list = NULL;
-
- G_OBJECT_CLASS (test_container_service_handler_parent_class)->
- finalize (object);
-}
-
-static void
-test_container_service_handler_init (TestContainerServiceHandler *self)
-{
- /* Create our internal containers */
- self->string_list = g_ptr_array_new_with_free_func (g_free);
-}
-
-static void
-test_container_service_handler_class_init (TestContainerServiceHandlerClass *klass)
-{
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
- TTestContainerServiceHandlerClass *parent_class =
- T_TEST_CONTAINER_SERVICE_HANDLER_CLASS (klass);
-
- gobject_class->finalize = test_container_service_handler_finalize;
-
- parent_class->receive_string_list =
- test_container_service_handler_receive_string_list;
- parent_class->return_string_list =
- test_container_service_handler_return_string_list;
- parent_class->return_list_string_list =
- test_container_service_handler_return_list_string_list;
- parent_class->return_typedefd_list_string_list =
- test_container_service_handler_return_typedefd_list_string_list;
-}
-
-/* -------------------------------------------------------------------------- */
-
-/* Our test server, declared globally so we can access it within a signal
- handler */
-ThriftServer *server = NULL;
-
-/* A signal handler used to detect when the child process (the test suite) has
- exited so we know to shut down the server and terminate ourselves */
-static void
-sigchld_handler (int signal_number)
-{
- THRIFT_UNUSED_VAR (signal_number);
-
- /* The child process (the tests) has exited or been terminated; shut down the
- server gracefully */
- if (server != NULL)
- thrift_server_stop (server);
-}
-
-/* A helper function that executes a test case against a newly constructed
- service client */
-static void
-execute_with_service_client (void (*test_case)(TTestContainerServiceIf *,
- GError **))
-{
- ThriftSocket *socket;
- ThriftTransport *transport;
- ThriftProtocol *protocol;
-
- TTestContainerServiceIf *client;
-
- GError *error = NULL;
-
- /* Create a client with which to access the server */
- socket = g_object_new (THRIFT_TYPE_SOCKET,
- "hostname", TEST_SERVER_HOSTNAME,
- "port", TEST_SERVER_PORT,
- NULL);
- transport = g_object_new (THRIFT_TYPE_BUFFERED_TRANSPORT,
- "transport", socket,
- NULL);
- protocol = g_object_new (THRIFT_TYPE_BINARY_PROTOCOL,
- "transport", transport,
- NULL);
-
- thrift_transport_open (transport, &error);
- g_assert_no_error (error);
-
- client = g_object_new (T_TEST_TYPE_CONTAINER_SERVICE_CLIENT,
- "input_protocol", protocol,
- "output_protocol", protocol,
- NULL);
-
- /* Execute the test against this client */
- (*test_case)(client, &error);
- g_assert_no_error (error);
-
- /* Clean up and exit */
- thrift_transport_close (transport, NULL);
-
- g_object_unref (client);
- g_object_unref (protocol);
- g_object_unref (transport);
- g_object_unref (socket);
-}
-
-static void
-test_containers_with_default_values (void)
-{
- TTestContainersWithDefaultValues *default_values;
- GPtrArray *string_list;
-
- /* Fetch a new ContainersWithDefaultValues struct and its StringList member */
- default_values = g_object_new (T_TEST_TYPE_CONTAINERS_WITH_DEFAULT_VALUES,
- NULL);
- g_object_get (default_values,
- "StringList", &string_list,
- NULL);
-
- /* Make sure the list has been populated with its default values */
- g_assert_cmpint (string_list->len, ==, 2);
- g_assert_cmpstr (((gchar **)string_list->pdata)[0], ==, "Apache");
- g_assert_cmpstr (((gchar **)string_list->pdata)[1], ==, "Thrift");
-
- g_ptr_array_unref (string_list);
- g_object_unref (default_values);
-}
-
-static void
-test_container_service_string_list_inner (TTestContainerServiceIf *client,
- GError **error)
-{
- gchar *test_data[] = { "one", "two", "three" };
-
- GPtrArray *outgoing_string_list;
- GPtrArray *incoming_string_list;
- guint index;
-
- g_clear_error (error);
-
- /* Prepare our test data (our string list to send) */
- outgoing_string_list = g_ptr_array_new ();
- for (index = 0; index < 3; index += 1)
- g_ptr_array_add (outgoing_string_list, &test_data[index]);
-
- /* Send our data to the server and make sure we get the same data back on
- retrieve */
- g_assert
- (t_test_container_service_client_receive_string_list (client,
- outgoing_string_list,
- error) &&
- *error == NULL);
-
- incoming_string_list = g_ptr_array_new ();
- g_assert
- (t_test_container_service_client_return_string_list (client,
- &incoming_string_list,
- error) &&
- *error == NULL);
-
- /* Make sure the two lists are equivalent */
- g_assert_cmpint (incoming_string_list->len, ==, outgoing_string_list->len);
- for (index = 0; index < incoming_string_list->len; index += 1)
- g_assert_cmpstr (((gchar **)incoming_string_list->pdata)[index],
- ==,
- ((gchar **)outgoing_string_list->pdata)[index]);
-
- /* Clean up and exit */
- g_ptr_array_unref (incoming_string_list);
- g_ptr_array_unref (outgoing_string_list);
-}
-
-static void
-test_container_service_string_list (void)
-{
- execute_with_service_client (test_container_service_string_list_inner);
-}
-
-static void
-test_container_service_list_string_list_inner (TTestContainerServiceIf *client,
- GError **error)
-{
- GPtrArray *incoming_list;
- GPtrArray *nested_list;
-
- g_clear_error (error);
-
- /* Receive a list of string lists from the server */
- incoming_list =
- g_ptr_array_new_with_free_func ((GDestroyNotify)g_ptr_array_unref);
- g_assert
- (t_test_container_service_client_return_list_string_list (client,
- &incoming_list,
- error) &&
- *error == NULL);
-
- /* Make sure the list and its contents are valid */
- g_assert_cmpint (incoming_list->len, >, 0);
-
- nested_list = (GPtrArray *)g_ptr_array_index (incoming_list, 0);
- g_assert (nested_list != NULL);
- g_assert_cmpint (nested_list->len, >=, 0);
-
- /* Clean up and exit */
- g_ptr_array_unref (incoming_list);
-}
-
-static void
-test_container_service_list_string_list (void)
-{
- execute_with_service_client (test_container_service_list_string_list_inner);
-}
-
-static void
-test_container_service_typedefd_list_string_list_inner (TTestContainerServiceIf *client,
- GError **error)
-{
- TTestListStringList *incoming_list;
- TTestStringList *nested_list;
-
- g_clear_error (error);
-
- /* Receive a list of string lists from the server */
- incoming_list =
- g_ptr_array_new_with_free_func ((GDestroyNotify)g_ptr_array_unref);
- g_assert
- (t_test_container_service_client_return_list_string_list (client,
- &incoming_list,
- error) &&
- *error == NULL);
-
- /* Make sure the list and its contents are valid */
- g_assert_cmpint (incoming_list->len, >, 0);
-
- nested_list = (TTestStringList *)g_ptr_array_index (incoming_list, 0);
- g_assert (nested_list != NULL);
- g_assert_cmpint (nested_list->len, >=, 0);
-
- /* Clean up and exit */
- g_ptr_array_unref (incoming_list);
-}
-
-static void
-test_container_service_typedefd_list_string_list (void)
-{
- execute_with_service_client
- (test_container_service_typedefd_list_string_list_inner);
-}
-
-int
-main(int argc, char *argv[])
-{
- pid_t pid;
- int status;
-
-#if (!GLIB_CHECK_VERSION (2, 36, 0))
- g_type_init ();
-#endif
-
- /* Fork to run our test suite in a child process */
- pid = fork ();
- g_assert_cmpint (pid, >=, 0);
-
- if (pid == 0) { /* The child process */
- /* Wait a moment for the server to finish starting */
- sleep (1);
-
- g_test_init (&argc, &argv, NULL);
-
- g_test_add_func
- ("/testcontainertest/ContainerTest/Structs/ContainersWithDefaultValues",
- test_containers_with_default_values);
- g_test_add_func
- ("/testcontainertest/ContainerTest/Services/ContainerService/StringList",
- test_container_service_string_list);
- g_test_add_func
- ("/testcontainertest/ContainerTest/Services/ContainerService/ListStringList",
- test_container_service_list_string_list);
- g_test_add_func
- ("/testcontainertest/ContainerTest/Services/ContainerService/TypedefdListStringList",
- test_container_service_typedefd_list_string_list);
-
- /* Run the tests and make the result available to our parent process */
- _exit (g_test_run ());
- }
- else {
- TTestContainerServiceHandler *handler;
- TTestContainerServiceProcessor *processor;
-
- ThriftServerTransport *server_transport;
- ThriftTransportFactory *transport_factory;
- ThriftProtocolFactory *protocol_factory;
-
- struct sigaction sigchld_action;
-
- GError *error = NULL;
- int exit_status = 1;
-
- /* Trap the event of the child process terminating so we know to stop the
- server and exit */
- memset (&sigchld_action, 0, sizeof (sigchld_action));
- sigchld_action.sa_handler = sigchld_handler;
- sigchld_action.sa_flags = SA_RESETHAND;
- sigaction (SIGCHLD, &sigchld_action, NULL);
-
- /* Create our test server */
- handler = g_object_new (TYPE_TEST_CONTAINER_SERVICE_HANDLER,
- NULL);
- processor = g_object_new (T_TEST_TYPE_CONTAINER_SERVICE_PROCESSOR,
- "handler", handler,
- NULL);
- server_transport = g_object_new (THRIFT_TYPE_SERVER_SOCKET,
- "port", TEST_SERVER_PORT,
- NULL);
- transport_factory = g_object_new (THRIFT_TYPE_BUFFERED_TRANSPORT_FACTORY,
- NULL);
- protocol_factory = g_object_new (THRIFT_TYPE_BINARY_PROTOCOL_FACTORY,
- NULL);
-
- server = g_object_new (THRIFT_TYPE_SIMPLE_SERVER,
- "processor", processor,
- "server_transport", server_transport,
- "input_transport_factory", transport_factory,
- "output_transport_factory", transport_factory,
- "input_protocol_factory", protocol_factory,
- "output_protocol_factory", protocol_factory,
- NULL);
-
- /* Start the server */
- thrift_server_serve (server, &error);
-
- /* Make sure the server stopped only because it was interrupted (by the
- child process terminating) */
- g_assert (g_error_matches (error,
- THRIFT_SERVER_SOCKET_ERROR,
- THRIFT_SERVER_SOCKET_ERROR_ACCEPT));
-
- /* Free our resources */
- g_object_unref (server);
- g_object_unref (transport_factory);
- g_object_unref (protocol_factory);
- g_object_unref (server_transport);
-
- g_object_unref (processor);
- g_object_unref (handler);
-
- /* Wait for the child process to complete and return its exit status */
- g_assert (wait (&status) == pid);
- if (WIFEXITED (status))
- exit_status = WEXITSTATUS (status);
-
- return exit_status;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/72ea8afd/depends/thirdparty/thrift/lib/c_glib/test/testdebugproto.c
----------------------------------------------------------------------
diff --git a/depends/thirdparty/thrift/lib/c_glib/test/testdebugproto.c b/depends/thirdparty/thrift/lib/c_glib/test/testdebugproto.c
deleted file mode 100644
index 703dff0..0000000
--- a/depends/thirdparty/thrift/lib/c_glib/test/testdebugproto.c
+++ /dev/null
@@ -1,938 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#include <assert.h>
-#include <math.h>
-#include <string.h>
-#include <glib-object.h>
-
-#ifndef M_PI
-#define M_PI 3.1415926535897932385
-#endif
-
-#include <thrift/c_glib/protocol/thrift_protocol.h>
-#include <thrift/c_glib/protocol/thrift_binary_protocol.h>
-
-#include "gen-c_glib/t_test_debug_proto_test_types.h"
-#include "gen-c_glib/t_test_srv.h"
-#include "gen-c_glib/t_test_inherited.h"
-
-static void
-test_structs_doubles_create_and_destroy (void)
-{
- GObject *object = NULL;
-
- /* A Doubles structure can be created... */
- object = g_object_new (T_TEST_TYPE_DOUBLES, NULL);
-
- g_assert (object != NULL);
- g_assert (T_TEST_IS_DOUBLES (object));
-
- /* ...and destroyed */
- g_object_unref (object);
-}
-
-static void
-test_structs_doubles_initialize (void)
-{
- TTestDoubles *doubles = NULL;
- gdouble nan;
- gdouble inf;
- gdouble neginf;
- gdouble repeating;
- gdouble big;
- gdouble tiny;
- gdouble zero;
- gdouble negzero;
-
- /* Note there seems to be no way to get not-a-number ("NAN") values past
- GObject's range-checking, so that portion of the test has been commented
- out below. */
-
- /* A Doubles structure's members are available as GObject properties
- that can be initialized at construction... */
- doubles = g_object_new (T_TEST_TYPE_DOUBLES,
- /* "nan", 0 * INFINITY, */
- "inf", INFINITY,
- "neginf", -INFINITY,
- "repeating", 1.0 / 3,
- "big", G_MAXDOUBLE,
- "tiny", 10E-101,
- "zero", 1.0 * 0,
- "negzero", -1.0 * 0,
- NULL);
-
- g_assert (doubles != NULL);
-
- /* ...and later retrieved */
- g_object_get (doubles,
- "nan", &nan,
- "inf", &inf,
- "neginf", &neginf,
- "repeating", &repeating,
- "big", &big,
- "tiny", &tiny,
- "zero", &zero,
- "negzero", &negzero,
- NULL);
-
- /* g_assert_cmpint (isnan (nan), !=, 0); */
- g_assert_cmpint (isinf (inf), ==, 1);
- g_assert_cmpint (isinf (neginf), ==, -1);
-
- g_assert_cmpfloat (repeating, ==, 1.0 / 3);
- g_assert_cmpfloat (big, ==, G_MAXDOUBLE);
- g_assert_cmpfloat (tiny, ==, 10E-101);
- g_assert_cmpfloat (zero, ==, 1.0 * 0);
- g_assert_cmpfloat (negzero, ==, -1.0 * 0);
-
- g_object_unref (doubles);
-}
-
-static void
-test_structs_one_of_each_create_and_destroy (void)
-{
- GObject *object = NULL;
-
- /* A OneOfEach structure can be created... */
- object = g_object_new (T_TEST_TYPE_ONE_OF_EACH, NULL);
-
- g_assert (object != NULL);
- g_assert (T_TEST_IS_ONE_OF_EACH (object));
-
- /* ...and destroyed */
- g_object_unref (object);
-}
-
-static void
-test_structs_one_of_each_initialize_default_values (void)
-{
- TTestOneOfEach *one_of_each = NULL;
- gint a_bite;
- gint integer16;
- gint64 integer64;
- GArray *byte_list;
- GArray *i16_list;
- GArray *i64_list;
-
- /* A OneOfEach structure created with no explicit property values
- will hold the default values specified in the .thrift file */
- one_of_each = g_object_new (T_TEST_TYPE_ONE_OF_EACH, NULL);
-
- g_object_get (one_of_each,
- "a_bite", &a_bite,
- "integer16", &integer16,
- "integer64", &integer64,
- "byte_list", &byte_list,
- "i16_list", &i16_list,
- "i64_list", &i64_list,
- NULL);
-
- g_assert_cmpint (a_bite, ==, 0x7f);
- g_assert_cmpint (integer16, ==, 0x7fff);
- g_assert_cmpint (integer64, ==, 10000000000);
-
- g_assert (byte_list != NULL);
- g_assert_cmpint (byte_list->len, ==, 3);
- g_assert_cmpint (g_array_index (byte_list, gint8, 0), ==, 1);
- g_assert_cmpint (g_array_index (byte_list, gint8, 1), ==, 2);
- g_assert_cmpint (g_array_index (byte_list, gint8, 2), ==, 3);
-
- g_assert (i16_list != NULL);
- g_assert_cmpint (i16_list->len, ==, 3);
- g_assert_cmpint (g_array_index (i16_list, gint16, 0), ==, 1);
- g_assert_cmpint (g_array_index (i16_list, gint16, 1), ==, 2);
- g_assert_cmpint (g_array_index (i16_list, gint16, 2), ==, 3);
-
- g_assert (i64_list != NULL);
- g_assert_cmpint (i64_list->len, ==, 3);
- g_assert_cmpint (g_array_index (i64_list, gint64, 0), ==, 1);
- g_assert_cmpint (g_array_index (i64_list, gint64, 1), ==, 2);
- g_assert_cmpint (g_array_index (i64_list, gint64, 2), ==, 3);
-
- g_array_unref (i64_list);
- g_array_unref (i16_list);
- g_array_unref (byte_list);
- g_object_unref (one_of_each);
-}
-
-static void
-test_structs_one_of_each_initialize_specified_values (void)
-{
- static const gint8 initial_byte_list[5] = { 13, 21, 34, 55, 89 };
- static const gint16 initial_i16_list[5] = { 4181, 6765, 10946, 17711, 28657 };
- static const gint64 initial_i64_list[5] =
- {
- 1100087778366101931, 1779979416004714189, 2880067194370816120,
- 4660046610375530309, 7540113804746346429
- };
- static const guint8 initial_base64[8] =
- {
- 0x56, 0x47, 0x68, 0x79, 0x61, 0x57, 0x5a, 0x30
- };
-
- TTestOneOfEach *one_of_each;
- gboolean im_true;
- gboolean im_false;
- gint a_bite;
- gint integer16;
- gint integer32;
- gint64 integer64;
- double double_precision;
- gchar *some_characters;
- gchar *zomg_unicode;
- gboolean what_who;
- GByteArray *base64;
- GArray *byte_list;
- GArray *i16_list;
- GArray *i64_list;
-
- base64 = g_byte_array_new ();
- g_byte_array_append (base64, initial_base64, 8);
-
- byte_list = g_array_new (FALSE, FALSE, sizeof (gint8));
- g_array_append_vals (byte_list, initial_byte_list, 5);
-
- i16_list = g_array_new (FALSE, FALSE, sizeof (gint16));
- g_array_append_vals (i16_list, initial_i16_list, 5);
-
- i64_list = g_array_new (FALSE, FALSE, sizeof (gint64));
- g_array_append_vals (i64_list, initial_i64_list, 5);
-
- /* All of OneOfEach's properties can be set at construction... */
- one_of_each = g_object_new (T_TEST_TYPE_ONE_OF_EACH,
- "im_true", TRUE,
- "im_false", FALSE,
- "a_bite", 0x50,
- "integer16", 0x7e57,
- "integer32", 0xdeadbeef,
- "integer64", 0xfa15efacade15bad,
- "double_precision", M_PI,
- "some_characters", "Debug THIS!",
- "zomg_unicode", "\xd7\n\a\t",
- "what_who", TRUE,
- "base64", base64,
- "byte_list", byte_list,
- "i16_list", i16_list,
- "i64_list", i64_list,
- NULL);
- g_assert (one_of_each != NULL);
-
- g_array_unref (i64_list);
- i64_list = NULL;
- g_array_unref (i16_list);
- i16_list = NULL;
- g_array_unref (byte_list);
- byte_list = NULL;
- g_byte_array_unref (base64);
- base64 = NULL;
-
- /* ...and later retrieved */
- g_object_get (one_of_each,
- "im_true", &im_true,
- "im_false", &im_false,
- "a_bite", &a_bite,
- "integer16", &integer16,
- "integer32", &integer32,
- "integer64", &integer64,
- "double_precision", &double_precision,
- "some_characters", &some_characters,
- "zomg_unicode", &zomg_unicode,
- "what_who", &what_who,
- "base64", &base64,
- "byte_list", &byte_list,
- "i16_list", &i16_list,
- "i64_list", &i64_list,
- NULL);
-
- g_assert (im_true == TRUE);
- g_assert (im_false == FALSE);
-
- g_assert_cmphex (a_bite, ==, 0x50);
- g_assert_cmphex (integer16, ==, 0x7e57);
- g_assert_cmphex (integer32, ==, (gint32)0xdeadbeef);
- g_assert_cmphex (integer64, ==, 0xfa15efacade15bad);
-
- g_assert_cmpfloat (double_precision, ==, M_PI);
-
- g_assert_cmpstr (some_characters, ==, "Debug THIS!");
- g_assert_cmpstr (zomg_unicode, ==, "\xd7\n\a\t");
-
- g_assert (what_who == TRUE);
-
- g_assert_cmpint (base64->len, ==, 8);
- g_assert_cmpint (memcmp (base64->data,
- initial_base64,
- 8 * sizeof (guint8)), ==, 0);
-
- g_assert_cmpint (byte_list->len, ==, 5);
- g_assert_cmpint (memcmp (byte_list->data,
- initial_byte_list,
- 5 * sizeof (gint8)), ==, 0);
-
- g_assert_cmpint (i16_list->len, ==, 5);
- g_assert_cmpint (memcmp (i16_list->data,
- initial_i16_list,
- 5 * sizeof (gint16)), ==, 0);
-
- g_assert_cmpint (i64_list->len, ==, 5);
- g_assert_cmpint (memcmp (i64_list->data,
- initial_i64_list,
- 5 * sizeof (gint64)), ==, 0);
-
- g_array_unref (i64_list);
- g_array_unref (i16_list);
- g_array_unref (byte_list);
- g_byte_array_unref (base64);
-
- g_object_unref (one_of_each);
-}
-
-static void
-test_structs_one_of_each_properties_byte_list (void)
-{
- TTestOneOfEach *one_of_each;
- GArray *byte_list = NULL;
-
- one_of_each = g_object_new (T_TEST_TYPE_ONE_OF_EACH, NULL);
-
- /* OneOfEach's "byte_list" member is a list that holds eight-bit-wide integer
- values */
- g_object_get (one_of_each, "byte_list", &byte_list, NULL);
-
- g_assert (byte_list != NULL);
- g_assert_cmpint (g_array_get_element_size (byte_list), ==, sizeof (gint8));
-
- g_array_unref (byte_list);
- g_object_unref (one_of_each);
-}
-
-static void
-test_structs_one_of_each_properties_i16_list (void)
-{
- TTestOneOfEach *one_of_each;
- GArray *i16_list = NULL;
-
- one_of_each = g_object_new (T_TEST_TYPE_ONE_OF_EACH, NULL);
-
- /* OneOfEach's "i16_list" member is a list that holds sixteen-bit-wide integer
- values */
- g_object_get (one_of_each, "i16_list", &i16_list, NULL);
-
- g_assert (i16_list != NULL);
- g_assert_cmpint (g_array_get_element_size (i16_list), ==, sizeof (gint16));
-
- g_array_unref (i16_list);
- g_object_unref (one_of_each);
-}
-
-static void
-test_structs_one_of_each_properties_i64_list (void)
-{
- TTestOneOfEach *one_of_each;
- GArray *i64_list = NULL;
-
- one_of_each = g_object_new (T_TEST_TYPE_ONE_OF_EACH, NULL);
-
- /* OneOfEach's "i64_list" member is a list that holds sixty-four-bit-wide
- integer values */
- g_object_get (one_of_each, "i64_list", &i64_list, NULL);
-
- g_assert (i64_list != NULL);
- g_assert_cmpint (g_array_get_element_size (i64_list), ==, sizeof (gint64));
-
- g_array_unref (i64_list);
- g_object_unref (one_of_each);
-}
-
-static void
-test_structs_nesting_create_and_destroy (void)
-{
- GObject *object = NULL;
-
- /* A Nesting structure can be created... */
- object = g_object_new (T_TEST_TYPE_NESTING, NULL);
-
- g_assert (object != NULL);
- g_assert (T_TEST_IS_NESTING (object));
-
- /* ...and destroyed */
- g_object_unref (object);
-}
-
-static void
-test_structs_nesting_properties_my_bonk (void)
-{
- TTestNesting *nesting;
- TTestBonk *bonk = NULL;
- gint type;
- gchar *message;
-
- nesting = g_object_new (T_TEST_TYPE_NESTING, NULL);
-
- /* Nesting's "my_bonk" member is initialized with a new, default Bonk object
- during construction */
- g_object_get (nesting, "my_bonk", &bonk, NULL);
-
- g_assert (bonk != NULL);
- g_assert (T_TEST_IS_BONK (bonk));
-
- g_object_get (bonk,
- "type", &type,
- "message", &message,
- NULL);
-
- g_assert_cmpint (type, ==, 0);
- g_assert (message == NULL);
-
- g_object_unref (bonk);
- bonk = NULL;
-
- /* It can be replaced... */
- bonk = g_object_new (T_TEST_TYPE_BONK,
- "type", 100,
- "message", "Replacement Bonk",
- NULL);
- g_object_set (nesting, "my_bonk", bonk, NULL);
- g_object_unref (bonk);
- bonk = NULL;
-
- g_object_get (nesting, "my_bonk", &bonk, NULL);
-
- g_assert (bonk != NULL);
- g_assert (T_TEST_IS_BONK (bonk));
-
- g_object_get (bonk,
- "type", &type,
- "message", &message,
- NULL);
-
- g_assert_cmpint (type, ==, 100);
- g_assert_cmpstr (message, ==, "Replacement Bonk");
-
- g_free (message);
- g_object_unref (bonk);
- bonk = NULL;
-
- /* ...or set to null */
- g_object_set (nesting, "my_bonk", NULL, NULL);
- g_object_get (nesting, "my_bonk", &bonk, NULL);
-
- g_assert (bonk == NULL);
-
- g_object_unref (nesting);
-}
-
-static void
-test_structs_nesting_properties_my_ooe (void)
-{
- TTestNesting *nesting;
- TTestOneOfEach *one_of_each = NULL;
- gint a_bite;
- gint integer16;
-
- nesting = g_object_new (T_TEST_TYPE_NESTING, NULL);
-
- /* Nesting's "my_ooe" member is initialized with a new, default OneOfEach
- object during construction */
- g_object_get (nesting, "my_ooe", &one_of_each, NULL);
-
- g_assert (one_of_each != NULL);
- g_assert (T_TEST_IS_ONE_OF_EACH (one_of_each));
-
- g_object_get (one_of_each,
- "a_bite", &a_bite,
- "integer16", &integer16,
- NULL);
-
- g_assert_cmphex (a_bite, ==, 0x7f);
- g_assert_cmphex (integer16, ==, 0x7fff);
-
- g_object_unref (one_of_each);
- one_of_each = NULL;
-
- /* It can be replaced... */
- one_of_each = g_object_new (T_TEST_TYPE_ONE_OF_EACH,
- "a_bite", 0x50,
- "integer16", 0x5050,
- NULL);
- g_object_set (nesting, "my_ooe", one_of_each, NULL);
- g_object_unref (one_of_each);
- one_of_each = NULL;
-
- g_object_get (nesting, "my_ooe", &one_of_each, NULL);
-
- g_assert (one_of_each != NULL);
- g_assert (T_TEST_IS_ONE_OF_EACH (one_of_each));
-
- g_object_get (one_of_each,
- "a_bite", &a_bite,
- "integer16", &integer16,
- NULL);
-
- g_assert_cmphex (a_bite, ==, 0x50);
- g_assert_cmphex (integer16, ==, 0x5050);
-
- g_object_unref (one_of_each);
- one_of_each = NULL;
-
- /* ...or set to null */
- g_object_set (nesting, "my_ooe", NULL, NULL);
- g_object_get (nesting, "my_ooe", &one_of_each, NULL);
-
- g_assert (one_of_each == NULL);
-
- g_object_unref (nesting);
-}
-
-static void
-test_structs_holy_moley_create_and_destroy (void)
-{
- GObject *object = NULL;
-
- /* A HolyMoley structure can be created... */
- object = g_object_new (T_TEST_TYPE_HOLY_MOLEY, NULL);
-
- g_assert (object != NULL);
- g_assert (T_TEST_IS_HOLY_MOLEY (object));
-
- /* ...and destroyed */
- g_object_unref (object);
-}
-
-static void
-test_structs_holy_moley_properties_big (void)
-{
- TTestHolyMoley *holy_moley;
- GPtrArray *big = NULL;
- gint a_bite = 0;
- gint integer16 = 0;
-
- holy_moley = g_object_new (T_TEST_TYPE_HOLY_MOLEY, NULL);
-
- /* A HolyMoley's "big" member is is initialized on construction */
- g_object_get (holy_moley, "big", &big, NULL);
-
- g_assert (big != NULL);
- g_assert_cmpint (big->len, ==, 0);
-
- /* It can be modified... */
- g_ptr_array_add (big,
- g_object_new (T_TEST_TYPE_ONE_OF_EACH,
- "a_bite", 0x50,
- "integer16", 0x5050,
- NULL));
-
- g_ptr_array_unref (big);
- big = NULL;
-
- g_object_get (holy_moley, "big", &big, NULL);
-
- g_assert_cmpint (big->len, ==, 1);
- g_object_get (g_ptr_array_index (big, 0),
- "a_bite", &a_bite,
- "integer16", &integer16,
- NULL);
-
- g_assert_cmphex (a_bite, ==, 0x50);
- g_assert_cmphex (integer16, ==, 0x5050);
-
- g_ptr_array_unref (big);
- big = NULL;
-
- /* ...replaced... */
- big = g_ptr_array_new_with_free_func (g_object_unref);
- g_ptr_array_add (big,
- g_object_new (T_TEST_TYPE_ONE_OF_EACH,
- "a_bite", 0x64,
- "integer16", 0x1541,
- NULL));
-
- g_object_set (holy_moley, "big", big, NULL);
-
- g_ptr_array_unref (big);
- big = NULL;
-
- g_object_get (holy_moley, "big", &big, NULL);
-
- g_assert_cmpint (big->len, ==, 1);
- g_object_get (g_ptr_array_index (big, 0),
- "a_bite", &a_bite,
- "integer16", &integer16,
- NULL);
-
- g_assert_cmphex (a_bite, ==, 0x64);
- g_assert_cmphex (integer16, ==, 0x1541);
-
- g_ptr_array_unref (big);
- big = NULL;
-
- /* ...or set to NULL */
- g_object_set (holy_moley, "big", NULL, NULL);
- g_object_get (holy_moley, "big", &big, NULL);
-
- g_assert (big == NULL);
-
- g_object_unref (holy_moley);
-}
-
-static void
-test_structs_holy_moley_properties_contain (void)
-{
- static gchar *strings[2] = { "Apache", "Thrift" };
-
- TTestHolyMoley *holy_moley;
- GHashTable *contain = NULL;
- GPtrArray *string_list;
- GList *key_list;
-
- holy_moley = g_object_new (T_TEST_TYPE_HOLY_MOLEY, NULL);
-
- /* A HolyMoley's "contain" member is initialized on construction */
- g_object_get (holy_moley, "contain", &contain, NULL);
-
- g_assert (contain != NULL);
- g_assert_cmpint (g_hash_table_size (contain), ==, 0);
-
- /* It can be modified... */
- string_list = g_ptr_array_new ();
- g_ptr_array_add (string_list, strings[0]);
- g_ptr_array_add (string_list, strings[1]);
-
- g_hash_table_insert (contain, string_list, NULL);
- string_list = NULL;
-
- g_hash_table_unref (contain);
- contain = NULL;
-
- g_object_get (holy_moley, "contain", &contain, NULL);
-
- g_assert_cmpint (g_hash_table_size (contain), ==, 1);
-
- key_list = g_hash_table_get_keys (contain);
- string_list = g_list_nth_data (key_list, 0);
-
- g_assert_cmpint (string_list->len, ==, 2);
- g_assert_cmpstr (g_ptr_array_index (string_list, 0), ==, "Apache");
- g_assert_cmpstr (g_ptr_array_index (string_list, 1), ==, "Thrift");
-
- g_list_free (key_list);
- g_hash_table_unref (contain);
- contain = NULL;
-
- /* ...replaced... */
- contain = g_hash_table_new_full (g_direct_hash,
- g_direct_equal,
- (GDestroyNotify) g_ptr_array_unref,
- NULL);
- g_object_set (holy_moley, "contain", contain, NULL);
- g_hash_table_unref (contain);
- contain = NULL;
-
- g_object_get (holy_moley, "contain", &contain, NULL);
-
- g_assert_cmpint (g_hash_table_size (contain), ==, 0);
-
- g_hash_table_unref (contain);
- contain = NULL;
-
- /* ...or set to NULL */
- g_object_set (holy_moley, "contain", NULL, NULL);
- g_object_get (holy_moley, "contain", &contain, NULL);
-
- g_assert (contain == NULL);
-
- g_object_unref (holy_moley);
-}
-
-static void
-test_structs_holy_moley_properties_bonks (void)
-{
- TTestHolyMoley *holy_moley;
- GHashTable *bonks = NULL;
- GPtrArray *bonk_list = NULL;
- TTestBonk *bonk = NULL;
- gint type;
- gchar *message;
- GList *key_list;
-
- holy_moley = g_object_new (T_TEST_TYPE_HOLY_MOLEY, NULL);
-
- /* A HolyMoley's "bonks" member is initialized on construction */
- g_object_get (holy_moley, "bonks", &bonks, NULL);
-
- g_assert (bonks != NULL);
- g_assert_cmpint (g_hash_table_size (bonks), ==, 0);
-
- /* It can be modified... */
- bonk = g_object_new (T_TEST_TYPE_BONK,
- "type", 100,
- "message", "Sample Bonk",
- NULL);
- bonk_list = g_ptr_array_new_with_free_func (g_object_unref);
- g_ptr_array_add (bonk_list, bonk);
- bonk = NULL;
-
- g_hash_table_insert (bonks, g_strdup ("Sample Bonks"), bonk_list);
- bonk_list = NULL;
-
- g_hash_table_unref (bonks);
- bonks = NULL;
-
- g_object_get (holy_moley, "bonks", &bonks, NULL);
-
- g_assert_cmpint (g_hash_table_size (bonks), ==, 1);
-
- key_list = g_hash_table_get_keys (bonks);
- bonk_list = g_hash_table_lookup (bonks, g_list_nth_data (key_list, 0));
-
- g_assert_cmpint (bonk_list->len, ==, 1);
-
- bonk = (g_ptr_array_index (bonk_list, 0));
- g_object_get (bonk,
- "type", &type,
- "message", &message,
- NULL);
-
- g_assert_cmpint (type, ==, 100);
- g_assert_cmpstr (message, ==, "Sample Bonk");
-
- bonk = NULL;
- g_free (message);
- g_list_free (key_list);
- g_hash_table_unref (bonks);
- bonks = NULL;
-
- /* ...replaced... */
- bonks = g_hash_table_new_full (g_str_hash,
- g_str_equal,
- g_free,
- (GDestroyNotify) g_ptr_array_unref);
- g_object_set (holy_moley, "bonks", bonks, NULL);
- g_hash_table_unref (bonks);
- bonks = NULL;
-
- g_object_get (holy_moley, "bonks", &bonks, NULL);
-
- g_assert_cmpint (g_hash_table_size (bonks), ==, 0);
-
- g_hash_table_unref (bonks);
- bonks = NULL;
-
- /* ...or set to NULL */
- g_object_set (holy_moley, "bonks", NULL, NULL);
- g_object_get (holy_moley, "bonks", &bonks, NULL);
-
- g_assert (bonks == NULL);
-
- g_object_unref (holy_moley);
-}
-
-static void
-test_structs_empty (void)
-{
- GObject *object = NULL;
- GParamSpec **properties;
- guint property_count;
-
- /* An Empty structure can be created */
- object = g_object_new (T_TEST_TYPE_EMPTY, NULL);
-
- g_assert (object != NULL);
- g_assert (T_TEST_IS_EMPTY (object));
-
- /* An Empty structure has no members and thus no properties */
- properties = g_object_class_list_properties (G_OBJECT_GET_CLASS (object),
- &property_count);
- g_assert_cmpint (property_count, ==, 0);
- g_free (properties);
-
- /* An Empty structure can be destroyed */
- g_object_unref (object);
-}
-
-static void
-test_structs_wrapper_create_and_destroy (void)
-{
- GObject *object = NULL;
-
- /* A Wrapper structure can be created... */
- object = g_object_new (T_TEST_TYPE_EMPTY, NULL);
-
- g_assert (object != NULL);
- g_assert (T_TEST_IS_EMPTY (object));
-
- /* ...and destroyed */
- g_object_unref (object);
-}
-
-static void
-test_structs_wrapper_properties_foo (void) {
- TTestWrapper *wrapper;
- TTestEmpty *foo;
-
- wrapper = g_object_new (T_TEST_TYPE_WRAPPER, NULL);
-
- /* A Wrapper structure has one member, "foo", which is an Empty
- structure initialized during construction */
- g_object_get (wrapper, "foo", &foo, NULL);
-
- g_assert (foo != NULL);
- g_assert (T_TEST_IS_EMPTY (foo));
-
- g_object_unref (foo);
- foo = NULL;
-
- /* A Wrapper's foo property can be replaced... */
- foo = g_object_new (T_TEST_TYPE_EMPTY, NULL);
- g_object_set (wrapper, "foo", foo, NULL);
-
- g_object_unref (foo);
- foo = NULL;
-
- g_object_get (wrapper, "foo", &foo, NULL);
- g_assert (foo != NULL);
- g_assert (T_TEST_IS_EMPTY (foo));
-
- g_object_unref (foo);
- foo = NULL;
-
- /* ...or set to NULL */
- g_object_set (wrapper, "foo", NULL, NULL);
- g_object_get (wrapper, "foo", &foo, NULL);
-
- g_assert (foo == NULL);
-
- g_object_unref (wrapper);
-}
-
-static void
-test_services_inherited (void)
-{
- ThriftProtocol *protocol;
- TTestInheritedClient *inherited_client;
- GObject *input_protocol, *output_protocol;
-
- protocol = g_object_new (THRIFT_TYPE_BINARY_PROTOCOL, NULL);
- inherited_client = g_object_new (T_TEST_TYPE_INHERITED_CLIENT,
- NULL);
-
- /* TTestInheritedClient inherits from TTestSrvClient */
- assert (g_type_is_a (T_TEST_TYPE_INHERITED_CLIENT,
- T_TEST_TYPE_SRV_CLIENT));
-
- /* TTestInheritedClient implements TTestSrvClient's interface */
- assert (g_type_is_a (T_TEST_TYPE_INHERITED_CLIENT,
- T_TEST_TYPE_SRV_IF));
-
- /* TTestInheritedClient's inherited properties can be set and retrieved */
- g_object_set (inherited_client,
- "input_protocol", protocol,
- "output_protocol", protocol,
- NULL);
-
- g_object_get (inherited_client,
- "input_protocol", &input_protocol,
- "output_protocol", &output_protocol,
- NULL);
-
- assert (input_protocol == G_OBJECT(protocol));
- assert (output_protocol == G_OBJECT(protocol));
-
- g_object_unref (output_protocol);
- g_object_unref (input_protocol);
- g_object_unref (inherited_client);
- g_object_unref (protocol);
-}
-
-int
-main(int argc, char *argv[])
-{
-#if (!GLIB_CHECK_VERSION (2, 36, 0))
- g_type_init ();
-#endif
-
- g_test_init (&argc, &argv, NULL);
-
- g_test_add_func
- ("/testdebugproto/DebugProto/Structs/Doubles/CreateAndDestroy",
- test_structs_doubles_create_and_destroy);
- g_test_add_func
- ("/testdebugproto/DebugProto/Structs/Doubles/Initialize",
- test_structs_doubles_initialize);
-
- g_test_add_func
- ("/testdebugproto/DebugProto/Structs/OneOfEach/CreateAndDestroy",
- test_structs_one_of_each_create_and_destroy);
- g_test_add_func
- ("/testdebugproto/DebugProto/Structs/OneOfEach/Initialize/DefaultValues",
- test_structs_one_of_each_initialize_default_values);
- g_test_add_func
- ("/testdebugproto/DebugProto/Structs/OneOfEach/Initialize/SpecifiedValues",
- test_structs_one_of_each_initialize_specified_values);
- g_test_add_func
- ("/testdebugproto/DebugProto/Structs/OneOfEach/Properties/byte_list",
- test_structs_one_of_each_properties_byte_list);
- g_test_add_func
- ("/testdebugproto/DebugProto/Structs/OneOfEach/Properties/i16_list",
- test_structs_one_of_each_properties_i16_list);
- g_test_add_func
- ("/testdebugproto/DebugProto/Structs/OneOfEach/Properties/i64_list",
- test_structs_one_of_each_properties_i64_list);
-
- g_test_add_func
- ("/testdebugproto/DebugProto/Structs/Nesting/CreateAndDestroy",
- test_structs_nesting_create_and_destroy);
- g_test_add_func
- ("/testdebugproto/DebugProto/Structs/Nesting/Properties/my_bonk",
- test_structs_nesting_properties_my_bonk);
- g_test_add_func
- ("/testdebugproto/DebugProto/Structs/Nesting/Properties/my_ooe",
- test_structs_nesting_properties_my_ooe);
-
- g_test_add_func
- ("/testdebugproto/DebugProto/Structs/HolyMoley/CreateAndDestroy",
- test_structs_holy_moley_create_and_destroy);
- g_test_add_func
- ("/testdebugproto/DebugProto/Structs/HolyMoley/Properties/big",
- test_structs_holy_moley_properties_big);
- g_test_add_func
- ("/testdebugproto/DebugProto/Structs/HolyMoley/Properties/contain",
- test_structs_holy_moley_properties_contain);
- g_test_add_func
- ("/testdebugproto/DebugProto/Structs/HolyMoley/Properties/bonks",
- test_structs_holy_moley_properties_bonks);
-
- g_test_add_func
- ("/testdebugproto/DebugProto/Structs/Empty",
- test_structs_empty);
-
- g_test_add_func
- ("/testdebugproto/DebugProto/Structs/Wrapper/CreateAndDestroy",
- test_structs_wrapper_create_and_destroy);
- g_test_add_func
- ("/testdebugproto/DebugProto/Structs/Wrapper/Properties/foo",
- test_structs_wrapper_properties_foo);
-
- g_test_add_func
- ("/testdebugproto/DebugProto/Services/Inherited",
- test_services_inherited);
-
- return g_test_run ();
-}
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/72ea8afd/depends/thirdparty/thrift/lib/c_glib/test/testframedtransport.c
----------------------------------------------------------------------
diff --git a/depends/thirdparty/thrift/lib/c_glib/test/testframedtransport.c b/depends/thirdparty/thrift/lib/c_glib/test/testframedtransport.c
deleted file mode 100755
index d50ff23..0000000
--- a/depends/thirdparty/thrift/lib/c_glib/test/testframedtransport.c
+++ /dev/null
@@ -1,284 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#include <assert.h>
-#include <netdb.h>
-#include <sys/wait.h>
-
-#include <thrift/c_glib/transport/thrift_transport.h>
-#include <thrift/c_glib/transport/thrift_socket.h>
-#include <thrift/c_glib/transport/thrift_server_transport.h>
-#include <thrift/c_glib/transport/thrift_server_socket.h>
-
-#define TEST_DATA { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j' }
-
-#include "../src/thrift/c_glib/transport/thrift_framed_transport.c"
-
-static void thrift_server (const int port);
-
-/* test object creation and destruction */
-static void
-test_create_and_destroy(void)
-{
- ThriftTransport *transport = NULL;
- guint r_buf_size = 0;
- guint w_buf_size = 0;
-
- GObject *object = NULL;
- object = g_object_new (THRIFT_TYPE_FRAMED_TRANSPORT, NULL);
- assert (object != NULL);
- g_object_get (G_OBJECT (object), "transport", &transport,
- "r_buf_size", &r_buf_size,
- "w_buf_size", &w_buf_size, NULL);
- g_object_unref (object);
-}
-
-static void
-test_open_and_close(void)
-{
- ThriftSocket *tsocket = NULL;
- ThriftTransport *transport = NULL;
- GError *err = NULL;
-
- /* create a ThriftSocket */
- tsocket = g_object_new (THRIFT_TYPE_SOCKET, "hostname", "localhost",
- "port", 51188, NULL);
-
- /* create a BufferedTransport wrapper of the Socket */
- transport = g_object_new (THRIFT_TYPE_FRAMED_TRANSPORT,
- "transport", THRIFT_TRANSPORT (tsocket), NULL);
-
- /* this shouldn't work */
- assert (thrift_framed_transport_open (transport, NULL) == FALSE);
- assert (thrift_framed_transport_is_open (transport) == TRUE);
- assert (thrift_framed_transport_close (transport, NULL) == TRUE);
- g_object_unref (transport);
- g_object_unref (tsocket);
-
- /* try and underlying socket failure */
- tsocket = g_object_new (THRIFT_TYPE_SOCKET, "hostname", "localhost.broken",
- NULL);
-
- /* create a BufferedTransport wrapper of the Socket */
- transport = g_object_new (THRIFT_TYPE_FRAMED_TRANSPORT,
- "transport", THRIFT_TRANSPORT (tsocket), NULL);
-
- assert (thrift_framed_transport_open (transport, &err) == FALSE);
- g_object_unref (transport);
- g_object_unref (tsocket);
- g_error_free (err);
- err = NULL;
-}
-
-static void
-test_read_and_write(void)
-{
- int status;
- pid_t pid;
- ThriftSocket *tsocket = NULL;
- ThriftTransport *transport = NULL;
- int port = 51199;
- guchar buf[10] = TEST_DATA; /* a buffer */
-
- pid = fork ();
- assert ( pid >= 0 );
-
- if ( pid == 0 )
- {
- /* child listens */
- thrift_server (port);
- exit (0);
- } else {
- /* parent connects, wait a bit for the socket to be created */
- sleep (1);
-
- tsocket = g_object_new (THRIFT_TYPE_SOCKET, "hostname", "localhost",
- "port", port, NULL);
- transport = g_object_new (THRIFT_TYPE_FRAMED_TRANSPORT,
- "transport", THRIFT_TRANSPORT (tsocket),
- "w_buf_size", 4, NULL);
-
- assert (thrift_framed_transport_open (transport, NULL) == TRUE);
- assert (thrift_framed_transport_is_open (transport));
-
- /* write 10 bytes */
- thrift_framed_transport_write (transport, buf, 10, NULL);
- thrift_framed_transport_flush (transport, NULL);
-
- thrift_framed_transport_write (transport, buf, 1, NULL);
- thrift_framed_transport_flush (transport, NULL);
-
- thrift_framed_transport_write (transport, buf, 10, NULL);
- thrift_framed_transport_flush (transport, NULL);
-
- thrift_framed_transport_write (transport, buf, 10, NULL);
- thrift_framed_transport_flush (transport, NULL);
-
- thrift_framed_transport_write_end (transport, NULL);
- thrift_framed_transport_flush (transport, NULL);
- thrift_framed_transport_close (transport, NULL);
-
- g_object_unref (transport);
- g_object_unref (tsocket);
-
- assert ( wait (&status) == pid );
- assert ( status == 0 );
- }
-}
-
-/* test reading from the transport after the peer has unexpectedly
- closed the connection */
-static void
-test_read_after_peer_close(void)
-{
- int status;
- pid_t pid;
- int port = 51199;
- GError *err = NULL;
-
- pid = fork ();
- g_assert (pid >= 0);
-
- if (pid == 0)
- {
- ThriftServerTransport *server_transport = NULL;
- ThriftTransport *client_transport = NULL;
-
- /* child listens */
- server_transport = g_object_new (THRIFT_TYPE_SERVER_SOCKET,
- "port", port,
- NULL);
- g_assert (server_transport != NULL);
-
- thrift_server_transport_listen (server_transport, &err);
- g_assert (err == NULL);
-
- /* wrap the client transport in a ThriftFramedTransport */
- client_transport = g_object_new
- (THRIFT_TYPE_FRAMED_TRANSPORT,
- "transport", thrift_server_transport_accept (server_transport, &err),
- "r_buf_size", 0,
- NULL);
- g_assert (err == NULL);
- g_assert (client_transport != NULL);
-
- /* close the connection immediately after the client connects */
- thrift_transport_close (client_transport, NULL);
-
- g_object_unref (client_transport);
- g_object_unref (server_transport);
-
- exit (0);
- } else {
- ThriftSocket *tsocket = NULL;
- ThriftTransport *transport = NULL;
- guchar buf[10]; /* a buffer */
-
- /* parent connects, wait a bit for the socket to be created */
- sleep (1);
-
- tsocket = g_object_new (THRIFT_TYPE_SOCKET,
- "hostname", "localhost",
- "port", port,
- NULL);
- transport = g_object_new (THRIFT_TYPE_FRAMED_TRANSPORT,
- "transport", THRIFT_TRANSPORT (tsocket),
- "w_buf_size", 0,
- NULL);
-
- g_assert (thrift_transport_open (transport, NULL) == TRUE);
- g_assert (thrift_transport_is_open (transport));
-
- /* attempting to read from the transport after the peer has closed
- the connection fails gracefully without generating a critical
- warning or segmentation fault */
- thrift_transport_read (transport, buf, 10, &err);
- g_assert (err != NULL);
-
- g_error_free (err);
- err = NULL;
-
- thrift_transport_read_end (transport, &err);
- g_assert (err == NULL);
-
- thrift_transport_close (transport, &err);
- g_assert (err == NULL);
-
- g_object_unref (transport);
- g_object_unref (tsocket);
-
- g_assert (wait (&status) == pid);
- g_assert (status == 0);
- }
-}
-
-static void
-thrift_server (const int port)
-{
- int bytes = 0;
- ThriftServerTransport *transport = NULL;
- ThriftTransport *client = NULL;
- guchar buf[12]; /* a buffer */
- guchar match[10] = TEST_DATA;
-
- ThriftServerSocket *tsocket = g_object_new (THRIFT_TYPE_SERVER_SOCKET,
- "port", port, NULL);
-
- transport = THRIFT_SERVER_TRANSPORT (tsocket);
- thrift_server_transport_listen (transport, NULL);
-
- /* wrap the client in a BufferedTransport */
- client = g_object_new (THRIFT_TYPE_FRAMED_TRANSPORT, "transport",
- thrift_server_transport_accept (transport, NULL),
- "r_buf_size", 5, NULL);
- assert (client != NULL);
-
- /* read 10 bytes */
- bytes = thrift_framed_transport_read (client, buf, 10, NULL);
- assert (bytes == 10); /* make sure we've read 10 bytes */
- assert ( memcmp (buf, match, 10) == 0 ); /* make sure what we got matches */
-
- bytes = thrift_framed_transport_read (client, buf, 6, NULL);
- bytes = thrift_framed_transport_read (client, buf, 5, NULL);
- bytes = thrift_framed_transport_read (client, buf, 1, NULL);
-
- bytes = thrift_framed_transport_read (client, buf, 12, NULL);
-
- thrift_framed_transport_read_end (client, NULL);
- thrift_framed_transport_close (client, NULL);
- g_object_unref (client);
- g_object_unref (tsocket);
-}
-
-int
-main(int argc, char *argv[])
-{
-#if (!GLIB_CHECK_VERSION (2, 36, 0))
- g_type_init();
-#endif
-
- g_test_init (&argc, &argv, NULL);
-
- g_test_add_func ("/testframedtransport/CreateAndDestroy", test_create_and_destroy);
- g_test_add_func ("/testframedtransport/OpenAndClose", test_open_and_close);
- g_test_add_func ("/testframedtransport/ReadAndWrite", test_read_and_write);
- g_test_add_func ("/testframedtransport/ReadAfterPeerClose", test_read_after_peer_close);
-
- return g_test_run ();
-}
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/72ea8afd/depends/thirdparty/thrift/lib/c_glib/test/testmemorybuffer.c
----------------------------------------------------------------------
diff --git a/depends/thirdparty/thrift/lib/c_glib/test/testmemorybuffer.c b/depends/thirdparty/thrift/lib/c_glib/test/testmemorybuffer.c
deleted file mode 100755
index 5c75273..0000000
--- a/depends/thirdparty/thrift/lib/c_glib/test/testmemorybuffer.c
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#include <assert.h>
-#include <netdb.h>
-
-#include <thrift/c_glib/transport/thrift_transport.h>
-#include <thrift/c_glib/transport/thrift_socket.h>
-#include <thrift/c_glib/transport/thrift_server_transport.h>
-#include <thrift/c_glib/transport/thrift_server_socket.h>
-
-#define TEST_DATA { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j' }
-
-#include "../src/thrift/c_glib/transport/thrift_memory_buffer.c"
-
-/* test object creation and destruction */
-static void
-test_create_and_destroy(void)
-{
- GObject *object = NULL;
- object = g_object_new (THRIFT_TYPE_MEMORY_BUFFER, NULL);
- assert (object != NULL);
- g_object_unref (object);
-}
-
-static void
-test_open_and_close(void)
-{
- ThriftMemoryBuffer *tbuffer = NULL;
-
- /* create a ThriftMemoryBuffer */
- tbuffer = g_object_new (THRIFT_TYPE_MEMORY_BUFFER, NULL);
-
- /* this shouldn't work */
- assert (thrift_memory_buffer_open (THRIFT_TRANSPORT (tbuffer), NULL) == TRUE);
- assert (thrift_memory_buffer_is_open (THRIFT_TRANSPORT (tbuffer)) == TRUE);
- assert (thrift_memory_buffer_close (THRIFT_TRANSPORT (tbuffer), NULL) == TRUE);
- g_object_unref (tbuffer);
-}
-
-static void
-test_read_and_write(void)
-{
- ThriftMemoryBuffer *tbuffer = NULL;
- guchar buf[10] = TEST_DATA;
- guchar read[10];
- GError *error = NULL;
-
- tbuffer = g_object_new (THRIFT_TYPE_MEMORY_BUFFER, "buf_size", 5, NULL);
- assert (thrift_memory_buffer_write (THRIFT_TRANSPORT (tbuffer),
- (gpointer) buf,
- 10, &error) == FALSE);
- assert (error != NULL);
- g_error_free (error);
- error = NULL;
- g_object_unref (tbuffer);
-
- tbuffer = g_object_new (THRIFT_TYPE_MEMORY_BUFFER, "buf_size", 15, NULL);
- assert (thrift_memory_buffer_write (THRIFT_TRANSPORT (tbuffer),
- (gpointer) buf, 10, &error) == TRUE);
- assert (error == NULL);
-
- assert (thrift_memory_buffer_read (THRIFT_TRANSPORT (tbuffer),
- &read, 10, &error) > 0);
- assert (error == NULL);
-}
-
-int
-main(int argc, char *argv[])
-{
-#if (!GLIB_CHECK_VERSION (2, 36, 0))
- g_type_init();
-#endif
-
- g_test_init (&argc, &argv, NULL);
-
- g_test_add_func ("/testmemorybuffer/CreateAndDestroy", test_create_and_destroy);
- g_test_add_func ("/testmemorybuffer/OpenAndClose", test_open_and_close);
- g_test_add_func ("/testmemorybuffer/ReadAndWrite", test_read_and_write);
-
- return g_test_run ();
-}
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/72ea8afd/depends/thirdparty/thrift/lib/c_glib/test/testoptionalrequired.c
----------------------------------------------------------------------
diff --git a/depends/thirdparty/thrift/lib/c_glib/test/testoptionalrequired.c b/depends/thirdparty/thrift/lib/c_glib/test/testoptionalrequired.c
deleted file mode 100755
index ae0c3d2..0000000
--- a/depends/thirdparty/thrift/lib/c_glib/test/testoptionalrequired.c
+++ /dev/null
@@ -1,207 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#include <assert.h>
-#include <glib.h>
-
-#include <thrift/c_glib/thrift_struct.h>
-#include <thrift/c_glib/protocol/thrift_protocol.h>
-#include <thrift/c_glib/protocol/thrift_binary_protocol.h>
-#include <thrift/c_glib/transport/thrift_memory_buffer.h>
-#include "gen-c_glib/t_test_optional_required_test_types.h"
-
-#include "gen-c_glib/t_test_optional_required_test_types.c"
-
-static void
-write_to_read (ThriftStruct *w, ThriftStruct *r, GError **write_error,
- GError **read_error)
-{
- ThriftMemoryBuffer *tbuffer = NULL;
- ThriftProtocol *protocol = NULL;
-
- tbuffer = g_object_new (THRIFT_TYPE_MEMORY_BUFFER, NULL);
- protocol = g_object_new (THRIFT_TYPE_BINARY_PROTOCOL, "transport",
- tbuffer, NULL);
-
- thrift_struct_write (w, protocol, write_error);
- thrift_struct_read (r, protocol, read_error);
-
- g_object_unref (protocol);
- g_object_unref (tbuffer);
-}
-
-static void
-test_old_school1 (void)
-{
- TTestOldSchool *o = NULL;
-
- o = g_object_new (T_TEST_TYPE_OLD_SCHOOL, NULL);
- o->im_int = 10;
- o->im_str = g_strdup ("test");
- o->im_big = g_ptr_array_new ();
- g_ptr_array_free (o->im_big, TRUE);
- o->im_big = NULL;
- g_free (o->im_str);
- o->im_str = NULL;
- g_object_unref (o);
-}
-
-/**
- * Write to read with optional fields
- */
-static void
-test_simple (void)
-{
- TTestSimple *s1 = NULL, *s2 = NULL, *s3 = NULL;
-
- s1 = g_object_new (T_TEST_TYPE_SIMPLE, NULL);
- s2 = g_object_new (T_TEST_TYPE_SIMPLE, NULL);
- s3 = g_object_new (T_TEST_TYPE_SIMPLE, NULL);
-
- /* write-to-read with optional fields */
- s1->im_optional = 10;
- assert (s1->__isset_im_default == FALSE);
- assert (s1->__isset_im_optional == FALSE);
- write_to_read (THRIFT_STRUCT (s1), THRIFT_STRUCT (s2), NULL, NULL);
- assert (s2->__isset_im_default = TRUE);
- assert (s2->__isset_im_optional == FALSE);
- assert (s2->im_optional == 0);
-
- s1->__isset_im_optional = TRUE;
- write_to_read (THRIFT_STRUCT (s1), THRIFT_STRUCT (s3), NULL, NULL);
- assert (s3->__isset_im_default == TRUE);
- assert (s3->__isset_im_optional == TRUE);
- assert (s3->im_optional == 10);
-
- g_object_unref (s1);
- g_object_unref (s2);
-}
-
-/**
- * Writing between optional and default
- */
-static void
-test_tricky1 (void)
-{
- TTestTricky1 *t1 = NULL;
- TTestTricky2 *t2 = NULL;
-
- t1 = g_object_new (T_TEST_TYPE_TRICKY1, NULL);
- t2 = g_object_new (T_TEST_TYPE_TRICKY2, NULL);
-
- t2->im_optional = 10;
- write_to_read (THRIFT_STRUCT (t2), THRIFT_STRUCT (t1), NULL, NULL);
- write_to_read (THRIFT_STRUCT (t1), THRIFT_STRUCT (t2), NULL, NULL);
-
- assert (t1->__isset_im_default == FALSE);
- assert (t2->__isset_im_optional == TRUE);
- assert (t1->im_default == t2->im_optional);
- assert (t1->im_default == 0);
-
- g_object_unref (t1);
- g_object_unref (t2);
-}
-
-/**
- * Writing between default and required.
- */
-static void
-test_tricky2 (void)
-{
- TTestTricky1 *t1 = NULL;
- TTestTricky3 *t3 = NULL;
-
- t1 = g_object_new (T_TEST_TYPE_TRICKY1, NULL);
- t3 = g_object_new (T_TEST_TYPE_TRICKY3, NULL);
-
- write_to_read (THRIFT_STRUCT (t1), THRIFT_STRUCT (t3), NULL, NULL);
- write_to_read (THRIFT_STRUCT (t3), THRIFT_STRUCT (t1), NULL, NULL);
-
- assert (t1->__isset_im_default == TRUE);
-
- g_object_unref (t1);
- g_object_unref (t3);
-}
-
-/**
- * Writing between optional and required.
- */
-static void
-test_tricky3 (void)
-{
- TTestTricky2 *t2 = NULL;
- TTestTricky3 *t3 = NULL;
-
- t2 = g_object_new (T_TEST_TYPE_TRICKY2, NULL);
- t3 = g_object_new (T_TEST_TYPE_TRICKY3, NULL);
-
- t2->__isset_im_optional = TRUE;
-
- write_to_read (THRIFT_STRUCT (t2), THRIFT_STRUCT (t3), NULL, NULL);
- write_to_read (THRIFT_STRUCT (t3), THRIFT_STRUCT (t2), NULL, NULL);
-
- g_object_unref (t2);
- g_object_unref (t3);
-}
-
-/**
- * Catch an optional not set exception. To quote the
- * C++ test, "Mu-hu-ha-ha-ha!"
- */
-static void
-test_tricky4 (void)
-{
- TTestTricky2 *t2 = NULL;
- TTestTricky3 *t3 = NULL;
- GError *read_error = NULL;
-
- t2 = g_object_new (T_TEST_TYPE_TRICKY2, NULL);
- t3 = g_object_new (T_TEST_TYPE_TRICKY3, NULL);
-
- /* throws protocol exception */
- write_to_read (THRIFT_STRUCT (t2), THRIFT_STRUCT (t3), NULL, &read_error);
- assert (read_error != NULL);
- g_error_free (read_error);
-
- write_to_read (THRIFT_STRUCT (t3), THRIFT_STRUCT (t2), NULL, NULL);
-
- assert (t2->__isset_im_optional);
-
- g_object_unref (t2);
- g_object_unref (t3);
-}
-
-int
-main(int argc, char *argv[])
-{
-#if (!GLIB_CHECK_VERSION (2, 36, 0))
- g_type_init();
-#endif
-
- g_test_init (&argc, &argv, NULL);
-
- g_test_add_func ("/testoptionalrequired/OldSchool", test_old_school1);
- g_test_add_func ("/testoptionalrequired/Simple", test_simple);
- g_test_add_func ("/testoptionalrequired/Tricky1", test_tricky1);
- g_test_add_func ("/testoptionalrequired/Tricky2", test_tricky2);
- g_test_add_func ("/testoptionalrequired/Tricky3", test_tricky3);
- g_test_add_func ("/testoptionalrequired/Tricky4", test_tricky4);
-
- return g_test_run ();
-}
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/72ea8afd/depends/thirdparty/thrift/lib/c_glib/test/testsimpleserver.c
----------------------------------------------------------------------
diff --git a/depends/thirdparty/thrift/lib/c_glib/test/testsimpleserver.c b/depends/thirdparty/thrift/lib/c_glib/test/testsimpleserver.c
deleted file mode 100755
index 3af2eeb..0000000
--- a/depends/thirdparty/thrift/lib/c_glib/test/testsimpleserver.c
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#include <assert.h>
-#include <glib.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-
-#include <thrift/c_glib/thrift.h>
-#include <thrift/c_glib/processor/thrift_processor.h>
-#include <thrift/c_glib/transport/thrift_server_socket.h>
-
-#define TEST_PORT 51199
-
-#include <thrift/c_glib/server/thrift_simple_server.c>
-
-/* create a rudimentary processor */
-#define TEST_PROCESSOR_TYPE (test_processor_get_type ())
-
-struct _TestProcessor
-{
- ThriftProcessor parent;
-};
-typedef struct _TestProcessor TestProcessor;
-
-struct _TestProcessorClass
-{
- ThriftProcessorClass parent;
-};
-typedef struct _TestProcessorClass TestProcessorClass;
-
-G_DEFINE_TYPE(TestProcessor, test_processor, THRIFT_TYPE_PROCESSOR)
-
-gboolean
-test_processor_process (ThriftProcessor *processor, ThriftProtocol *in,
- ThriftProtocol *out, GError **error)
-{
- THRIFT_UNUSED_VAR (processor);
- THRIFT_UNUSED_VAR (in);
- THRIFT_UNUSED_VAR (out);
- THRIFT_UNUSED_VAR (error);
-
- return FALSE;
-}
-
-static void
-test_processor_init (TestProcessor *p)
-{
- THRIFT_UNUSED_VAR (p);
-}
-
-static void
-test_processor_class_init (TestProcessorClass *proc)
-{
- (THRIFT_PROCESSOR_CLASS(proc))->process = test_processor_process;
-}
-
-static void
-test_server (void)
-{
- int status;
- pid_t pid;
- TestProcessor *p = NULL;
- ThriftServerSocket *tss = NULL;
- ThriftSimpleServer *ss = NULL;
-
- p = g_object_new (TEST_PROCESSOR_TYPE, NULL);
- tss = g_object_new (THRIFT_TYPE_SERVER_SOCKET, "port", TEST_PORT, NULL);
- ss = g_object_new (THRIFT_TYPE_SIMPLE_SERVER, "processor", p,
- "server_transport", THRIFT_SERVER_TRANSPORT (tss), NULL);
-
- /* run the server in a child process */
- pid = fork ();
- assert (pid >= 0);
-
- if (pid == 0)
- {
- THRIFT_SERVER_GET_CLASS (THRIFT_SERVER (ss))->serve (THRIFT_SERVER (ss),
- NULL);
- exit (0);
- } else {
- sleep (5);
- kill (pid, SIGINT);
-
- g_object_unref (ss);
- g_object_unref (tss);
- g_object_unref (p);
- assert (wait (&status) == pid);
- assert (status == SIGINT);
- }
-}
-
-int
-main(int argc, char *argv[])
-{
-#if (!GLIB_CHECK_VERSION (2, 36, 0))
- g_type_init();
-#endif
-
- g_test_init (&argc, &argv, NULL);
-
- g_test_add_func ("/testsimpleserver/SimpleServer", test_server);
-
- return g_test_run ();
-}
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/72ea8afd/depends/thirdparty/thrift/lib/c_glib/test/teststruct.c
----------------------------------------------------------------------
diff --git a/depends/thirdparty/thrift/lib/c_glib/test/teststruct.c b/depends/thirdparty/thrift/lib/c_glib/test/teststruct.c
deleted file mode 100755
index 5d4baf3..0000000
--- a/depends/thirdparty/thrift/lib/c_glib/test/teststruct.c
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#include <assert.h>
-#include <glib-object.h>
-
-#include "../src/thrift/c_glib/thrift_struct.c"
-
-/* tests to ensure we can extend a ThriftStruct */
-
-struct _ThriftTestStruct
-{
- ThriftStruct parent;
-};
-typedef struct _ThriftTestStruct ThriftTestStruct;
-
-struct _ThriftTestStructClass
-{
- ThriftStructClass parent;
-};
-typedef struct _ThriftTestStructClass ThriftTestStructClass;
-
-GType thrift_test_struct_get_type (void);
-
-#define THRIFT_TYPE_TEST_STRUCT (thrift_test_struct_get_type ())
-#define THRIFT_TEST_STRUCT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), THRIFT_TYPE_TEST_STRUCT, ThriftTestStruct))
-#define THRIFT_TEST_STRUCT_CLASS(c) (G_TYPE_CHECK_CLASS_CAST ((c), THRIFT_TYPE_TEST_STRUCT, ThriftTestStructClass))
-#define THRIFT_IS_TEST_STRUCT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), THRIFT_TYPE_TEST_STRUCT))
-#define THRIFT_IS_TEST_STRUCT_CLASS(c) (G_TYPE_CHECK_CLASS_TYPE ((c), THRIFT_TYPE_TEST_STRUCT))
-#define THRIFT_TEST_STRUCT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), THRIFT_TYPE_TEST_STRUCT, ThriftTestStructClass))
-
-G_DEFINE_TYPE(ThriftTestStruct, thrift_test_struct, THRIFT_TYPE_STRUCT)
-
-gint32
-thrift_test_struct_read (ThriftStruct *object, ThriftProtocol *protocol,
- GError **error)
-{
- THRIFT_UNUSED_VAR (object);
- THRIFT_UNUSED_VAR (protocol);
- THRIFT_UNUSED_VAR (error);
-
- return 0;
-}
-
-gint32
-thrift_test_struct_write (ThriftStruct *object, ThriftProtocol *protocol,
- GError **error)
-{
- THRIFT_UNUSED_VAR (object);
- THRIFT_UNUSED_VAR (protocol);
- THRIFT_UNUSED_VAR (error);
-
- return 0;
-}
-
-static void
-thrift_test_struct_class_init (ThriftTestStructClass *cls)
-{
- ThriftStructClass *ts_cls = THRIFT_STRUCT_CLASS (cls);
- ts_cls->read = thrift_test_struct_read;
- ts_cls->write = thrift_test_struct_write;
-}
-
-static void
-thrift_test_struct_init (ThriftTestStruct *s)
-{
- THRIFT_UNUSED_VAR (s);
-}
-
-static void
-test_initialize_object (void)
-{
- ThriftTestStruct *t = NULL;
-
- t = g_object_new (THRIFT_TYPE_TEST_STRUCT, NULL);
- assert ( THRIFT_IS_STRUCT (t));
- thrift_struct_read (THRIFT_STRUCT (t), NULL, NULL);
- thrift_struct_write (THRIFT_STRUCT (t), NULL, NULL);
- thrift_test_struct_read (THRIFT_STRUCT (t), NULL, NULL);
- thrift_test_struct_write (THRIFT_STRUCT (t), NULL, NULL);
- g_object_unref (t);
-}
-
-int
-main(int argc, char *argv[])
-{
-#if (!GLIB_CHECK_VERSION (2, 36, 0))
- g_type_init();
-#endif
-
- g_test_init (&argc, &argv, NULL);
-
- g_test_add_func ("/teststruct/InitializeObject", test_initialize_object);
-
- return g_test_run ();
-}
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/72ea8afd/depends/thirdparty/thrift/lib/c_glib/test/testthrifttest.c
----------------------------------------------------------------------
diff --git a/depends/thirdparty/thrift/lib/c_glib/test/testthrifttest.c b/depends/thirdparty/thrift/lib/c_glib/test/testthrifttest.c
deleted file mode 100755
index 5f0f6e3..0000000
--- a/depends/thirdparty/thrift/lib/c_glib/test/testthrifttest.c
+++ /dev/null
@@ -1,31 +0,0 @@
-#include <assert.h>
-#include <netdb.h>
-
-#include <thrift/c_glib/transport/thrift_server_transport.h>
-#include <thrift/c_glib/transport/thrift_server_socket.h>
-
-static const char TEST_ADDRESS[] = "localhost";
-static const int TEST_PORT = 64444;
-
-static void
-test_thrift_server (void)
-{
- ThriftServerSocket *tsocket = g_object_new (THRIFT_TYPE_SERVER_SOCKET,
- "port", TEST_PORT, NULL);
-
- g_object_unref (tsocket);
-}
-
-int
-main(int argc, char *argv[])
-{
-#if (!GLIB_CHECK_VERSION (2, 36, 0))
- g_type_init();
-#endif
-
- g_test_init (&argc, &argv, NULL);
-
- g_test_add_func ("/testthrift/Server", test_thrift_server);
-
- return g_test_run ();
-}