[glib] Simplify subprocesses in tests
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] Simplify subprocesses in tests
- Date: Sun, 15 Dec 2013 16:50:42 +0000 (UTC)
commit c34cc2348cfd3c461974dea4419001dbd9610202
Author: Matthias Clasen <mclasen redhat com>
Date: Sun Dec 15 11:20:19 2013 -0500
Simplify subprocesses in tests
Use the new way of running tests in a subprocess without
registering extra 'subprocess' test cases where appropriate.
gio/tests/gsettings.c | 117 ++++++++++++++++++++++------------------------
glib/tests/array-test.c | 26 +++++------
glib/tests/dataset.c | 23 ++++-----
glib/tests/scannerapi.c | 21 ++++-----
glib/tests/slice.c | 14 ++---
glib/tests/test-printf.c | 48 +++++++++----------
glib/tests/testing.c | 93 ++++++++++++++++---------------------
glib/tests/utils.c | 37 +++++---------
gobject/tests/object.c | 16 +++----
9 files changed, 176 insertions(+), 219 deletions(-)
---
diff --git a/gio/tests/gsettings.c b/gio/tests/gsettings.c
index 618c84e..244ff8e 100644
--- a/gio/tests/gsettings.c
+++ b/gio/tests/gsettings.c
@@ -99,26 +99,25 @@ test_basic (void)
* that is not in the schema
*/
static void
-test_unknown_key_subprocess (void)
-{
- GSettings *settings;
- GVariant *value;
-
- settings = g_settings_new ("org.gtk.test");
- value = g_settings_get_value (settings, "no_such_key");
-
- g_assert (value == NULL);
-
- g_object_unref (settings);
-}
-
-static void
test_unknown_key (void)
{
if (!g_test_undefined ())
return;
- g_test_trap_subprocess ("/gsettings/unknown-key/subprocess", 0, 0);
+ if (g_test_subprocess ())
+ {
+ GSettings *settings;
+ GVariant *value;
+
+ settings = g_settings_new ("org.gtk.test");
+ value = g_settings_get_value (settings, "no_such_key");
+
+ g_assert (value == NULL);
+
+ g_object_unref (settings);
+ return;
+ }
+ g_test_trap_subprocess (NULL, 0, 0);
g_test_trap_assert_failed ();
g_test_trap_assert_stderr ("*does not contain*");
}
@@ -129,11 +128,6 @@ test_unknown_key (void)
static void
test_no_schema_subprocess (void)
{
- GSettings *settings;
-
- settings = g_settings_new ("no.such.schema");
-
- g_assert (settings == NULL);
}
static void
@@ -142,7 +136,16 @@ test_no_schema (void)
if (!g_test_undefined ())
return;
- g_test_trap_subprocess ("/gsettings/no-schema/subprocess", 0, 0);
+ if (g_test_subprocess ())
+ {
+ GSettings *settings;
+
+ settings = g_settings_new ("no.such.schema");
+
+ g_assert (settings == NULL);
+ return;
+ }
+ g_test_trap_subprocess (NULL, 0, 0);
g_test_trap_assert_failed ();
g_test_trap_assert_stderr ("*Settings schema 'no.such.schema' is not installed*");
}
@@ -180,39 +183,37 @@ test_wrong_type (void)
/* Check errors with explicit paths */
static void
-test_wrong_path_subprocess (void)
-{
- GSettings *settings G_GNUC_UNUSED;
-
- settings = g_settings_new_with_path ("org.gtk.test", "/wrong-path/");
-}
-
-static void
test_wrong_path (void)
{
if (!g_test_undefined ())
return;
- g_test_trap_subprocess ("/gsettings/wrong-path/subprocess", 0, 0);
+ if (g_test_subprocess ())
+ {
+ GSettings *settings G_GNUC_UNUSED;
+
+ settings = g_settings_new_with_path ("org.gtk.test", "/wrong-path/");
+ return;
+ }
+ g_test_trap_subprocess (NULL, 0, 0);
g_test_trap_assert_failed ();
g_test_trap_assert_stderr ("*but path * specified by schema*");
}
static void
-test_no_path_subprocess (void)
-{
- GSettings *settings G_GNUC_UNUSED;
-
- settings = g_settings_new ("org.gtk.test.no-path");
-}
-
-static void
test_no_path (void)
{
if (!g_test_undefined ())
return;
- g_test_trap_subprocess ("/gsettings/no-path/subprocess", 0, 0);
+ if (g_test_subprocess ())
+ {
+ GSettings *settings G_GNUC_UNUSED;
+
+ settings = g_settings_new ("org.gtk.test.no-path");
+ return;
+ }
+ g_test_trap_subprocess (NULL, 0, 0);
g_test_trap_assert_failed ();
g_test_trap_assert_stderr ("*attempting to create schema * without a path**");
}
@@ -1348,30 +1349,28 @@ test_directional_binding (void)
g_object_unref (settings);
}
-/* Test that type mismatch is caught when creating a binding
- */
-static void
-test_typesafe_binding_subprocess (void)
-{
- TestObject *obj;
- GSettings *settings;
-
- settings = g_settings_new ("org.gtk.test.binding");
- obj = test_object_new ();
-
- g_settings_bind (settings, "string", obj, "int", G_SETTINGS_BIND_DEFAULT);
-
- g_object_unref (obj);
- g_object_unref (settings);
-}
-
+/* Test that type mismatch is caught when creating a binding */
static void
test_typesafe_binding (void)
{
if (!g_test_undefined ())
return;
- g_test_trap_subprocess ("/gsettings/typesafe-binding/subprocess", 0, 0);
+ if (g_test_subprocess ())
+ {
+ TestObject *obj;
+ GSettings *settings;
+
+ settings = g_settings_new ("org.gtk.test.binding");
+ obj = test_object_new ();
+
+ g_settings_bind (settings, "string", obj, "int", G_SETTINGS_BIND_DEFAULT);
+
+ g_object_unref (obj);
+ g_object_unref (settings);
+ return;
+ }
+ g_test_trap_subprocess (NULL, 0, 0);
g_test_trap_assert_failed ();
g_test_trap_assert_stderr ("*not compatible*");
}
@@ -2500,14 +2499,10 @@ main (int argc, char *argv[])
if (!backend_set)
{
g_test_add_func ("/gsettings/no-schema", test_no_schema);
- g_test_add_func ("/gsettings/no-schema/subprocess", test_no_schema_subprocess);
g_test_add_func ("/gsettings/unknown-key", test_unknown_key);
- g_test_add_func ("/gsettings/unknown-key/subprocess", test_unknown_key_subprocess);
g_test_add_func ("/gsettings/wrong-type", test_wrong_type);
g_test_add_func ("/gsettings/wrong-path", test_wrong_path);
- g_test_add_func ("/gsettings/wrong-path/subprocess", test_wrong_path_subprocess);
g_test_add_func ("/gsettings/no-path", test_no_path);
- g_test_add_func ("/gsettings/no-path/subprocess", test_no_path_subprocess);
}
g_test_add_func ("/gsettings/basic-types", test_basic_types);
diff --git a/glib/tests/array-test.c b/glib/tests/array-test.c
index 7fc2144..3bce1e2 100644
--- a/glib/tests/array-test.c
+++ b/glib/tests/array-test.c
@@ -216,24 +216,23 @@ static GMemVTable array_large_size_mem_vtable = {
};
static void
-array_large_size_subprocess (void)
+array_large_size (void)
{
- GArray *array;
+ g_test_bug ("568760");
- array = g_array_new (FALSE, FALSE, sizeof (char));
+ if (g_test_subprocess ())
+ {
+ GArray *array;
- g_mem_set_vtable (&array_large_size_mem_vtable);
- g_array_set_size (array, 1073750016);
- g_assert_not_reached ();
-}
+ array = g_array_new (FALSE, FALSE, sizeof (char));
-static void
-array_large_size (void)
-{
- g_test_bug ("568760");
+ g_mem_set_vtable (&array_large_size_mem_vtable);
+ g_array_set_size (array, 1073750016);
+ g_assert_not_reached ();
+ return;
+ }
- g_test_trap_subprocess ("/array/large-size/subprocess",
- 5 /* s */ * 1000 /* ms */ * 1000 /* µs */, 0);
+ g_test_trap_subprocess (NULL, 5000000, 0);
g_test_trap_assert_passed ();
}
@@ -875,7 +874,6 @@ main (int argc, char *argv[])
g_test_add_func ("/array/remove-range", array_remove_range);
g_test_add_func ("/array/ref-count", array_ref_count);
g_test_add_func ("/array/large-size", array_large_size);
- g_test_add_func ("/array/large-size/subprocess", array_large_size_subprocess);
g_test_add_func ("/array/sort", array_sort);
g_test_add_func ("/array/sort-with-data", array_sort_with_data);
g_test_add_func ("/array/clear-func", array_clear_func);
diff --git a/glib/tests/dataset.c b/glib/tests/dataset.c
index 1715504..6871fd2 100644
--- a/glib/tests/dataset.c
+++ b/glib/tests/dataset.c
@@ -183,20 +183,20 @@ free_one (gpointer data)
}
static void
-test_datalist_clear_subprocess (void)
-{
- g_datalist_init (&list);
- g_datalist_set_data_full (&list, "one", GINT_TO_POINTER (1), free_one);
- g_datalist_set_data_full (&list, "two", GINT_TO_POINTER (2), NULL);
- g_datalist_clear (&list);
- g_assert (list == NULL);
-}
-
-static void
test_datalist_clear (void)
{
/* Need to use a subprocess because it will deadlock if it fails */
- g_test_trap_subprocess ("/datalist/recursive-clear/subprocess", 500000, 0);
+ if (g_test_subprocess ())
+ {
+ g_datalist_init (&list);
+ g_datalist_set_data_full (&list, "one", GINT_TO_POINTER (1), free_one);
+ g_datalist_set_data_full (&list, "two", GINT_TO_POINTER (2), NULL);
+ g_datalist_clear (&list);
+ g_assert (list == NULL);
+ return;
+ }
+
+ g_test_trap_subprocess (NULL, 500000, 0);
g_test_trap_assert_passed ();
}
@@ -213,7 +213,6 @@ main (int argc, char *argv[])
g_test_add_func ("/dataset/foreach", test_dataset_foreach);
g_test_add_func ("/dataset/destroy", test_dataset_destroy);
g_test_add_func ("/datalist/recursive-clear", test_datalist_clear);
- g_test_add_func ("/datalist/recursive-clear/subprocess", test_datalist_clear_subprocess);
return g_test_run ();
}
diff --git a/glib/tests/scannerapi.c b/glib/tests/scannerapi.c
index 3b8e2ec..85d8a02 100644
--- a/glib/tests/scannerapi.c
+++ b/glib/tests/scannerapi.c
@@ -59,20 +59,18 @@ test_scanner_warn (ScannerFixture *fix,
}
static void
-test_scanner_error_subprocess (ScannerFixture *fix,
- gconstpointer test_data)
-{
- int pe = fix->scanner->parse_errors;
- g_scanner_error (fix->scanner, "scanner-error-message-test");
- g_assert_cmpint (fix->scanner->parse_errors, ==, pe + 1);
- exit (0);
-}
-
-static void
test_scanner_error (ScannerFixture *fix,
gconstpointer test_data)
{
- g_test_trap_subprocess ("/scanner/error/subprocess", 0, 0);
+ if (g_test_subprocess ())
+ {
+ int pe = fix->scanner->parse_errors;
+ g_scanner_error (fix->scanner, "scanner-error-message-test");
+ g_assert_cmpint (fix->scanner->parse_errors, ==, pe + 1);
+ exit (0);
+ }
+
+ g_test_trap_subprocess (NULL, 0, 0);
g_test_trap_assert_passed ();
g_test_trap_assert_stderr ("*scanner-error-message-test*");
}
@@ -139,7 +137,6 @@ main (int argc,
g_test_add ("/scanner/warn", ScannerFixture, 0, scanner_fixture_setup, test_scanner_warn,
scanner_fixture_teardown);
g_test_add ("/scanner/error", ScannerFixture, 0, scanner_fixture_setup, test_scanner_error,
scanner_fixture_teardown);
- g_test_add ("/scanner/error/subprocess", ScannerFixture, 0, scanner_fixture_setup,
test_scanner_error_subprocess, scanner_fixture_teardown);
g_test_add ("/scanner/symbols", ScannerFixture, 0, scanner_fixture_setup, test_scanner_symbols,
scanner_fixture_teardown);
g_test_add ("/scanner/tokens", ScannerFixture, 0, scanner_fixture_setup, test_scanner_tokens,
scanner_fixture_teardown);
diff --git a/glib/tests/slice.c b/glib/tests/slice.c
index c2226cd..cd3b0ca 100644
--- a/glib/tests/slice.c
+++ b/glib/tests/slice.c
@@ -4,15 +4,14 @@
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
static void
-test_slice_config_subprocess (void)
-{
- g_slice_set_config (G_SLICE_CONFIG_ALWAYS_MALLOC, TRUE);
-}
-
-static void
test_slice_config (void)
{
- g_test_trap_subprocess ("/slice/config/subprocess", 1000000, 0);
+ if (g_test_subprocess ())
+ {
+ g_slice_set_config (G_SLICE_CONFIG_ALWAYS_MALLOC, TRUE);
+ return;
+ }
+ g_test_trap_subprocess (NULL, 1000000, 0);
g_test_trap_assert_failed ();
}
@@ -30,7 +29,6 @@ main (int argc, char **argv)
g_test_init (&argc, &argv, NULL);
g_test_add_func ("/slice/config", test_slice_config);
- g_test_add_func ("/slice/config/subprocess", test_slice_config_subprocess);
return g_test_run ();
}
diff --git a/glib/tests/test-printf.c b/glib/tests/test-printf.c
index 9330e1e..e17585b 100644
--- a/glib/tests/test-printf.c
+++ b/glib/tests/test-printf.c
@@ -610,24 +610,23 @@ test_positional_params (void)
}
static void
-test_positional_params2_subprocess (void)
+test_positional_params2 (void)
{
- gint res;
+ if (g_test_subprocess ())
+ {
+ gint res;
- res = g_printf ("%2$c %1$c\n", 'b', 'a');
- g_assert_cmpint (res, ==, 4);
+ res = g_printf ("%2$c %1$c\n", 'b', 'a');
+ g_assert_cmpint (res, ==, 4);
- res = g_printf ("%1$*2$.*3$s\n", "abc", 5, 2);
- g_assert_cmpint (res, ==, 6);
+ res = g_printf ("%1$*2$.*3$s\n", "abc", 5, 2);
+ g_assert_cmpint (res, ==, 6);
- res = g_printf ("%1$s%1$s\n", "abc");
- g_assert_cmpint (res, ==, 7);
-}
-
-static void
-test_positional_params2 (void)
-{
- g_test_trap_subprocess ("/printf/test-positional-params/subprocess", 0, 0);
+ res = g_printf ("%1$s%1$s\n", "abc");
+ g_assert_cmpint (res, ==, 7);
+ return;
+ }
+ g_test_trap_subprocess (NULL, 0, 0);
g_test_trap_assert_passed ();
g_test_trap_assert_stdout ("a b\n ab\nabcabc\n");
}
@@ -652,18 +651,17 @@ test_positional_params3 (void)
}
static void
-test_percent2_subprocess (void)
-{
- gint res;
-
- res = g_printf ("%%");
- g_assert_cmpint (res, ==, 1);
-}
-
-static void
test_percent2 (void)
{
- g_test_trap_subprocess ("/printf/test-percent/subprocess", 0, 0);
+ if (g_test_subprocess ())
+ {
+ gint res;
+
+ res = g_printf ("%%");
+ g_assert_cmpint (res, ==, 1);
+ return;
+ }
+ g_test_trap_subprocess (NULL, 0, 0);
g_test_trap_assert_passed ();
g_test_trap_assert_stdout ("*%*");
}
@@ -907,9 +905,7 @@ main (int argc,
g_test_add_func ("/snprintf/test-64bit", test_64bit);
g_test_add_func ("/printf/test-percent", test_percent2);
- g_test_add_func ("/printf/test-percent/subprocess", test_percent2_subprocess);
g_test_add_func ("/printf/test-positional-params", test_positional_params2);
- g_test_add_func ("/printf/test-positional-params/subprocess", test_positional_params2_subprocess);
g_test_add_func ("/printf/test-64bit", test_64bit2);
g_test_add_func ("/printf/test-64bit/subprocess/base", test_64bit2_base);
#ifdef G_OS_WIN32
diff --git a/glib/tests/testing.c b/glib/tests/testing.c
index 3a89370..20c2e79 100644
--- a/glib/tests/testing.c
+++ b/glib/tests/testing.c
@@ -134,65 +134,61 @@ G_GNUC_END_IGNORE_DEPRECATIONS
#endif /* G_OS_UNIX */
static void
-test_subprocess_fail_child (void)
-{
- g_assert_not_reached ();
-}
-
-static void
test_subprocess_fail (void)
{
- g_test_trap_subprocess ("/trap_subprocess/fail/subprocess", 0, 0);
- g_test_trap_assert_failed ();
- g_test_trap_assert_stderr ("*ERROR*test_subprocess_fail_child*should not be reached*");
-}
+ if (g_test_subprocess ())
+ {
+ g_assert_not_reached ();
+ return;
+ }
-static void
-test_subprocess_no_such_test_child (void)
-{
- g_test_trap_subprocess ("/trap_subprocess/this-test-does-not-exist", 0, 0);
- g_assert_not_reached ();
+ g_test_trap_subprocess (NULL, 0, 0);
+ g_test_trap_assert_failed ();
+ g_test_trap_assert_stderr ("*ERROR*test_subprocess_fail*should not be reached*");
}
static void
test_subprocess_no_such_test (void)
{
- g_test_trap_subprocess ("/trap_subprocess/no-such-test/subprocess", 0, 0);
+ if (g_test_subprocess ())
+ {
+ g_test_trap_subprocess ("/trap_subprocess/this-test-does-not-exist", 0, 0);
+ g_assert_not_reached ();
+ return;
+ }
+ g_test_trap_subprocess (NULL, 0, 0);
g_test_trap_assert_failed ();
g_test_trap_assert_stderr ("*test does not exist*");
g_test_trap_assert_stderr_unmatched ("*should not be reached*");
}
static void
-test_subprocess_patterns_child (void)
-{
- g_print ("some stdout text: somagic17\n");
- g_printerr ("some stderr text: semagic43\n");
- exit (0);
-}
-
-static void
test_subprocess_patterns (void)
{
- g_test_trap_subprocess ("/trap_subprocess/patterns/subprocess", 0, 0);
+ if (g_test_subprocess ())
+ {
+ g_print ("some stdout text: somagic17\n");
+ g_printerr ("some stderr text: semagic43\n");
+ exit (0);
+ }
+ g_test_trap_subprocess (NULL, 0, 0);
g_test_trap_assert_passed ();
g_test_trap_assert_stdout ("*somagic17*");
g_test_trap_assert_stderr ("*semagic43*");
}
static void
-test_subprocess_timeout_child (void)
-{
- /* loop and sleep forever */
- while (TRUE)
- g_usleep (1000 * 1000);
-}
-
-static void
test_subprocess_timeout (void)
{
+ if (g_test_subprocess ())
+ {
+ /* loop and sleep forever */
+ while (TRUE)
+ g_usleep (1000 * 1000);
+ return;
+ }
/* allow child to run for only a fraction of a second */
- g_test_trap_subprocess ("/trap_subprocess/timeout/subprocess", 0.11 * 1000000, 0);
+ g_test_trap_subprocess (NULL, 0.11 * 1000000, 0);
g_test_trap_assert_failed ();
g_assert (g_test_trap_reached_timeout ());
}
@@ -564,19 +560,16 @@ test_dash_p (void)
}
static void
-test_nonfatal_subprocess (void)
-{
- g_test_set_nonfatal_assertions ();
-
- g_assert_cmpint (4, ==, 5);
-
- g_print ("The End\n");
-}
-
-static void
test_nonfatal (void)
{
- g_test_trap_subprocess ("/misc/nonfatal/subprocess", 0, 0);
+ if (g_test_subprocess ())
+ {
+ g_test_set_nonfatal_assertions ();
+ g_assert_cmpint (4, ==, 5);
+ g_print ("The End\n");
+ return;
+ }
+ g_test_trap_subprocess (NULL, 0, 0);
g_test_trap_assert_failed ();
g_test_trap_assert_stderr ("*assertion failed*4 == 5*");
g_test_trap_assert_stdout ("*The End*");
@@ -607,16 +600,11 @@ main (int argc,
#endif
g_test_add_func ("/trap_subprocess/fail", test_subprocess_fail);
- g_test_add_func ("/trap_subprocess/fail/subprocess", test_subprocess_fail_child);
g_test_add_func ("/trap_subprocess/no-such-test", test_subprocess_no_such_test);
- g_test_add_func ("/trap_subprocess/no-such-test/subprocess", test_subprocess_no_such_test_child);
if (g_test_slow ())
- {
- g_test_add_func ("/trap_subprocess/timeout", test_subprocess_timeout);
- g_test_add_func ("/trap_subprocess/timeout/subprocess", test_subprocess_timeout_child);
- }
+ g_test_add_func ("/trap_subprocess/timeout", test_subprocess_timeout);
+
g_test_add_func ("/trap_subprocess/patterns", test_subprocess_patterns);
- g_test_add_func ("/trap_subprocess/patterns/subprocess", test_subprocess_patterns_child);
g_test_add_func ("/misc/fatal-log-handler", test_fatal_log_handler);
g_test_add_func ("/misc/fatal-log-handler/subprocess/critical-pass", test_fatal_log_handler_critical_pass);
@@ -644,7 +632,6 @@ main (int argc,
g_test_add_func ("/misc/dash-p/subprocess/hidden/sub", test_dash_p_hidden_sub);
g_test_add_func ("/misc/nonfatal", test_nonfatal);
- g_test_add_func ("/misc/nonfatal/subprocess", test_nonfatal_subprocess);
return g_test_run();
}
diff --git a/glib/tests/utils.c b/glib/tests/utils.c
index 3808b5a..8513b32 100644
--- a/glib/tests/utils.c
+++ b/glib/tests/utils.c
@@ -261,20 +261,6 @@ test_find_program (void)
}
static void
-test_debug_help (void)
-{
- GDebugKey keys[] = {
- { "key1", 1 },
- { "key2", 2 },
- { "key3", 4 },
- };
- guint res;
-
- res = g_parse_debug_string ("help", keys, G_N_ELEMENTS (keys));
- g_assert_cmpint (res, ==, 0);
-}
-
-static void
test_debug (void)
{
GDebugKey keys[] = {
@@ -308,7 +294,13 @@ test_debug (void)
res = g_parse_debug_string ("all", keys, G_N_ELEMENTS (keys));
g_assert_cmpint (res, ==, 7);
- g_test_trap_subprocess ("/utils/debug/subprocess/help", 0, 0);
+ if (g_test_subprocess ())
+ {
+ res = g_parse_debug_string ("help", keys, G_N_ELEMENTS (keys));
+ g_assert_cmpint (res, ==, 0);
+ return;
+ }
+ g_test_trap_subprocess (NULL, 0, 0);
g_test_trap_assert_passed ();
g_test_trap_assert_stderr ("*Supported debug values: key1 key2 key3 all help*");
}
@@ -520,15 +512,14 @@ atexit_func (void)
}
static void
-test_atexit_subprocess (void)
-{
- g_atexit (atexit_func);
-}
-
-static void
test_atexit (void)
{
- g_test_trap_subprocess ("/utils/atexit/subprocess", 0, 0);
+ if (g_test_subprocess ())
+ {
+ g_atexit (atexit_func);
+ return;
+ }
+ g_test_trap_subprocess (NULL, 0, 0);
g_test_trap_assert_passed ();
g_test_trap_assert_stdout ("*atexit called*");
}
@@ -563,7 +554,6 @@ main (int argc,
g_test_add_func ("/utils/swap", test_swap);
g_test_add_func ("/utils/find-program", test_find_program);
g_test_add_func ("/utils/debug", test_debug);
- g_test_add_func ("/utils/debug/subprocess/help", test_debug_help);
g_test_add_func ("/utils/codeset", test_codeset);
g_test_add_func ("/utils/basename", test_basename);
g_test_add_func ("/utils/gettext", test_gettext);
@@ -579,7 +569,6 @@ main (int argc,
g_test_add_func ("/utils/misc-mem", test_misc_mem);
g_test_add_func ("/utils/nullify", test_nullify);
g_test_add_func ("/utils/atexit", test_atexit);
- g_test_add_func ("/utils/atexit/subprocess", test_atexit_subprocess);
return g_test_run ();
}
diff --git a/gobject/tests/object.c b/gobject/tests/object.c
index 63c85a8..f6e75d5 100644
--- a/gobject/tests/object.c
+++ b/gobject/tests/object.c
@@ -118,18 +118,17 @@ my_infanticide_object_class_init (MyInfanticideObjectClass *klass)
}
static void
-test_object_constructor_infanticide_subprocess (void)
-{
- g_object_new (my_infanticide_object_get_type (), NULL);
- g_assert_not_reached ();
-}
-
-static void
test_object_constructor_infanticide (void)
{
g_test_bug ("661576");
- g_test_trap_subprocess ("/object/constructor/infanticide/subprocess", 0, 0);
+ if (g_test_subprocess ())
+ {
+ g_object_new (my_infanticide_object_get_type (), NULL);
+ g_assert_not_reached ();
+ return;
+ }
+ g_test_trap_subprocess (NULL, 0, 0);
g_test_trap_assert_failed ();
g_test_trap_assert_stderr ("*finalized while still in-construction*");
g_test_trap_assert_stderr_unmatched ("*reached*");
@@ -145,7 +144,6 @@ main (int argc, char *argv[])
g_test_add_func ("/object/constructor/singleton", test_object_constructor_singleton);
g_test_add_func ("/object/constructor/infanticide", test_object_constructor_infanticide);
- g_test_add_func ("/object/constructor/infanticide/subprocess",
test_object_constructor_infanticide_subprocess);
return g_test_run ();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]