From 4a369a0b6c7ddfa515c1604199a36aa410e3d2ec Mon Sep 17 00:00:00 2001 From: Xavier Claessens Date: Mon, 4 Jun 2018 21:53:00 -0400 Subject: [PATCH 1/3] Remove tests/gio-ls.c that never has been built --- tests/gio-ls.c | 114 ------------------------------------------------- 1 file changed, 114 deletions(-) delete mode 100644 tests/gio-ls.c diff --git a/tests/gio-ls.c b/tests/gio-ls.c deleted file mode 100644 index 9ae74d476..000000000 --- a/tests/gio-ls.c +++ /dev/null @@ -1,114 +0,0 @@ - -#include - -#define GETTEXT_PACKAGE "gio-ls" -#define N_(s) (s) -#define _(s) (s) - -enum -{ - SHOW_ALL, - SHOW_LONG -}; - -static void print_path (const gchar* path, guint32 flags); - -static gboolean show_all = FALSE; -static gboolean show_long = FALSE; - -int -main (int argc, char *argv[]) -{ - - GOptionContext *context = NULL; - static GOptionEntry options[] = - { - {"all", 'a', 0, G_OPTION_ARG_NONE, &show_all, - N_("do not hide entries"), NULL }, - {"long", 'l', 0, G_OPTION_ARG_NONE, &show_long, - N_("use a long listing format"), NULL }, - { NULL } - }; - GError *error = NULL; - int i; - - context = g_option_context_new(_("[FILE...]")); - g_option_context_add_main_entries (context, options, GETTEXT_PACKAGE); - - if (!g_option_context_parse (context, &argc, &argv, &error)) - { - g_print ("%s", error->message); - g_error_free (error); - - } - else - { - for (i = 1; i < argc; i++) - { - print_path (argv[i], (show_all ? SHOW_ALL : 0) | (show_long ? SHOW_LONG : 0)); - } - } - - g_option_context_free(context); - return 0; -} - -static void -print_path (const gchar* path, - guint32 flags) -{ - GFile *top; - const gchar *short_attrs = G_FILE_ATTRIBUTE_STANDARD_NAME; - const gchar *long_attrs = G_FILE_ATTRIBUTE_OWNER_USER "," G_FILE_ATTRIBUTE_OWNER_GROUP "," \ - "access:*,std:*"; - const gchar *attrs; - - if (flags & SHOW_LONG) - attrs = long_attrs; - else - attrs = short_attrs; - - top = g_file_new_for_path (path); - if (top) - { - GFileInfo *info; - GError *error = NULL; - GFileEnumerator *enumerator = g_file_enumerate_children (top, attrs, - G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS, NULL, &error); - if (error) - { - g_print ("%s", error->message); - g_error_free (error); - } - if (!enumerator) - return; - - while ((info = g_file_enumerator_next_file (enumerator, NULL, NULL)) != NULL) - { - const gchar *name = g_file_info_get_name (info); - - if (flags & SHOW_LONG) - { - const gchar *val; - - g_print ("%c%c%c%c ", - g_file_info_get_file_type (info) == G_FILE_TYPE_DIRECTORY ? 'd' : '-', - g_file_info_get_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_READ) ? 'r' : '-', - g_file_info_get_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE) ? 'w' : '-', - g_file_info_get_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_EXECUTE) ? 'x' : '-'); - - val = g_file_info_get_attribute_string (info, G_FILE_ATTRIBUTE_OWNER_USER); - g_print ("\t%15s", val ? val : "?user?"); - - val = g_file_info_get_attribute_string (info, G_FILE_ATTRIBUTE_OWNER_GROUP); - g_print ("\t%15s", val ? val : "?group?"); - } - - g_print ("\t%s\n", name ? name : "?noname?"); - - g_object_unref (info); - } - - g_object_unref (top); - } -} From b04cf01934b5def7f787631dd8d35e950e46df2d Mon Sep 17 00:00:00 2001 From: Xavier Claessens Date: Mon, 4 Jun 2018 22:18:02 -0400 Subject: [PATCH 2/3] Remove old tests not being built since 2012 Those tests are failing and are not built since commit d6a075b --- tests/gobject/ifacecheck.c | 163 -------------- tests/gobject/ifaceinherit.c | 230 ------------------- tests/gobject/ifaceinit.c | 421 ----------------------------------- 3 files changed, 814 deletions(-) delete mode 100644 tests/gobject/ifacecheck.c delete mode 100644 tests/gobject/ifaceinherit.c delete mode 100644 tests/gobject/ifaceinit.c diff --git a/tests/gobject/ifacecheck.c b/tests/gobject/ifacecheck.c deleted file mode 100644 index 369c546cd..000000000 --- a/tests/gobject/ifacecheck.c +++ /dev/null @@ -1,163 +0,0 @@ -/* GObject - GLib Type, Object, Parameter and Signal Library - * Copyright (C) 2001, 2003 Red Hat, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General - * Public License along with this library; if not, see . - */ - -#undef G_LOG_DOMAIN -#define G_LOG_DOMAIN "TestIfaceCheck" - -#undef G_DISABLE_ASSERT -#undef G_DISABLE_CHECKS -#undef G_DISABLE_CAST_CHECKS - -#include - -#include - -#include "testcommon.h" - -/* This test tests g_type_add_interface_check_func(), which allows - * installing a post-initialization check function. - */ - -#define TEST_TYPE_IFACE (test_iface_get_type ()) -#define TEST_IFACE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TEST_TYPE_IFACE, TestIfaceClass)) -typedef struct _TestIfaceClass TestIfaceClass; - -struct _TestIfaceClass -{ - GTypeInterface base_iface; - GString *history; -}; - -static void -test_iface_base_init (TestIfaceClass *iface) -{ - iface->history = g_string_new (iface->history ? iface->history->str : NULL); -} - -static DEFINE_IFACE(TestIface, test_iface, test_iface_base_init, NULL) - -/* - * TestObject1 - */ -#define TEST_TYPE_OBJECT1 (test_object1_get_type ()) -typedef struct _GObject TestObject1; -typedef struct _GObjectClass TestObject1Class; - -static DEFINE_TYPE_FULL (TestObject1, test_object1, - NULL, NULL, NULL, - G_TYPE_OBJECT, - INTERFACE (NULL, TEST_TYPE_IFACE)) - -/* - * TestObject2 - */ -#define TEST_TYPE_OBJECT2 (test_object2_get_type ()) -typedef struct _GObject TestObject2; -typedef struct _GObjectClass TestObject2Class; - -static DEFINE_TYPE_FULL (TestObject2, test_object2, - NULL, NULL, NULL, - G_TYPE_OBJECT, - INTERFACE (NULL, TEST_TYPE_IFACE)) - -/* - * TestObject3 - */ -#define TEST_TYPE_OBJECT3 (test_object3_get_type ()) -typedef struct _GObject TestObject3; -typedef struct _GObjectClass TestObject3Class; - -static DEFINE_TYPE_FULL (TestObject3, test_object3, - NULL, NULL, NULL, - G_TYPE_OBJECT, - INTERFACE (NULL, TEST_TYPE_IFACE)) - -/* - * TestObject4 - */ -#define TEST_TYPE_OBJECT4 (test_object4_get_type ()) -typedef struct _GObject TestObject4; -typedef struct _GObjectClass TestObject4Class; - - -static DEFINE_TYPE_FULL (TestObject4, test_object4, - NULL, NULL, NULL, - G_TYPE_OBJECT, {}) - -static void -check_func (gpointer check_data, - gpointer g_iface) -{ - TestIfaceClass *iface = g_iface; - - g_string_append (iface->history, check_data); -} - -int -main (int argc, - char *argv[]) -{ - TestIfaceClass *iface; - GObject *object; - char *string1 = "A"; - char *string2 = "B"; - - /* Basic check of interfaces added before class_init time - */ - g_type_add_interface_check (string1, check_func); - - object = g_object_new (TEST_TYPE_OBJECT1, NULL); - iface = TEST_IFACE_GET_CLASS (object); - g_assert (strcmp (iface->history->str, "A") == 0); - g_object_unref (object); - - /* Add a second check function - */ - g_type_add_interface_check (string2, check_func); - - object = g_object_new (TEST_TYPE_OBJECT2, NULL); - iface = TEST_IFACE_GET_CLASS (object); - g_assert (strcmp (iface->history->str, "AB") == 0); - g_object_unref (object); - - /* Remove the first check function - */ - g_type_remove_interface_check (string1, check_func); - - object = g_object_new (TEST_TYPE_OBJECT3, NULL); - iface = TEST_IFACE_GET_CLASS (object); - g_assert (strcmp (iface->history->str, "B") == 0); - g_object_unref (object); - - /* Test interfaces added after class_init time - */ - g_type_class_ref (TEST_TYPE_OBJECT4); - { - GInterfaceInfo const iface = { - NULL, NULL, NULL - }; - - g_type_add_interface_static (TEST_TYPE_OBJECT4, TEST_TYPE_IFACE, &iface); - } - - object = g_object_new (TEST_TYPE_OBJECT4, NULL); - iface = TEST_IFACE_GET_CLASS (object); - g_assert (strcmp (iface->history->str, "B") == 0); - g_object_unref (object); - - return 0; -} diff --git a/tests/gobject/ifaceinherit.c b/tests/gobject/ifaceinherit.c deleted file mode 100644 index d86b32de9..000000000 --- a/tests/gobject/ifaceinherit.c +++ /dev/null @@ -1,230 +0,0 @@ -/* GObject - GLib Type, Object, Parameter and Signal Library - * Copyright (C) 2001, 2003 Red Hat, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General - * Public License along with this library; if not, see . - */ - -#undef G_LOG_DOMAIN -#define G_LOG_DOMAIN "TestIfaceInherit" - -#undef G_DISABLE_ASSERT -#undef G_DISABLE_CHECKS -#undef G_DISABLE_CAST_CHECKS - -#include - -#include "testcommon.h" -#include "testmodule.h" - -/* This test tests inheritance of interface. We two object - * class BaseObject and DerivedObject we add an interface - * to BaseObject: - * - * I1) Before DerivedObject is registered - * I2) After DerivedObject is registered, but before - * DerivedObject is class initialized - * I3) During DerivedObject's class_init - * I4) After DerivedObject's class init - * - * We also do some tests of overriding. - * - * I5) We add an interface to BaseObject, then add the same - * interface to DerivedObject. (Note that this is only legal - * before DerivedObject's class_init; the results of - * g_type_interface_peek() are not allowed to change from one - * non-NULL vtable to another non-NULL vtable) - */ - -/* - * BaseObject, a parent class for DerivedObject - */ -#define BASE_TYPE_OBJECT (base_object_get_type ()) -typedef struct _BaseObject BaseObject; -typedef struct _BaseObjectClass BaseObjectClass; - -struct _BaseObject -{ - GObject parent_instance; -}; -struct _BaseObjectClass -{ - GObjectClass parent_class; -}; - -static GType base_object_get_type (void); -static GType derived_object_get_type (void); - -/* - * DerivedObject, the child class of DerivedObject - */ -#define DERIVED_TYPE_OBJECT (derived_object_get_type ()) -typedef struct _DerivedObject DerivedObject; -typedef struct _DerivedObjectClass DerivedObjectClass; - -struct _DerivedObject -{ - BaseObject parent_instance; -}; -struct _DerivedObjectClass -{ - BaseObjectClass parent_class; -}; - -/* - * The interfaces - */ -typedef struct _TestIfaceClass TestIfaceClass; -typedef struct _TestIfaceClass TestIface1Class; -typedef struct _TestIfaceClass TestIface2Class; -typedef struct _TestIfaceClass TestIface3Class; -typedef struct _TestIfaceClass TestIface4Class; -typedef struct _TestIfaceClass TestIface5Class; - -struct _TestIfaceClass -{ - GTypeInterface base_iface; - guint val; -}; - -static GType test_iface1_get_type (void); -static GType test_iface2_get_type (void); -static GType test_iface3_get_type (void); -static GType test_iface4_get_type (void); -static GType test_iface5_get_type (void); - -#define TEST_TYPE_IFACE1 (test_iface1_get_type ()) -#define TEST_TYPE_IFACE2 (test_iface2_get_type ()) -#define TEST_TYPE_IFACE3 (test_iface3_get_type ()) -#define TEST_TYPE_IFACE4 (test_iface4_get_type ()) -#define TEST_TYPE_IFACE5 (test_iface5_get_type ()) - -static DEFINE_IFACE (TestIface1, test_iface1, NULL, NULL) -static DEFINE_IFACE (TestIface2, test_iface2, NULL, NULL) -static DEFINE_IFACE (TestIface3, test_iface3, NULL, NULL) -static DEFINE_IFACE (TestIface4, test_iface4, NULL, NULL) -static DEFINE_IFACE (TestIface5, test_iface5, NULL, NULL) - -static void -add_interface (GType object_type, - GType iface_type, - GInterfaceInitFunc init_func) -{ - GInterfaceInfo iface_info = { NULL, NULL, NULL }; - - iface_info.interface_init = init_func; - - g_type_add_interface_static (object_type, iface_type, &iface_info); -} - -static void -init_base_interface (TestIfaceClass *iface) -{ - iface->val = 21; -} - -static void -add_base_interface (GType object_type, - GType iface_type) -{ - add_interface (object_type, iface_type, - (GInterfaceInitFunc)init_base_interface); -} - -static gboolean -interface_is_base (GType object_type, - GType iface_type) -{ - gpointer g_class = g_type_class_peek (object_type); - TestIfaceClass *iface = g_type_interface_peek (g_class, iface_type); - return iface && iface->val == 21; -} - -static void -init_derived_interface (TestIfaceClass *iface) -{ - iface->val = 42; -} - -static void -add_derived_interface (GType object_type, - GType iface_type) -{ - add_interface (object_type, iface_type, - (GInterfaceInitFunc)init_derived_interface); -} - -static gboolean -interface_is_derived (GType object_type, - GType iface_type) -{ - gpointer g_class = g_type_class_peek (object_type); - TestIfaceClass *iface = g_type_interface_peek (g_class, iface_type); - return iface && iface->val == 42; -} - -static void -derived_object_class_init (BaseObjectClass *class) -{ - add_base_interface (BASE_TYPE_OBJECT, TEST_TYPE_IFACE3); -} - -static DEFINE_TYPE(BaseObject, base_object, - NULL, NULL, NULL, - G_TYPE_OBJECT) -static DEFINE_TYPE(DerivedObject, derived_object, - derived_object_class_init, NULL, NULL, - BASE_TYPE_OBJECT) - -int -main (int argc, - char *argv[]) -{ - g_log_set_always_fatal (g_log_set_always_fatal (G_LOG_FATAL_MASK) | - G_LOG_LEVEL_WARNING | - G_LOG_LEVEL_CRITICAL); - - /* Register BaseObject */ - BASE_TYPE_OBJECT; - - add_base_interface (BASE_TYPE_OBJECT, TEST_TYPE_IFACE5); - - /* Class init BaseObject */ - g_type_class_ref (BASE_TYPE_OBJECT); - - add_base_interface (BASE_TYPE_OBJECT, TEST_TYPE_IFACE1); - - /* Register DerivedObject */ - DERIVED_TYPE_OBJECT; - - add_base_interface (BASE_TYPE_OBJECT, TEST_TYPE_IFACE2); - add_derived_interface (DERIVED_TYPE_OBJECT, TEST_TYPE_IFACE5); - - /* Class init DerivedObject */ - g_type_class_ref (DERIVED_TYPE_OBJECT); - - add_base_interface (BASE_TYPE_OBJECT, TEST_TYPE_IFACE4); - - /* Check that all the non-overridden interfaces were properly inherited - */ - g_assert (interface_is_base (DERIVED_TYPE_OBJECT, TEST_TYPE_IFACE1)); - g_assert (interface_is_base (DERIVED_TYPE_OBJECT, TEST_TYPE_IFACE2)); - g_assert (interface_is_base (DERIVED_TYPE_OBJECT, TEST_TYPE_IFACE3)); - g_assert (interface_is_base (DERIVED_TYPE_OBJECT, TEST_TYPE_IFACE4)); - - /* Check that all the overridden interfaces were properly overridden - */ - g_assert (interface_is_derived (DERIVED_TYPE_OBJECT, TEST_TYPE_IFACE5)); - - return 0; -} diff --git a/tests/gobject/ifaceinit.c b/tests/gobject/ifaceinit.c deleted file mode 100644 index c69e943d5..000000000 --- a/tests/gobject/ifaceinit.c +++ /dev/null @@ -1,421 +0,0 @@ -/* GObject - GLib Type, Object, Parameter and Signal Library - * Copyright (C) 2001, 2003 Red Hat, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General - * Public License along with this library; if not, see . - */ - -#undef G_LOG_DOMAIN -#define G_LOG_DOMAIN "TestIfaceInit" - -#undef G_DISABLE_ASSERT -#undef G_DISABLE_CHECKS -#undef G_DISABLE_CAST_CHECKS - -#include - -#include "testcommon.h" - -/* What this test tests is the ability to add interfaces dynamically; in - * particular adding interfaces to a class while that class is being - * initialized. - * - * The test defines 5 interfaces: - * - * - TestIface1 is added before the class is initialized - * - TestIface2 is added in base_object_base_init() - * - TestIface3 is added in test_iface1_base_init() - * - TestIface4 is added in test_object_class_init() - * - TestIface5 is added in test_object_test_iface1_init() - * - TestIface6 is added after the class is initialized - */ - -/* All 6 interfaces actually share the same class structure, though - * we use separate typedefs - */ -typedef struct _TestIfaceClass TestIfaceClass; - -struct _TestIfaceClass -{ - GTypeInterface base_iface; - guint val; - guint base_val; - guint default_val; -}; - -#define TEST_TYPE_IFACE1 (test_iface1_get_type ()) -#define TEST_IFACE1_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TEST_TYPE_IFACE1, TestIface1Class)) -typedef struct _TestIface1 TestIface1; -typedef struct _TestIfaceClass TestIface1Class; - -static void test_iface1_base_init (TestIface1Class *iface); -static void test_iface1_default_init (TestIface1Class *iface, gpointer class_data); - -static DEFINE_IFACE(TestIface1, test_iface1, test_iface1_base_init, test_iface1_default_init) - -#define TEST_TYPE_IFACE2 (test_iface2_get_type ()) -#define TEST_IFACE2_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TEST_TYPE_IFACE2, TestIface2Class)) -typedef struct _TestIface2 TestIface2; -typedef struct _TestIfaceClass TestIface2Class; - -static void test_iface2_base_init (TestIface2Class *iface); - -static DEFINE_IFACE(TestIface2, test_iface2, test_iface2_base_init, NULL) - -#define TEST_TYPE_IFACE3 (test_iface3_get_type ()) -#define TEST_IFACE3_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TEST_TYPE_IFACE3, TestIface3Class)) -typedef struct _TestIface3 TestIface3; -typedef struct _TestIfaceClass TestIface3Class; - -static void test_iface3_base_init (TestIface3Class *iface); - -static DEFINE_IFACE(TestIface3, test_iface3, test_iface3_base_init, NULL) - -#define TEST_TYPE_IFACE4 (test_iface4_get_type ()) -#define TEST_IFACE4_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TEST_TYPE_IFACE4, TestIface4Class)) -typedef struct _TestIface4 TestIface4; -typedef struct _TestIfaceClass TestIface4Class; - -static void test_iface4_base_init (TestIface4Class *iface); - -static DEFINE_IFACE(TestIface4, test_iface4, test_iface4_base_init, NULL) - -#define TEST_TYPE_IFACE5 (test_iface5_get_type ()) -#define TEST_IFACE5_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TEST_TYPE_IFACE5, TestIface5Class)) -typedef struct _TestIface5 TestIface5; -typedef struct _TestIfaceClass TestIface5Class; - -static void test_iface5_base_init (TestIface5Class *iface); - -static DEFINE_IFACE(TestIface5, test_iface5, test_iface5_base_init, NULL) - -#define TEST_TYPE_IFACE6 (test_iface6_get_type ()) -#define TEST_IFACE6_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TEST_TYPE_IFACE6, TestIface6Class)) -typedef struct _TestIface6 TestIface6; -typedef struct _TestIfaceClass TestIface6Class; - -static void test_iface6_base_init (TestIface6Class *iface); - -static DEFINE_IFACE(TestIface6, test_iface6, test_iface6_base_init, NULL) - -/* - * BaseObject, a parent class for TestObject - */ -#define BASE_TYPE_OBJECT (base_object_get_type ()) -typedef struct _BaseObject BaseObject; -typedef struct _BaseObjectClass BaseObjectClass; - -struct _BaseObject -{ - GObject parent_instance; -}; -struct _BaseObjectClass -{ - GObjectClass parent_class; -}; - -/* - * TestObject, a parent class for TestObject - */ -#define TEST_TYPE_OBJECT (test_object_get_type ()) -typedef struct _TestObject TestObject; -typedef struct _TestObjectClass TestObjectClass; - -struct _TestObject -{ - BaseObject parent_instance; -}; -struct _TestObjectClass -{ - BaseObjectClass parent_class; -}; - -#define TEST_CALLED_ONCE() G_STMT_START { \ - static gboolean called = 0; \ - g_assert (!called); \ - called = TRUE; \ -} G_STMT_END - -#define CHECK_IFACE_TWICE(iface) G_STMT_START { \ - static guint n_calls = 0; \ - n_calls++; \ - g_assert (n_calls <= 2); \ - g_assert (G_TYPE_IS_INTERFACE (((GTypeInterface*) iface)->g_type)); \ - if (n_calls == 1) \ - g_assert (((GTypeInterface*) iface)->g_instance_type == 0); \ - else \ - g_assert (G_TYPE_IS_OBJECT (((GTypeInterface*) iface)->g_instance_type)); \ -} G_STMT_END - -#define ADD_IFACE(n) G_STMT_START { \ - GInterfaceInfo iface_info = { \ - (GInterfaceInitFunc)test_object_test_iface##n##_init, \ - NULL, NULL }; \ - \ - g_type_add_interface_static (TEST_TYPE_OBJECT, \ - test_iface##n##_get_type (), \ - &iface_info); \ - \ -} G_STMT_END - -static gboolean base1, base2, base3, base4, base5, base6; -static gboolean iface1, iface2, iface3, iface4, iface5, iface6; - -static void test_object_test_iface1_init (TestIface1Class *iface); -static void test_object_test_iface2_init (TestIface1Class *iface); -static void test_object_test_iface3_init (TestIface3Class *iface); -static void test_object_test_iface4_init (TestIface4Class *iface); -static void test_object_test_iface5_init (TestIface5Class *iface); -static void test_object_test_iface6_init (TestIface6Class *iface); - -static GType test_object_get_type (void); - -static void -test_object_test_iface1_init (TestIface1Class *iface) -{ - TEST_CALLED_ONCE(); - - g_assert (iface->default_val == 0x111111); - - iface->val = 0x10001; - - ADD_IFACE(5); - - iface1 = TRUE; -} - -static void -test_object_test_iface2_init (TestIface2Class *iface) -{ - TEST_CALLED_ONCE(); - - iface->val = 0x20002; - - iface2 = TRUE; -} - -static void -test_object_test_iface3_init (TestIface3Class *iface) -{ - TEST_CALLED_ONCE(); - - iface->val = 0x30003; - - iface3 = TRUE; -} - -static void -test_object_test_iface4_init (TestIface4Class *iface) -{ - TEST_CALLED_ONCE(); - - iface->val = 0x40004; - - iface4 = TRUE; -} - -static void -test_object_test_iface5_init (TestIface5Class *iface) -{ - TEST_CALLED_ONCE(); - - iface->val = 0x50005; - - iface5 = TRUE; -} - -static void -test_object_test_iface6_init (TestIface6Class *iface) -{ - TEST_CALLED_ONCE(); - - iface->val = 0x60006; - - iface6 = TRUE; -} - -static void -test_iface1_default_init (TestIface1Class *iface, - gpointer class_data) -{ - TEST_CALLED_ONCE(); - g_assert (iface->base_iface.g_type == TEST_TYPE_IFACE1); - g_assert (iface->base_iface.g_instance_type == 0); - g_assert (iface->base_val == 0x110011); - g_assert (iface->val == 0); - g_assert (iface->default_val == 0); - iface->default_val = 0x111111; -} - -static void -test_iface1_base_init (TestIface1Class *iface) -{ - static guint n_calls = 0; - n_calls++; - g_assert (n_calls <= 2); - - if (n_calls == 1) - { - iface->base_val = 0x110011; - g_assert (iface->default_val == 0); - } - else - { - g_assert (iface->base_val == 0x110011); - g_assert (iface->default_val == 0x111111); - } - - if (n_calls == 1) - ADD_IFACE(3); - - base1 = TRUE; -} - -static void -test_iface2_base_init (TestIface2Class *iface) -{ - CHECK_IFACE_TWICE (iface); - - iface->base_val = 0x220022; - - base2 = TRUE; -} - -static void -test_iface3_base_init (TestIface3Class *iface) -{ - CHECK_IFACE_TWICE (iface); - - iface->base_val = 0x330033; - - base3 = TRUE; -} - -static void -test_iface4_base_init (TestIface4Class *iface) -{ - CHECK_IFACE_TWICE (iface); - - iface->base_val = 0x440044; - - base4 = TRUE; -} - -static void -test_iface5_base_init (TestIface5Class *iface) -{ - CHECK_IFACE_TWICE (iface); - - iface->base_val = 0x550055; - - base5 = TRUE; -} - -static void -test_iface6_base_init (TestIface6Class *iface) -{ - CHECK_IFACE_TWICE (iface); - - iface->base_val = 0x660066; - - base6 = TRUE; -} - -static void -base_object_base_init (BaseObjectClass *class) -{ - static int n_called = 0; - n_called++; - - /* The second time this is called is for TestObject */ - if (n_called == 2) - { - ADD_IFACE(2); - - /* No interface base init functions should have been called yet - */ - g_assert (!base1 && !base2 && !base3 && !base4 && !base5 && !base6); - g_assert (!iface1 && !iface2 && !iface3 && !iface4 && !iface5 && !iface6); - } -} - -static void -test_object_class_init (TestObjectClass *class) -{ - ADD_IFACE(4); - - /* At this point, the base init functions for all interfaces that have - * been added should be called, but no interface init functions. - */ - g_assert (base1 && base2 && base3 && base4 && !base5 && !base6); - g_assert (!iface1 && !iface2 && !iface3 && !iface4 && !iface5 && !iface6); -} - -static DEFINE_TYPE(BaseObject, base_object, - NULL, base_object_base_init, NULL, - G_TYPE_OBJECT) -static DEFINE_TYPE(TestObject, test_object, - test_object_class_init, NULL, NULL, - BASE_TYPE_OBJECT) - -int -main (int argc, - char *argv[]) -{ - TestObject *object; - TestObjectClass *object_class; - TestIfaceClass *iface; - - g_log_set_always_fatal (g_log_set_always_fatal (G_LOG_FATAL_MASK) | - G_LOG_LEVEL_WARNING | - G_LOG_LEVEL_CRITICAL); - - /* We force the interfaces to be registered in a different order - * than we add them, so our logic doesn't always deal with interfaces - * added at the end. - */ - (void)TEST_TYPE_IFACE4; - (void)TEST_TYPE_IFACE2; - (void)TEST_TYPE_IFACE6; - (void)TEST_TYPE_IFACE5; - (void)TEST_TYPE_IFACE3; - (void)TEST_TYPE_IFACE1; - - ADD_IFACE(1); - - object_class = g_type_class_ref (TEST_TYPE_OBJECT); - - ADD_IFACE(6); - - /* All base and interface init functions should have been called - */ - g_assert (base1 && base2 && base3 && base4 && base5 && base6); - g_assert (iface1 && iface2 && iface3 && iface4 && iface5 && iface6); - - object = g_object_new (TEST_TYPE_OBJECT, NULL); - - iface = TEST_IFACE1_GET_CLASS (object); - g_assert (iface && iface->val == 0x10001 && iface->base_val == 0x110011); - iface = TEST_IFACE3_GET_CLASS (object); - g_assert (iface && iface->val == 0x30003 && iface->base_val == 0x330033); - iface = TEST_IFACE4_GET_CLASS (object); - g_assert (iface && iface->val == 0x40004 && iface->base_val == 0x440044); - iface = TEST_IFACE5_GET_CLASS (object); - g_assert (iface && iface->val == 0x50005 && iface->base_val == 0x550055); - iface = TEST_IFACE6_GET_CLASS (object); - g_assert (iface && iface->val == 0x60006 && iface->base_val == 0x660066); - - g_type_class_unref (object_class); - - return 0; -} From 27ec1469ab1585030feafc0ffab9e552ee2969a7 Mon Sep 17 00:00:00 2001 From: Xavier Claessens Date: Mon, 4 Jun 2018 22:25:10 -0400 Subject: [PATCH 3/3] Remove developer script not needed in git repository --- tests/gobject/run-performance.sh | 6 ------ 1 file changed, 6 deletions(-) delete mode 100755 tests/gobject/run-performance.sh diff --git a/tests/gobject/run-performance.sh b/tests/gobject/run-performance.sh deleted file mode 100755 index f2d53dfef..000000000 --- a/tests/gobject/run-performance.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh -DIR=`dirname $0`; -(cd $DIR; make performance) -ID=`git rev-list --max-count=1 HEAD` -echo "Testing revision ${ID}" -$DIR/performance | tee "perf-${ID}.log"