summaryrefslogtreecommitdiff
path: root/glib/tests/array-test.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2013-12-15 11:20:19 -0500
committerMatthias Clasen <mclasen@redhat.com>2013-12-15 11:50:00 -0500
commitc34cc2348cfd3c461974dea4419001dbd9610202 (patch)
tree8b8783b5058da3a8785678e125bd1a7765b8276a /glib/tests/array-test.c
parentcd2204bb65114e5ac62b014e6167a659aa254361 (diff)
downloadglib-c34cc2348cfd3c461974dea4419001dbd9610202.tar.gz
Simplify subprocesses in tests
Use the new way of running tests in a subprocess without registering extra 'subprocess' test cases where appropriate.
Diffstat (limited to 'glib/tests/array-test.c')
-rw-r--r--glib/tests/array-test.c26
1 files changed, 12 insertions, 14 deletions
diff --git a/glib/tests/array-test.c b/glib/tests/array-test.c
index 7fc2144a8..3bce1e209 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);