summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Withnall <philip@tecnocode.co.uk>2022-05-26 18:03:00 +0000
committerPhilip Withnall <philip@tecnocode.co.uk>2022-05-26 18:03:00 +0000
commitd1cb96b5e3bc0e557bd5f9134eca9e104befceaa (patch)
tree6040afe07bd2eaf477e21cad39c3e3aa708d304e
parentce585ba4d2e885b3b0c83b44dd236e3d0a45a3a8 (diff)
parented84b8f4688b76cb56bab31890b038959720f54f (diff)
downloadglib-d1cb96b5e3bc0e557bd5f9134eca9e104befceaa.tar.gz
Merge branch 'refcount_tests' into 'main'
Moving tests/refcount/ directory to gobject/tests/ See merge request GNOME/glib!2553
-rw-r--r--gobject/tests/meson.build22
-rw-r--r--gobject/tests/objects-refcount1.c (renamed from tests/refcount/objects.c)44
-rw-r--r--gobject/tests/objects-refcount2.c (renamed from tests/refcount/objects2.c)40
-rw-r--r--gobject/tests/properties-refcount1.c (renamed from tests/refcount/properties.c)54
-rw-r--r--gobject/tests/properties-refcount2.c (renamed from tests/refcount/properties2.c)66
-rw-r--r--gobject/tests/properties-refcount3.c (renamed from tests/refcount/properties3.c)36
-rw-r--r--gobject/tests/properties-refcount4.c (renamed from tests/refcount/properties4.c)24
-rw-r--r--gobject/tests/signals-refcount.c (renamed from tests/refcount/signals.c)41
-rw-r--r--tests/meson.build1
-rw-r--r--tests/refcount/meson.build60
10 files changed, 199 insertions, 189 deletions
diff --git a/gobject/tests/meson.build b/gobject/tests/meson.build
index 8d568f00e..2b860f344 100644
--- a/gobject/tests/meson.build
+++ b/gobject/tests/meson.build
@@ -57,6 +57,28 @@ gobject_tests = {
'signalgroup' : {},
'testing' : {},
'type-flags' : {},
+ 'objects-refcount1' : {},
+ 'objects-refcount2' : {'suite' : ['slow']},
+ 'properties-refcount1' : {},
+ 'properties-refcount2' : {'suite' : ['slow']},
+ 'properties-refcount3' : {'suite' : ['slow']},
+ 'properties-refcount4' : {},
+ 'signals-refcount1' : {
+ 'source' : 'signals-refcount.c',
+ 'c_args' : ['-DTESTNUM=1'],
+ },
+ 'signals-refcount2' : {
+ 'source' : 'signals-refcount.c',
+ 'c_args' : ['-DTESTNUM=2'],
+ },
+ 'signals-refcount3' : {
+ 'source' : 'signals-refcount.c',
+ 'c_args' : ['-DTESTNUM=3'],
+ },
+ 'signals-refcount4' : {
+ 'source' : 'signals-refcount.c',
+ 'c_args' : ['-DTESTNUM=4'],
+ },
}
if cc.get_id() != 'msvc'
diff --git a/tests/refcount/objects.c b/gobject/tests/objects-refcount1.c
index 06b871936..8f99d06e6 100644
--- a/tests/refcount/objects.c
+++ b/gobject/tests/objects-refcount1.c
@@ -5,7 +5,7 @@
#include <unistd.h>
#endif
-#define G_TYPE_TEST (my_test_get_type ())
+#define G_TYPE_TEST (my_test_get_type ())
#define MY_TEST(test) (G_TYPE_CHECK_INSTANCE_CAST ((test), G_TYPE_TEST, GTest))
#define MY_IS_TEST(test) (G_TYPE_CHECK_INSTANCE_TYPE ((test), G_TYPE_TEST))
#define MY_TEST_CLASS(tclass) (G_TYPE_CHECK_CLASS_CAST ((tclass), G_TYPE_TEST, GTestClass))
@@ -65,7 +65,6 @@ my_test_class_init (GTestClass * klass)
GObjectClass *gobject_class;
gobject_class = (GObjectClass *) klass;
-
parent_class = g_type_class_ref (G_TYPE_OBJECT);
gobject_class->dispose = my_test_dispose;
@@ -74,7 +73,7 @@ my_test_class_init (GTestClass * klass)
static void
my_test_init (GTest * test)
{
- g_print ("init %p\n", test);
+ g_test_message ("init %p\n", test);
}
static void
@@ -84,7 +83,7 @@ my_test_dispose (GObject * object)
test = MY_TEST (object);
- g_print ("dispose %p!\n", test);
+ g_test_message ("dispose %p!\n", test);
G_OBJECT_CLASS (parent_class)->dispose (object);
}
@@ -92,8 +91,8 @@ my_test_dispose (GObject * object)
static void
my_test_do_refcount (GTest * test)
{
- g_object_ref (test);
- g_object_unref (test);
+ g_object_ref (test);
+ g_object_unref (test);
}
static gpointer
@@ -104,25 +103,22 @@ run_thread (GTest * test)
while (!g_atomic_int_get (&stopping)) {
my_test_do_refcount (test);
if ((i++ % 10000) == 0) {
- g_print (".");
- g_thread_yield(); /* force context switch */
+ g_test_message (".");
+ g_thread_yield (); /* force context switch */
}
}
return NULL;
}
-int
-main (int argc, char **argv)
+static void
+test_refcount_object_basics (void)
{
guint i;
GTest *test1, *test2;
GArray *test_threads;
const guint n_threads = 5;
- g_print ("START: %s\n", argv[0]);
- g_log_set_always_fatal (G_LOG_LEVEL_WARNING | G_LOG_LEVEL_CRITICAL | g_log_set_always_fatal (G_LOG_FATAL_MASK));
-
test1 = g_object_new (G_TYPE_TEST, NULL);
test2 = g_object_new (G_TYPE_TEST, NULL);
@@ -133,18 +129,16 @@ main (int argc, char **argv)
for (i = 0; i < n_threads; i++) {
GThread *thread;
- thread = g_thread_create ((GThreadFunc) run_thread, test1, TRUE, NULL);
+ thread = g_thread_new (NULL, (GThreadFunc) run_thread, test1);
g_array_append_val (test_threads, thread);
- thread = g_thread_create ((GThreadFunc) run_thread, test2, TRUE, NULL);
+ thread = g_thread_new (NULL, (GThreadFunc) run_thread, test2);
g_array_append_val (test_threads, thread);
}
- g_usleep (5000000);
+ g_usleep (5000000);
g_atomic_int_set (&stopping, 1);
- g_print ("\nstopping\n");
-
/* join all threads */
for (i = 0; i < 2 * n_threads; i++) {
GThread *thread;
@@ -156,8 +150,18 @@ main (int argc, char **argv)
g_object_unref (test1);
g_object_unref (test2);
g_array_unref (test_threads);
+}
+
+int
+main (int argc, gchar *argv[])
+{
+ g_log_set_always_fatal (G_LOG_LEVEL_WARNING |
+ G_LOG_LEVEL_CRITICAL |
+ g_log_set_always_fatal (G_LOG_FATAL_MASK));
+
+ g_test_init (&argc, &argv, NULL);
- g_print ("stopped\n");
+ g_test_add_func ("/gobject/refcount/object-basics", test_refcount_object_basics);
- return 0;
+ return g_test_run ();
}
diff --git a/tests/refcount/objects2.c b/gobject/tests/objects-refcount2.c
index e19bc67ca..2e7c03836 100644
--- a/tests/refcount/objects2.c
+++ b/gobject/tests/objects-refcount2.c
@@ -73,7 +73,7 @@ my_test_class_init (GTestClass * klass)
static void
my_test_init (GTest * test)
{
- g_print ("init %p\n", test);
+ g_test_message ("init %p\n", test);
}
static void
@@ -83,7 +83,7 @@ my_test_dispose (GObject * object)
test = MY_TEST (object);
- g_print ("dispose %p!\n", test);
+ g_test_message ("dispose %p!\n", test);
G_OBJECT_CLASS (parent_class)->dispose (object);
}
@@ -92,30 +92,40 @@ static void
my_test_do_refcount (GTest * test)
{
static guint i = 1;
+
if (i++ % 100000 == 0)
- g_print (".");
- g_object_ref (test);
- g_object_unref (test);
+ g_test_message (".");
+
+ g_object_ref (test);
+ g_object_unref (test);
}
-int
-main (int argc, char **argv)
+static void
+test_refcount_object_advanced (void)
{
gint i;
GTest *test;
- g_print ("START: %s\n", argv[0]);
- g_log_set_always_fatal (G_LOG_LEVEL_WARNING | G_LOG_LEVEL_CRITICAL | g_log_set_always_fatal (G_LOG_FATAL_MASK));
-
test = g_object_new (G_TYPE_TEST, NULL);
- for (i=0; i<100000000; i++) {
- my_test_do_refcount (test);
- }
+ for (i = 0; i < 100000000; i++)
+ {
+ my_test_do_refcount (test);
+ }
g_object_unref (test);
+}
+
+int
+main (int argc, char **argv)
+{
+ g_log_set_always_fatal (G_LOG_LEVEL_WARNING |
+ G_LOG_LEVEL_CRITICAL |
+ g_log_set_always_fatal (G_LOG_FATAL_MASK));
+
+ g_test_init (&argc, &argv, NULL);
- g_print ("\n");
+ g_test_add_func ("/gobject/refcount/object-advanced", test_refcount_object_advanced);
- return 0;
+ return g_test_run ();
}
diff --git a/tests/refcount/properties.c b/gobject/tests/properties-refcount1.c
index 376d9313c..5a96518dc 100644
--- a/tests/refcount/properties.c
+++ b/gobject/tests/properties-refcount1.c
@@ -5,7 +5,7 @@
#include <unistd.h>
#endif
-#define G_TYPE_TEST (my_test_get_type ())
+#define G_TYPE_TEST (my_test_get_type ())
#define MY_TEST(test) (G_TYPE_CHECK_INSTANCE_CAST ((test), G_TYPE_TEST, GTest))
#define MY_IS_TEST(test) (G_TYPE_CHECK_INSTANCE_TYPE ((test), G_TYPE_TEST))
#define MY_TEST_CLASS(tclass) (G_TYPE_CHECK_CLASS_CAST ((tclass), G_TYPE_TEST, GTestClass))
@@ -89,12 +89,12 @@ my_test_class_init (GTestClass * klass)
gobject_class->set_property = my_test_set_property;
g_object_class_install_property (gobject_class,
- PROP_DUMMY,
- g_param_spec_int ("dummy",
- NULL,
- NULL,
- 0, G_MAXINT, 0,
- G_PARAM_READWRITE));
+ PROP_DUMMY,
+ g_param_spec_int ("dummy",
+ NULL,
+ NULL,
+ 0, G_MAXINT, 0,
+ G_PARAM_READWRITE));
}
static void
@@ -110,7 +110,7 @@ my_test_dispose (GObject * object)
G_OBJECT_CLASS (parent_class)->dispose (object);
}
-static void
+static void
my_test_get_property (GObject *object,
guint prop_id,
GValue *value,
@@ -131,7 +131,7 @@ my_test_get_property (GObject *object,
}
}
-static void
+static void
my_test_set_property (GObject *object,
guint prop_id,
const GValue *value,
@@ -160,7 +160,7 @@ dummy_notify (GObject *object,
test = MY_TEST (object);
- test->count++;
+ test->count++;
}
static void
@@ -176,12 +176,12 @@ static gpointer
run_thread (GTest * test)
{
gint i = 1;
-
+
while (!g_atomic_int_get (&stopping)) {
my_test_do_property (test);
if ((i++ % 10000) == 0)
{
- g_print (".%c", 'a' + test->id);
+ g_test_message (".%c", 'a' + test->id);
g_thread_yield(); /* force context switch */
}
}
@@ -189,49 +189,55 @@ run_thread (GTest * test)
return NULL;
}
-int
-main (int argc, char **argv)
+static void
+test_refcount_properties_1 (void)
{
#define N_THREADS 5
GThread *test_threads[N_THREADS];
GTest *test_objects[N_THREADS];
gint i;
- g_print ("START: %s\n", argv[0]);
- g_log_set_always_fatal (G_LOG_LEVEL_WARNING | G_LOG_LEVEL_CRITICAL | g_log_set_always_fatal (G_LOG_FATAL_MASK));
-
for (i = 0; i < N_THREADS; i++) {
GTest *test;
test = g_object_new (G_TYPE_TEST, NULL);
test_objects[i] = test;
- g_assert (test->count == test->dummy);
+ g_assert_cmpint (test->count, ==, test->dummy);
g_signal_connect (test, "notify::dummy", G_CALLBACK (dummy_notify), NULL);
}
g_atomic_int_set (&stopping, FALSE);
for (i = 0; i < N_THREADS; i++)
- test_threads[i] = g_thread_create ((GThreadFunc) run_thread, test_objects[i], TRUE, NULL);
+ test_threads[i] = g_thread_new (NULL, (GThreadFunc) run_thread, test_objects[i]);
g_usleep (3000000);
g_atomic_int_set (&stopping, TRUE);
- g_print ("\nstopping\n");
/* join all threads */
for (i = 0; i < N_THREADS; i++)
g_thread_join (test_threads[i]);
- g_print ("stopped\n");
-
for (i = 0; i < N_THREADS; i++) {
GTest *test = test_objects[i];
- g_assert (test->count == test->dummy);
+ g_assert_cmpint (test->count, ==, test->dummy);
g_object_unref (test);
}
+}
+
+int
+main (int argc, gchar *argv[])
+{
+ g_log_set_always_fatal (G_LOG_LEVEL_WARNING |
+ G_LOG_LEVEL_CRITICAL |
+ g_log_set_always_fatal (G_LOG_FATAL_MASK));
+
+ g_test_init (&argc, &argv, NULL);
+
+ g_test_add_func ("/gobject/refcount/properties-1", test_refcount_properties_1);
- return 0;
+ return g_test_run ();
}
diff --git a/tests/refcount/properties2.c b/gobject/tests/properties-refcount2.c
index 1684bd45b..9536b5144 100644
--- a/tests/refcount/properties2.c
+++ b/gobject/tests/properties-refcount2.c
@@ -87,18 +87,18 @@ my_test_class_init (GTestClass * klass)
gobject_class->set_property = my_test_set_property;
g_object_class_install_property (gobject_class,
- PROP_DUMMY,
- g_param_spec_int ("dummy",
- NULL,
- NULL,
- 0, G_MAXINT, 0,
- G_PARAM_READWRITE));
+ PROP_DUMMY,
+ g_param_spec_int ("dummy",
+ NULL,
+ NULL,
+ 0, G_MAXINT, 0,
+ G_PARAM_READWRITE));
}
static void
my_test_init (GTest * test)
{
- g_print ("init %p\n", test);
+ g_test_message ("init %p\n", test);
}
static void
@@ -108,15 +108,15 @@ my_test_dispose (GObject * object)
test = MY_TEST (object);
- g_print ("dispose %p!\n", test);
+ g_test_message ("dispose %p!\n", test);
G_OBJECT_CLASS (parent_class)->dispose (object);
}
-static void
-my_test_get_property (GObject *object,
- guint prop_id,
- GValue *value,
+static void
+my_test_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
GParamSpec *pspec)
{
GTest *test;
@@ -134,11 +134,11 @@ my_test_get_property (GObject *object,
}
}
-static void
-my_test_set_property (GObject *object,
- guint prop_id,
+static void
+my_test_set_property (GObject *object,
+ guint prop_id,
const GValue *value,
- GParamSpec *pspec)
+ GParamSpec *pspec)
{
GTest *test;
@@ -163,7 +163,7 @@ dummy_notify (GObject *object,
{
count++;
if (count % 10000 == 0)
- g_print (".");
+ g_test_message (".");
}
static void
@@ -175,28 +175,36 @@ my_test_do_property (GTest * test)
g_object_set (test, "dummy", dummy + 1, NULL);
}
-int
-main (int argc, char **argv)
+static void
+test_refcount_properties_2 (void)
{
gint i;
GTest *test;
- g_print ("START: %s\n", argv[0]);
- g_log_set_always_fatal (G_LOG_LEVEL_WARNING | G_LOG_LEVEL_CRITICAL | g_log_set_always_fatal (G_LOG_FATAL_MASK));
-
test = g_object_new (G_TYPE_TEST, NULL);
g_signal_connect (test, "notify::dummy", G_CALLBACK (dummy_notify), NULL);
+ g_assert_cmpint (count, ==, test->dummy);
- g_assert (count == test->dummy);
+ for (i = 0; i < 1000000; i++)
+ {
+ my_test_do_property (test);
+ }
+ g_assert_cmpint (count, ==, test->dummy);
- for (i=0; i<1000000; i++) {
- my_test_do_property (test);
- }
+ g_object_unref (test);
+}
- g_assert (count == test->dummy);
+int
+main (int argc, gchar *argv[])
+{
+ g_log_set_always_fatal (G_LOG_LEVEL_WARNING |
+ G_LOG_LEVEL_CRITICAL |
+ g_log_set_always_fatal (G_LOG_FATAL_MASK));
- g_object_unref (test);
+ g_test_init (&argc, &argv, NULL);
+
+ g_test_add_func ("/gobject/refcount/properties-2", test_refcount_properties_2);
- return 0;
+ return g_test_run ();
}
diff --git a/tests/refcount/properties3.c b/gobject/tests/properties-refcount3.c
index 31f26a46e..19b5178a7 100644
--- a/tests/refcount/properties3.c
+++ b/gobject/tests/properties-refcount3.c
@@ -144,28 +144,25 @@ run_thread (GTest * test)
my_test_do_property (test);
if ((i++ % 10000) == 0)
{
- g_print (".%c", 'a' + test->id);
- g_thread_yield(); /* force context switch */
+ g_test_message (".%c", 'a' + test->id);
+ g_thread_yield(); /* force context switch */
}
}
return NULL;
}
-int
-main (int argc, char **argv)
+static void
+test_refcount_properties_3 (void)
{
gint i;
GTest *test;
GArray *test_threads;
const gint n_threads = 5;
- g_print ("START: %s\n", argv[0]);
- g_log_set_always_fatal (G_LOG_LEVEL_WARNING | G_LOG_LEVEL_CRITICAL | g_log_set_always_fatal (G_LOG_FATAL_MASK));
-
test = g_object_new (G_TYPE_TEST, NULL);
- g_assert (test->count == test->dummy);
+ g_assert_cmpint (test->count, ==, test->dummy);
g_signal_connect (test, "notify::dummy", G_CALLBACK (dummy_notify), NULL);
test_threads = g_array_new (FALSE, FALSE, sizeof (GThread *));
@@ -175,13 +172,13 @@ main (int argc, char **argv)
for (i = 0; i < n_threads; i++) {
GThread *thread;
- thread = g_thread_create ((GThreadFunc) run_thread, test, TRUE, NULL);
+ thread = g_thread_new (NULL, (GThreadFunc) run_thread, test);
g_array_append_val (test_threads, thread);
}
g_usleep (30000000);
g_atomic_int_set (&stopping, 1);
- g_print ("\nstopping\n");
+ g_test_message ("\nstopping\n");
/* join all threads */
for (i = 0; i < n_threads; i++) {
@@ -191,12 +188,23 @@ main (int argc, char **argv)
g_thread_join (thread);
}
- g_print ("stopped\n");
-
- g_print ("%d %d\n", test->setcount, test->count);
+ g_test_message ("stopped\n");
+ g_test_message ("%d %d\n", test->setcount, test->count);
g_array_free (test_threads, TRUE);
g_object_unref (test);
+}
+
+int
+main (int argc, gchar *argv[])
+{
+ g_log_set_always_fatal (G_LOG_LEVEL_WARNING |
+ G_LOG_LEVEL_CRITICAL |
+ g_log_set_always_fatal (G_LOG_FATAL_MASK));
+
+ g_test_init (&argc, &argv, NULL);
+
+ g_test_add_func ("/gobject/refcount/properties-3", test_refcount_properties_3);
- return 0;
+ return g_test_run ();
}
diff --git a/tests/refcount/properties4.c b/gobject/tests/properties-refcount4.c
index d4bca9486..462f9e3cd 100644
--- a/tests/refcount/properties4.c
+++ b/gobject/tests/properties-refcount4.c
@@ -143,19 +143,15 @@ my_badger_mama_notify (GObject *object,
MyBadger *self;
self = MY_BADGER (object);
-
self->mama_notify_count++;
}
-int
-main (int argc, char **argv)
+static void
+test_refcount_properties_4 (void)
{
MyBadger * badger1, * badger2;
gpointer test;
- g_print ("START: %s\n", argv[0]);
- g_log_set_always_fatal (G_LOG_LEVEL_WARNING | G_LOG_LEVEL_CRITICAL | g_log_set_always_fatal (G_LOG_FATAL_MASK));
-
badger1 = g_object_new (MY_TYPE_BADGER, NULL);
badger2 = g_object_new (MY_TYPE_BADGER, NULL);
@@ -163,11 +159,23 @@ main (int argc, char **argv)
g_assert_cmpuint (badger1->mama_notify_count, ==, 1);
g_assert_cmpuint (badger2->mama_notify_count, ==, 1);
g_object_get (badger1, "mama", &test, NULL);
- g_assert (test == badger2);
+ g_assert_cmpmem (test, sizeof (MyBadger), badger2, sizeof (MyBadger));
g_object_unref (test);
g_object_unref (badger1);
g_object_unref (badger2);
+}
+
+int
+main (int argc, gchar *argv[])
+{
+ g_log_set_always_fatal (G_LOG_LEVEL_WARNING |
+ G_LOG_LEVEL_CRITICAL |
+ g_log_set_always_fatal (G_LOG_FATAL_MASK));
+
+ g_test_init (&argc, &argv, NULL);
+
+ g_test_add_func ("/gobject/refcount/properties-4", test_refcount_properties_4);
- return 0;
+ return g_test_run ();
}
diff --git a/tests/refcount/signals.c b/gobject/tests/signals-refcount.c
index f714ac004..c1a5745b8 100644
--- a/tests/refcount/signals.c
+++ b/gobject/tests/signals-refcount.c
@@ -128,7 +128,7 @@ my_test_class_init (GTestClass * klass)
static void
my_test_init (GTest * test)
{
- g_print ("init %p\n", test);
+ g_test_message ("init %p\n", test);
test->value = 0;
}
@@ -140,7 +140,7 @@ my_test_dispose (GObject * object)
test = MY_TEST (object);
- g_print ("dispose %p!\n", test);
+ g_test_message ("dispose %p!\n", test);
G_OBJECT_CLASS (parent_class)->dispose (object);
}
@@ -236,8 +236,8 @@ run_thread (GTest * test)
if (TESTNUM == 4)
my_test_do_signal3 (test);
if ((i++ % 10000) == 0) {
- g_print (".");
- g_thread_yield(); /* force context switch */
+ g_test_message (".");
+ g_thread_yield (); /* force context switch */
}
}
@@ -250,20 +250,17 @@ notify (GObject *object, GParamSpec *spec, gpointer user_data)
gint value;
g_object_get (object, "test-prop", &value, NULL);
- /*g_print ("+ %d", value);*/
+ g_test_message ("+ %d", value);
}
-int
-main (int argc, char **argv)
+static void
+test_refcount_signals (void)
{
gint i;
GTest *test1, *test2;
GArray *test_threads;
const gint n_threads = 1;
- g_print ("START: %s\n", argv[0]);
- g_log_set_always_fatal (G_LOG_LEVEL_WARNING | G_LOG_LEVEL_CRITICAL | g_log_set_always_fatal (G_LOG_FATAL_MASK));
-
test1 = g_object_new (G_TYPE_TEST, NULL);
test2 = g_object_new (G_TYPE_TEST, NULL);
@@ -278,19 +275,17 @@ main (int argc, char **argv)
for (i = 0; i < n_threads; i++) {
GThread *thread;
- thread = g_thread_create ((GThreadFunc) run_thread, test1, TRUE, NULL);
+ thread = g_thread_new (NULL, (GThreadFunc) run_thread, test1);
g_array_append_val (test_threads, thread);
- thread = g_thread_create ((GThreadFunc) run_thread, test2, TRUE, NULL);
+ thread = g_thread_new (NULL, (GThreadFunc) run_thread, test2);
g_array_append_val (test_threads, thread);
}
g_usleep (5000000);
g_atomic_int_set (&stopping, TRUE);
- g_print ("\nstopping\n");
-
- /* join all threads */
+ /* Join all threads */
for (i = 0; i < 2 * n_threads; i++) {
GThread *thread;
@@ -298,11 +293,21 @@ main (int argc, char **argv)
g_thread_join (thread);
}
- g_print ("stopped\n");
-
g_array_free (test_threads, TRUE);
g_object_unref (test1);
g_object_unref (test2);
+}
+
+int
+main (int argc, gchar *argv[])
+{
+ g_log_set_always_fatal (G_LOG_LEVEL_WARNING |
+ G_LOG_LEVEL_CRITICAL |
+ g_log_set_always_fatal (G_LOG_FATAL_MASK));
+
+ g_test_init (&argc, &argv, NULL);
+
+ g_test_add_func ("/gobject/refcount/signals", test_refcount_signals);
- return 0;
+ return g_test_run ();
}
diff --git a/tests/meson.build b/tests/meson.build
index ea5b86013..7ebdc24a0 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -13,7 +13,6 @@ test_env.set('MALLOC_PERTURB_', '@0@'.format(random_number % 256))
test_cargs = ['-DG_LOG_DOMAIN="GLib"', '-UG_DISABLE_ASSERT']
subdir('gobject')
-subdir('refcount')
test_extra_programs = {
'assert-msg-test' : {},
diff --git a/tests/refcount/meson.build b/tests/refcount/meson.build
deleted file mode 100644
index 02571fe98..000000000
--- a/tests/refcount/meson.build
+++ /dev/null
@@ -1,60 +0,0 @@
-refcount_tests = {
- 'objects' : {},
- 'objects2' : {'suite' : ['slow']},
- 'properties' : {},
- 'properties2' : {'suite' : ['slow']},
- 'properties3' : {'suite' : ['slow']},
- 'properties4' : {},
- 'signal1' : {
- 'source' : 'signals.c',
- 'c_args' : ['-DTESTNUM=1'],
- },
- 'signal2' : {
- 'source' : 'signals.c',
- 'c_args' : ['-DTESTNUM=2'],
- },
- 'signal3' : {
- 'source' : 'signals.c',
- 'c_args' : ['-DTESTNUM=3'],
- },
- 'signal4' : {
- 'source' : 'signals.c',
- 'c_args' : ['-DTESTNUM=4'],
- },
-}
-
-common_c_args = test_cargs + ['-DGLIB_DISABLE_DEPRECATION_WARNINGS']
-common_deps = [libm, thread_dep, libglib_dep, libgobject_dep]
-
-foreach test_name, extra_args : refcount_tests
- source = extra_args.get('source', test_name + '.c')
- extra_sources = extra_args.get('extra_sources', [])
- install = installed_tests_enabled and extra_args.get('install', true)
-
- if install
- test_conf = configuration_data()
- test_conf.set('installed_tests_dir', installed_tests_execdir)
- test_conf.set('program', test_name)
- test_conf.set('env', '')
- configure_file(
- input: installed_tests_template,
- output: test_name + '.test',
- install_dir: installed_tests_metadir,
- configuration: test_conf
- )
- endif
-
- # FIXME? $(GLIB_DEBUG_FLAGS)
- exe = executable(test_name, [source, extra_sources],
- c_args : common_c_args + extra_args.get('c_args', []),
- dependencies : common_deps + extra_args.get('dependencies', []),
- install_dir: installed_tests_execdir,
- install: install,
- )
-
- suite = ['refcount'] + extra_args.get('suite', [])
- timeout = suite.contains('slow') ? test_timeout_slow : test_timeout
-
- # FIXME? TESTS_ENVIRONMENT = LIBCHARSET_ALIAS_DIR=$(top_builddir)/glib/libcharset
- test(test_name, exe, env : test_env, timeout : timeout, suite : suite)
-endforeach