diff options
author | Simon McVittie <smcv@collabora.com> | 2022-03-31 14:30:43 +0100 |
---|---|---|
committer | Simon McVittie <smcv@collabora.com> | 2022-06-23 10:47:13 +0100 |
commit | de8672fe0b9f55047fbaee6f425e330cdfc8189f (patch) | |
tree | 7f42cf9a6935ccf698132a6a7076ab1caaa47500 /glib/tests | |
parent | f59e02a1439c70616547d51abf0a6da33e095e80 (diff) | |
download | glib-de8672fe0b9f55047fbaee6f425e330cdfc8189f.tar.gz |
gtestutils: Add G_TEST_SUBPROCESS_DEFAULT, G_TEST_TRAP_DEFAULT
This makes calls to test subprocesses with default behaviour more
self-documenting.
Signed-off-by: Simon McVittie <smcv@collabora.com>
Diffstat (limited to 'glib/tests')
-rw-r--r-- | glib/tests/array-test.c | 4 | ||||
-rw-r--r-- | glib/tests/convert.c | 24 | ||||
-rw-r--r-- | glib/tests/dataset.c | 2 | ||||
-rw-r--r-- | glib/tests/error.c | 2 | ||||
-rw-r--r-- | glib/tests/gvariant.c | 2 | ||||
-rw-r--r-- | glib/tests/hash.c | 3 | ||||
-rw-r--r-- | glib/tests/list.c | 2 | ||||
-rw-r--r-- | glib/tests/logging.c | 55 | ||||
-rw-r--r-- | glib/tests/mem-overflow.c | 9 | ||||
-rw-r--r-- | glib/tests/refcount.c | 4 | ||||
-rw-r--r-- | glib/tests/scannerapi.c | 2 | ||||
-rw-r--r-- | glib/tests/slice.c | 4 | ||||
-rw-r--r-- | glib/tests/spawn-singlethread.c | 2 | ||||
-rw-r--r-- | glib/tests/test-printf.c | 10 | ||||
-rw-r--r-- | glib/tests/testing.c | 102 | ||||
-rw-r--r-- | glib/tests/thread-pool.c | 2 | ||||
-rw-r--r-- | glib/tests/utils.c | 9 | ||||
-rw-r--r-- | glib/tests/win32.c | 9 |
18 files changed, 152 insertions, 95 deletions
diff --git a/glib/tests/array-test.c b/glib/tests/array-test.c index 9395607ef..cd617200a 100644 --- a/glib/tests/array-test.c +++ b/glib/tests/array-test.c @@ -861,7 +861,7 @@ array_overflow_append_vals (void) } else { - g_test_trap_subprocess (NULL, 0, 0); + g_test_trap_subprocess (NULL, 0, G_TEST_SUBPROCESS_DEFAULT); g_test_trap_assert_failed (); g_test_trap_assert_stderr ("*adding 4294967295 to array would overflow*"); } @@ -880,7 +880,7 @@ array_overflow_set_size (void) } else { - g_test_trap_subprocess (NULL, 0, 0); + g_test_trap_subprocess (NULL, 0, G_TEST_SUBPROCESS_DEFAULT); g_test_trap_assert_failed (); g_test_trap_assert_stderr ("*adding 4294967295 to array would overflow*"); } diff --git a/glib/tests/convert.c b/glib/tests/convert.c index 9a1a25ab7..6daeec237 100644 --- a/glib/tests/convert.c +++ b/glib/tests/convert.c @@ -709,9 +709,11 @@ test_convert_embedded_nul (void) static void test_locale_to_utf8_embedded_nul (void) { - g_test_trap_subprocess ("/conversion/locale-to-utf8/embedded-nul/subprocess/utf8", 0, 0); + g_test_trap_subprocess ("/conversion/locale-to-utf8/embedded-nul/subprocess/utf8", + 0, G_TEST_SUBPROCESS_DEFAULT); g_test_trap_assert_passed (); - g_test_trap_subprocess ("/conversion/locale-to-utf8/embedded-nul/subprocess/iconv", 0, 0); + g_test_trap_subprocess ("/conversion/locale-to-utf8/embedded-nul/subprocess/iconv", + 0, G_TEST_SUBPROCESS_DEFAULT); g_test_trap_assert_passed (); } @@ -760,9 +762,11 @@ test_locale_to_utf8_embedded_nul_iconv (void) static void test_locale_from_utf8_embedded_nul (void) { - g_test_trap_subprocess ("/conversion/locale-from-utf8/embedded-nul/subprocess/utf8", 0, 0); + g_test_trap_subprocess ("/conversion/locale-from-utf8/embedded-nul/subprocess/utf8", + 0, G_TEST_SUBPROCESS_DEFAULT); g_test_trap_assert_passed (); - g_test_trap_subprocess ("/conversion/locale-from-utf8/embedded-nul/subprocess/iconv", 0, 0); + g_test_trap_subprocess ("/conversion/locale-from-utf8/embedded-nul/subprocess/iconv", + 0, G_TEST_SUBPROCESS_DEFAULT); g_test_trap_assert_passed (); } @@ -813,9 +817,11 @@ test_locale_from_utf8_embedded_nul_iconv (void) static void test_filename_to_utf8_embedded_nul (void) { - g_test_trap_subprocess ("/conversion/filename-to-utf8/embedded-nul/subprocess/utf8", 0, 0); + g_test_trap_subprocess ("/conversion/filename-to-utf8/embedded-nul/subprocess/utf8", + 0, G_TEST_SUBPROCESS_DEFAULT); g_test_trap_assert_passed (); - g_test_trap_subprocess ("/conversion/filename-to-utf8/embedded-nul/subprocess/iconv", 0, 0); + g_test_trap_subprocess ("/conversion/filename-to-utf8/embedded-nul/subprocess/iconv", + 0, G_TEST_SUBPROCESS_DEFAULT); g_test_trap_assert_passed (); } @@ -870,9 +876,11 @@ test_filename_to_utf8_embedded_nul_iconv (void) static void test_filename_from_utf8_embedded_nul (void) { - g_test_trap_subprocess ("/conversion/filename-from-utf8/embedded-nul/subprocess/utf8", 0, 0); + g_test_trap_subprocess ("/conversion/filename-from-utf8/embedded-nul/subprocess/utf8", + 0, G_TEST_SUBPROCESS_DEFAULT); g_test_trap_assert_passed (); - g_test_trap_subprocess ("/conversion/filename-from-utf8/embedded-nul/subprocess/iconv", 0, 0); + g_test_trap_subprocess ("/conversion/filename-from-utf8/embedded-nul/subprocess/iconv", + 0, G_TEST_SUBPROCESS_DEFAULT); g_test_trap_assert_passed (); } diff --git a/glib/tests/dataset.c b/glib/tests/dataset.c index b02b3e42b..3b96b42a7 100644 --- a/glib/tests/dataset.c +++ b/glib/tests/dataset.c @@ -202,7 +202,7 @@ test_datalist_clear (void) return; } - g_test_trap_subprocess (NULL, 500000, 0); + g_test_trap_subprocess (NULL, 500000, G_TEST_SUBPROCESS_DEFAULT); g_test_trap_assert_passed (); } diff --git a/glib/tests/error.c b/glib/tests/error.c index 51a0c35dc..7ea04ea3c 100644 --- a/glib/tests/error.c +++ b/glib/tests/error.c @@ -336,7 +336,7 @@ test_extended_duplicate (void) if (!g_test_subprocess ()) { /* Spawn a subprocess and expect it to fail. */ - g_test_trap_subprocess (NULL, 0, 0); + g_test_trap_subprocess (NULL, 0, G_TEST_SUBPROCESS_DEFAULT); g_test_trap_assert_failed (); g_test_trap_assert_stderr ("*CRITICAL*Attempted to register an extended error domain for TestError more than once*"); } diff --git a/glib/tests/gvariant.c b/glib/tests/gvariant.c index 470688c15..918f13ebd 100644 --- a/glib/tests/gvariant.c +++ b/glib/tests/gvariant.c @@ -2936,7 +2936,7 @@ static void do_failed_test (const char *test, const gchar *pattern) { - g_test_trap_subprocess (test, 1000000, 0); + g_test_trap_subprocess (test, 1000000, G_TEST_SUBPROCESS_DEFAULT); g_test_trap_assert_failed (); g_test_trap_assert_stderr (pattern); } diff --git a/glib/tests/hash.c b/glib/tests/hash.c index 5bb6ff3bd..32d357979 100644 --- a/glib/tests/hash.c +++ b/glib/tests/hash.c @@ -875,7 +875,8 @@ test_recursive_remove_all_subprocess (void) static void test_recursive_remove_all (void) { - g_test_trap_subprocess ("/hash/recursive-remove-all/subprocess", 1000000, 0); + g_test_trap_subprocess ("/hash/recursive-remove-all/subprocess", 1000000, + G_TEST_SUBPROCESS_DEFAULT); g_test_trap_assert_passed (); } diff --git a/glib/tests/list.c b/glib/tests/list.c index 4efd8b625..20d01db08 100644 --- a/glib/tests/list.c +++ b/glib/tests/list.c @@ -552,7 +552,7 @@ test_double_free (void) return; } - g_test_trap_subprocess (NULL, 0, 0); + g_test_trap_subprocess (NULL, 0, G_TEST_SUBPROCESS_DEFAULT); g_test_trap_assert_failed (); g_test_trap_assert_stderr ("*corrupted double-linked list detected*"); } diff --git a/glib/tests/logging.c b/glib/tests/logging.c index b79362a7d..e58b405a2 100644 --- a/glib/tests/logging.c +++ b/glib/tests/logging.c @@ -200,48 +200,59 @@ test_default_handler_0x400 (void) static void test_default_handler (void) { - g_test_trap_subprocess ("/logging/default-handler/subprocess/error", 0, 0); + g_test_trap_subprocess ("/logging/default-handler/subprocess/error", 0, + G_TEST_SUBPROCESS_DEFAULT); g_test_trap_assert_failed (); g_test_trap_assert_stderr ("*ERROR*message1*"); - g_test_trap_subprocess ("/logging/default-handler/subprocess/critical", 0, 0); + g_test_trap_subprocess ("/logging/default-handler/subprocess/critical", 0, + G_TEST_SUBPROCESS_DEFAULT); g_test_trap_assert_failed (); g_test_trap_assert_stderr ("*CRITICAL*message2*"); - g_test_trap_subprocess ("/logging/default-handler/subprocess/warning", 0, 0); + g_test_trap_subprocess ("/logging/default-handler/subprocess/warning", 0, + G_TEST_SUBPROCESS_DEFAULT); g_test_trap_assert_failed (); g_test_trap_assert_stderr ("*WARNING*message3*"); - g_test_trap_subprocess ("/logging/default-handler/subprocess/message", 0, 0); + g_test_trap_subprocess ("/logging/default-handler/subprocess/message", 0, + G_TEST_SUBPROCESS_DEFAULT); g_test_trap_assert_passed (); g_test_trap_assert_stderr ("*Message*message4*"); - g_test_trap_subprocess ("/logging/default-handler/subprocess/info", 0, 0); + g_test_trap_subprocess ("/logging/default-handler/subprocess/info", 0, + G_TEST_SUBPROCESS_DEFAULT); g_test_trap_assert_passed (); g_test_trap_assert_stdout_unmatched ("*INFO*message5*"); - g_test_trap_subprocess ("/logging/default-handler/subprocess/bar-info", 0, 0); + g_test_trap_subprocess ("/logging/default-handler/subprocess/bar-info", 0, + G_TEST_SUBPROCESS_DEFAULT); g_test_trap_assert_passed (); g_test_trap_assert_stdout ("*INFO*message5*"); - g_test_trap_subprocess ("/logging/default-handler/subprocess/baz-debug", 0, 0); + g_test_trap_subprocess ("/logging/default-handler/subprocess/baz-debug", 0, + G_TEST_SUBPROCESS_DEFAULT); g_test_trap_assert_passed (); g_test_trap_assert_stdout ("*DEBUG*message6*"); - g_test_trap_subprocess ("/logging/default-handler/subprocess/debug", 0, 0); + g_test_trap_subprocess ("/logging/default-handler/subprocess/debug", 0, + G_TEST_SUBPROCESS_DEFAULT); g_test_trap_assert_passed (); g_test_trap_assert_stdout ("*DEBUG*6*6*6*"); - g_test_trap_subprocess ("/logging/default-handler/subprocess/debug-stderr", 0, 0); + g_test_trap_subprocess ("/logging/default-handler/subprocess/debug-stderr", 0, + G_TEST_SUBPROCESS_DEFAULT); g_test_trap_assert_passed (); g_test_trap_assert_stdout_unmatched ("DEBUG"); g_test_trap_assert_stderr ("*DEBUG*6*6*6*"); - g_test_trap_subprocess ("/logging/default-handler/subprocess/0x400", 0, 0); + g_test_trap_subprocess ("/logging/default-handler/subprocess/0x400", 0, + G_TEST_SUBPROCESS_DEFAULT); g_test_trap_assert_passed (); g_test_trap_assert_stdout ("*LOG-0x400*message7*"); - g_test_trap_subprocess ("/logging/default-handler/subprocess/would-drop", 0, 0); + g_test_trap_subprocess ("/logging/default-handler/subprocess/would-drop", 0, + G_TEST_SUBPROCESS_DEFAULT); g_test_trap_assert_passed (); } @@ -254,7 +265,7 @@ test_fatal_log_mask (void) g_log ("bu", G_LOG_LEVEL_INFO, "fatal"); return; } - g_test_trap_subprocess (NULL, 0, 0); + g_test_trap_subprocess (NULL, 0, G_TEST_SUBPROCESS_DEFAULT); g_test_trap_assert_failed (); /* G_LOG_LEVEL_INFO isn't printed by default */ g_test_trap_assert_stdout_unmatched ("*fatal*"); @@ -361,7 +372,7 @@ test_gibberish (void) g_warning ("bla bla \236\237\190"); return; } - g_test_trap_subprocess (NULL, 0, 0); + g_test_trap_subprocess (NULL, 0, G_TEST_SUBPROCESS_DEFAULT); g_test_trap_assert_failed (); g_test_trap_assert_stderr ("*bla bla \\x9e\\x9f\\u000190*"); } @@ -465,7 +476,7 @@ test_structured_logging_no_state (void) } else { - g_test_trap_subprocess (NULL, 0, 0); + g_test_trap_subprocess (NULL, 0, G_TEST_SUBPROCESS_DEFAULT); g_test_trap_assert_passed (); } } @@ -494,7 +505,7 @@ test_structured_logging_some_state (void) } else { - g_test_trap_subprocess (NULL, 0, 0); + g_test_trap_subprocess (NULL, 0, G_TEST_SUBPROCESS_DEFAULT); g_test_trap_assert_passed (); } } @@ -517,7 +528,7 @@ test_structured_logging_robustness (void) } else { - g_test_trap_subprocess (NULL, 0, 0); + g_test_trap_subprocess (NULL, 0, G_TEST_SUBPROCESS_DEFAULT); g_test_trap_assert_passed (); } } @@ -568,7 +579,7 @@ test_structured_logging_roundtrip1 (void) } else { - g_test_trap_subprocess (NULL, 0, 0); + g_test_trap_subprocess (NULL, 0, G_TEST_SUBPROCESS_DEFAULT); g_test_trap_assert_passed (); } } @@ -603,7 +614,7 @@ test_structured_logging_roundtrip2 (void) } else { - g_test_trap_subprocess (NULL, 0, 0); + g_test_trap_subprocess (NULL, 0, G_TEST_SUBPROCESS_DEFAULT); g_test_trap_assert_passed (); } } @@ -632,7 +643,7 @@ test_structured_logging_roundtrip3 (void) } else { - g_test_trap_subprocess (NULL, 0, 0); + g_test_trap_subprocess (NULL, 0, G_TEST_SUBPROCESS_DEFAULT); g_test_trap_assert_passed (); } } @@ -672,7 +683,7 @@ test_structured_logging_variant1 (void) } else { - g_test_trap_subprocess (NULL, 0, 0); + g_test_trap_subprocess (NULL, 0, G_TEST_SUBPROCESS_DEFAULT); g_test_trap_assert_passed (); } } @@ -704,7 +715,7 @@ test_structured_logging_variant2 (void) } else { - g_test_trap_subprocess (NULL, 0, 0); + g_test_trap_subprocess (NULL, 0, G_TEST_SUBPROCESS_DEFAULT); g_test_trap_assert_passed (); } } @@ -721,7 +732,7 @@ test_structured_logging_set_writer_func_twice (void) } else { - g_test_trap_subprocess (NULL, 0, 0); + g_test_trap_subprocess (NULL, 0, G_TEST_SUBPROCESS_DEFAULT); g_test_trap_assert_failed (); } } diff --git a/glib/tests/mem-overflow.c b/glib/tests/mem-overflow.c index fd926854f..66a005684 100644 --- a/glib/tests/mem-overflow.c +++ b/glib/tests/mem-overflow.c @@ -139,7 +139,8 @@ mem_overflow (void) #define CHECK_SUBPROCESS_FAIL(name) do { \ if (g_test_undefined ()) \ { \ - g_test_trap_subprocess ("/mem/overflow/subprocess/" #name, 0, 0); \ + g_test_trap_subprocess ("/mem/overflow/subprocess/" #name, 0, \ + G_TEST_SUBPROCESS_DEFAULT); \ g_test_trap_assert_failed(); \ } \ } while (0) @@ -147,7 +148,8 @@ mem_overflow (void) #define CHECK_SUBPROCESS_PASS(name) do { \ if (g_test_undefined ()) \ { \ - g_test_trap_subprocess ("/mem/overflow/subprocess/" #name, 0, 0); \ + g_test_trap_subprocess ("/mem/overflow/subprocess/" #name, 0, \ + G_TEST_SUBPROCESS_DEFAULT); \ g_test_trap_assert_passed(); \ } \ } while (0) @@ -208,7 +210,8 @@ empty_alloc (void) g_assert_cmpint (sizeof (Empty), ==, 0); - g_test_trap_subprocess ("/mem/empty-alloc/subprocess", 0, 0); + g_test_trap_subprocess ("/mem/empty-alloc/subprocess", 0, + G_TEST_SUBPROCESS_DEFAULT); g_test_trap_assert_passed (); } #endif diff --git a/glib/tests/refcount.c b/glib/tests/refcount.c index 9a906b24e..66d4b3bcf 100644 --- a/glib/tests/refcount.c +++ b/glib/tests/refcount.c @@ -100,7 +100,7 @@ test_grefcount_saturation (void) exit (0); } - g_test_trap_subprocess (NULL, 0, 0); + g_test_trap_subprocess (NULL, 0, G_TEST_SUBPROCESS_DEFAULT); #if defined (G_DISABLE_CHECKS) && defined (__GNUC__) /* With checks disabled we don't get any warning */ @@ -193,7 +193,7 @@ test_gatomicrefcount_saturation (void) exit (0); } - g_test_trap_subprocess (NULL, 0, 0); + g_test_trap_subprocess (NULL, 0, G_TEST_SUBPROCESS_DEFAULT); #if defined (G_DISABLE_CHECKS) && defined (__GNUC__) /* With checks disabled we don't get any warning */ diff --git a/glib/tests/scannerapi.c b/glib/tests/scannerapi.c index 4ee9754d1..cee3956ea 100644 --- a/glib/tests/scannerapi.c +++ b/glib/tests/scannerapi.c @@ -70,7 +70,7 @@ test_scanner_error (ScannerFixture *fix, exit (0); } - g_test_trap_subprocess (NULL, 0, 0); + g_test_trap_subprocess (NULL, 0, G_TEST_SUBPROCESS_DEFAULT); g_test_trap_assert_passed (); g_test_trap_assert_stderr ("*scanner-error-message-test*"); } diff --git a/glib/tests/slice.c b/glib/tests/slice.c index a566280db..7cf53b4f7 100644 --- a/glib/tests/slice.c +++ b/glib/tests/slice.c @@ -25,7 +25,7 @@ test_slice_nodebug (void) g_slice_debug_tree_statistics (); return; } - g_test_trap_subprocess (NULL, 1000000, 0); + g_test_trap_subprocess (NULL, 1000000, G_TEST_SUBPROCESS_DEFAULT); g_test_trap_assert_passed (); g_test_trap_assert_stderr ("*GSlice: MemChecker: root=NULL*"); @@ -53,7 +53,7 @@ test_slice_debug (void) g_slice_debug_tree_statistics (); return; } - g_test_trap_subprocess (NULL, 1000000, 0); + g_test_trap_subprocess (NULL, 1000000, G_TEST_SUBPROCESS_DEFAULT); g_test_trap_assert_passed (); g_test_trap_assert_stderr ("*GSlice: MemChecker: * trunks, * branches, * old branches*"); diff --git a/glib/tests/spawn-singlethread.c b/glib/tests/spawn-singlethread.c index fec9a69d1..e4f15ecab 100644 --- a/glib/tests/spawn-singlethread.c +++ b/glib/tests/spawn-singlethread.c @@ -401,7 +401,7 @@ test_spawn_stderr_socket (void) return; } - g_test_trap_subprocess (NULL, 0, 0); + g_test_trap_subprocess (NULL, 0, G_TEST_SUBPROCESS_DEFAULT); g_test_trap_assert_passed (); } diff --git a/glib/tests/test-printf.c b/glib/tests/test-printf.c index 6eadf1e98..9aca97feb 100644 --- a/glib/tests/test-printf.c +++ b/glib/tests/test-printf.c @@ -639,7 +639,7 @@ test_positional_params2 (void) g_assert_cmpint (res, ==, 7); return; } - g_test_trap_subprocess (NULL, 0, 0); + g_test_trap_subprocess (NULL, 0, G_TEST_SUBPROCESS_DEFAULT); g_test_trap_assert_passed (); g_test_trap_assert_stdout ("a b\n ab\nabcabc\n"); } @@ -674,7 +674,7 @@ test_percent2 (void) g_assert_cmpint (res, ==, 1); return; } - g_test_trap_subprocess (NULL, 0, 0); + g_test_trap_subprocess (NULL, 0, G_TEST_SUBPROCESS_DEFAULT); g_test_trap_assert_passed (); g_test_trap_assert_stdout ("*%*"); } @@ -858,13 +858,15 @@ _Pragma ("GCC diagnostic pop") static void test_64bit2 (void) { - g_test_trap_subprocess ("/printf/test-64bit/subprocess/base", 0, 0); + g_test_trap_subprocess ("/printf/test-64bit/subprocess/base", 0, + G_TEST_SUBPROCESS_DEFAULT); g_test_trap_assert_passed (); g_test_trap_assert_stdout ("123456\n-123456\n123456\n" "361100\n0361100\n1e240\n" "0x1e240\n1E240\n"); #ifdef G_OS_WIN32 - g_test_trap_subprocess ("/printf/test-64bit/subprocess/win32", 0, 0); + g_test_trap_subprocess ("/printf/test-64bit/subprocess/win32", 0, + G_TEST_SUBPROCESS_DEFAULT); g_test_trap_assert_passed (); g_test_trap_assert_stdout ("123456\n-123456\n123456\n" "361100\n0361100\n1e240\n" diff --git a/glib/tests/testing.c b/glib/tests/testing.c index accd5dbfe..60fdb4ccd 100644 --- a/glib/tests/testing.c +++ b/glib/tests/testing.c @@ -208,56 +208,69 @@ test_assertions (void) g_variant_unref (v2); g_variant_unref (v1); - g_test_trap_subprocess ("/misc/assertions/subprocess/bad_cmpvariant_types", 0, 0); + g_test_trap_subprocess ("/misc/assertions/subprocess/bad_cmpvariant_types", 0, + G_TEST_SUBPROCESS_DEFAULT); g_test_trap_assert_failed (); g_test_trap_assert_stderr ("*assertion failed*"); - g_test_trap_subprocess ("/misc/assertions/subprocess/bad_cmpvariant_values", 0, 0); + g_test_trap_subprocess ("/misc/assertions/subprocess/bad_cmpvariant_values", 0, + G_TEST_SUBPROCESS_DEFAULT); g_test_trap_assert_failed (); g_test_trap_assert_stderr ("*assertion failed*"); - g_test_trap_subprocess ("/misc/assertions/subprocess/bad_cmpstr", 0, 0); + g_test_trap_subprocess ("/misc/assertions/subprocess/bad_cmpstr", 0, + G_TEST_SUBPROCESS_DEFAULT); g_test_trap_assert_failed (); g_test_trap_assert_stderr ("*assertion failed*"); - g_test_trap_subprocess ("/misc/assertions/subprocess/bad_cmpstrv_null1", 0, 0); + g_test_trap_subprocess ("/misc/assertions/subprocess/bad_cmpstrv_null1", 0, + G_TEST_SUBPROCESS_DEFAULT); g_test_trap_assert_failed (); g_test_trap_assert_stderr ("*assertion failed*"); - g_test_trap_subprocess ("/misc/assertions/subprocess/bad_cmpstrv_null2", 0, 0); + g_test_trap_subprocess ("/misc/assertions/subprocess/bad_cmpstrv_null2", 0, + G_TEST_SUBPROCESS_DEFAULT); g_test_trap_assert_failed (); g_test_trap_assert_stderr ("*assertion failed*"); - g_test_trap_subprocess ("/misc/assertions/subprocess/bad_cmpstrv_length", 0, 0); + g_test_trap_subprocess ("/misc/assertions/subprocess/bad_cmpstrv_length", 0, + G_TEST_SUBPROCESS_DEFAULT); g_test_trap_assert_failed (); g_test_trap_assert_stderr ("*assertion failed*"); - g_test_trap_subprocess ("/misc/assertions/subprocess/bad_cmpstrv_values", 0, 0); + g_test_trap_subprocess ("/misc/assertions/subprocess/bad_cmpstrv_values", 0, + G_TEST_SUBPROCESS_DEFAULT); g_test_trap_assert_failed (); g_test_trap_assert_stderr ("*assertion failed*"); - g_test_trap_subprocess ("/misc/assertions/subprocess/bad_cmpint", 0, 0); + g_test_trap_subprocess ("/misc/assertions/subprocess/bad_cmpint", 0, + G_TEST_SUBPROCESS_DEFAULT); g_test_trap_assert_failed (); g_test_trap_assert_stderr ("*assertion failed*"); - g_test_trap_subprocess ("/misc/assertions/subprocess/bad_cmpmem_len", 0, 0); + g_test_trap_subprocess ("/misc/assertions/subprocess/bad_cmpmem_len", 0, + G_TEST_SUBPROCESS_DEFAULT); g_test_trap_assert_failed (); g_test_trap_assert_stderr ("*assertion failed*len*"); - g_test_trap_subprocess ("/misc/assertions/subprocess/bad_cmpmem_data", 0, 0); + g_test_trap_subprocess ("/misc/assertions/subprocess/bad_cmpmem_data", 0, + G_TEST_SUBPROCESS_DEFAULT); g_test_trap_assert_failed (); g_test_trap_assert_stderr ("*assertion failed*"); g_test_trap_assert_stderr_unmatched ("*assertion failed*len*"); - g_test_trap_subprocess ("/misc/assertions/subprocess/bad_cmpmem_null", 0, 0); + g_test_trap_subprocess ("/misc/assertions/subprocess/bad_cmpmem_null", 0, + G_TEST_SUBPROCESS_DEFAULT); g_test_trap_assert_failed (); g_test_trap_assert_stderr ("*assertion failed*NULL*"); - g_test_trap_subprocess ("/misc/assertions/subprocess/bad_cmpfloat_epsilon", 0, 0); + g_test_trap_subprocess ("/misc/assertions/subprocess/bad_cmpfloat_epsilon", 0, + G_TEST_SUBPROCESS_DEFAULT); g_test_trap_assert_failed (); g_test_trap_assert_stderr ("*assertion failed*"); - g_test_trap_subprocess ("/misc/assertions/subprocess/bad_no_errno", 0, 0); + g_test_trap_subprocess ("/misc/assertions/subprocess/bad_no_errno", 0, + G_TEST_SUBPROCESS_DEFAULT); g_test_trap_assert_failed (); g_test_trap_assert_stderr ("*assertion failed*"); } @@ -312,7 +325,7 @@ static void test_fork_timeout (void) { /* allow child to run for only a fraction of a second */ - if (g_test_trap_fork (0.11 * 1000000, 0)) + if (g_test_trap_fork (0.11 * 1000000, G_TEST_TRAP_DEFAULT)) { /* loop and sleep forever */ while (TRUE) @@ -334,7 +347,7 @@ test_subprocess_fail (void) return; } - g_test_trap_subprocess (NULL, 0, 0); + g_test_trap_subprocess (NULL, 0, G_TEST_SUBPROCESS_DEFAULT); g_test_trap_assert_failed (); g_test_trap_assert_stderr ("*ERROR*test_subprocess_fail*should not be reached*"); } @@ -344,11 +357,12 @@ test_subprocess_no_such_test (void) { if (g_test_subprocess ()) { - g_test_trap_subprocess ("/trap_subprocess/this-test-does-not-exist", 0, 0); + g_test_trap_subprocess ("/trap_subprocess/this-test-does-not-exist", 0, + G_TEST_SUBPROCESS_DEFAULT); g_assert_not_reached (); return; } - g_test_trap_subprocess (NULL, 0, 0); + g_test_trap_subprocess (NULL, 0, G_TEST_SUBPROCESS_DEFAULT); g_test_trap_assert_failed (); g_test_trap_assert_stderr ("*test does not exist*"); g_test_trap_assert_stderr_unmatched ("*should not be reached*"); @@ -363,7 +377,7 @@ test_subprocess_patterns (void) g_printerr ("some stderr text: semagic43\n"); exit (0); } - g_test_trap_subprocess (NULL, 0, 0); + g_test_trap_subprocess (NULL, 0, G_TEST_SUBPROCESS_DEFAULT); g_test_trap_assert_passed (); g_test_trap_assert_stdout ("*somagic17*"); g_test_trap_assert_stderr ("*semagic43*"); @@ -380,7 +394,7 @@ test_subprocess_timeout (void) return; } /* allow child to run for only a fraction of a second */ - g_test_trap_subprocess (NULL, 0.11 * 1000000, 0); + g_test_trap_subprocess (NULL, 0.11 * 1000000, G_TEST_SUBPROCESS_DEFAULT); g_test_trap_assert_failed (); g_assert_true (g_test_trap_reached_timeout ()); } @@ -508,16 +522,19 @@ test_fatal_log_handler_critical_fail (void) static void test_fatal_log_handler (void) { - g_test_trap_subprocess ("/misc/fatal-log-handler/subprocess/critical-pass", 0, 0); + g_test_trap_subprocess ("/misc/fatal-log-handler/subprocess/critical-pass", 0, + G_TEST_SUBPROCESS_DEFAULT); g_test_trap_assert_passed (); g_test_trap_assert_stderr ("*CRITICAL*g_str_has_prefix*"); g_test_trap_assert_stderr ("*CRITICAL*Test passing*"); - g_test_trap_subprocess ("/misc/fatal-log-handler/subprocess/error-fail", 0, 0); + g_test_trap_subprocess ("/misc/fatal-log-handler/subprocess/error-fail", 0, + G_TEST_SUBPROCESS_DEFAULT); g_test_trap_assert_failed (); g_test_trap_assert_stderr ("*ERROR*Test failing*"); - g_test_trap_subprocess ("/misc/fatal-log-handler/subprocess/critical-fail", 0, 0); + g_test_trap_subprocess ("/misc/fatal-log-handler/subprocess/critical-fail", 0, + G_TEST_SUBPROCESS_DEFAULT); g_test_trap_assert_failed (); g_test_trap_assert_stderr ("*CRITICAL*g_str_has_prefix*"); g_test_trap_assert_stderr_unmatched ("*CRITICAL*Test passing*"); @@ -612,34 +629,41 @@ test_expected_messages_unexpected_extra_warning (void) static void test_expected_messages (void) { - g_test_trap_subprocess ("/misc/expected-messages/subprocess/warning", 0, 0); + g_test_trap_subprocess ("/misc/expected-messages/subprocess/warning", 0, + G_TEST_SUBPROCESS_DEFAULT); g_test_trap_assert_failed (); g_test_trap_assert_stderr ("*This is a * warning*"); g_test_trap_assert_stderr_unmatched ("*should not be reached*"); - g_test_trap_subprocess ("/misc/expected-messages/subprocess/expect-warning", 0, 0); + g_test_trap_subprocess ("/misc/expected-messages/subprocess/expect-warning", 0, + G_TEST_SUBPROCESS_DEFAULT); g_test_trap_assert_failed (); g_test_trap_assert_stderr_unmatched ("*This is a * warning*"); g_test_trap_assert_stderr ("*should not be reached*"); - g_test_trap_subprocess ("/misc/expected-messages/subprocess/wrong-warning", 0, 0); + g_test_trap_subprocess ("/misc/expected-messages/subprocess/wrong-warning", 0, + G_TEST_SUBPROCESS_DEFAULT); g_test_trap_assert_failed (); g_test_trap_assert_stderr_unmatched ("*should not be reached*"); g_test_trap_assert_stderr ("*GLib-CRITICAL*Did not see expected message testing-CRITICAL*should not be *WARNING*This is a * warning*"); - g_test_trap_subprocess ("/misc/expected-messages/subprocess/expected", 0, 0); + g_test_trap_subprocess ("/misc/expected-messages/subprocess/expected", 0, + G_TEST_SUBPROCESS_DEFAULT); g_test_trap_assert_passed (); g_test_trap_assert_stderr (""); - g_test_trap_subprocess ("/misc/expected-messages/subprocess/null-domain", 0, 0); + g_test_trap_subprocess ("/misc/expected-messages/subprocess/null-domain", 0, + G_TEST_SUBPROCESS_DEFAULT); g_test_trap_assert_passed (); g_test_trap_assert_stderr (""); - g_test_trap_subprocess ("/misc/expected-messages/subprocess/extra-warning", 0, 0); + g_test_trap_subprocess ("/misc/expected-messages/subprocess/extra-warning", 0, + G_TEST_SUBPROCESS_DEFAULT); g_test_trap_assert_passed (); g_test_trap_assert_stderr (""); - g_test_trap_subprocess ("/misc/expected-messages/subprocess/unexpected-extra-warning", 0, 0); + g_test_trap_subprocess ("/misc/expected-messages/subprocess/unexpected-extra-warning", 0, + G_TEST_SUBPROCESS_DEFAULT); g_test_trap_assert_failed (); g_test_trap_assert_stderr ("*GLib:ERROR*Did not see expected message testing-CRITICAL*nope*"); } @@ -718,7 +742,8 @@ test_dash_p_child_sub_child (void) static void test_dash_p (void) { - g_test_trap_subprocess ("/misc/dash-p/subprocess/hidden", 0, 0); + g_test_trap_subprocess ("/misc/dash-p/subprocess/hidden", 0, + G_TEST_SUBPROCESS_DEFAULT); g_test_trap_assert_passed (); g_test_trap_assert_stdout ("*Test /misc/dash-p/subprocess/hidden ran*"); g_test_trap_assert_stdout_unmatched ("*Test /misc/dash-p/subprocess/hidden/sub ran*"); @@ -726,7 +751,8 @@ test_dash_p (void) g_test_trap_assert_stdout_unmatched ("*Test /misc/dash-p/subprocess/hidden/sub/subprocess ran*"); g_test_trap_assert_stdout_unmatched ("*Test /misc/dash-p/child*"); - g_test_trap_subprocess ("/misc/dash-p/subprocess/hidden/sub", 0, 0); + g_test_trap_subprocess ("/misc/dash-p/subprocess/hidden/sub", 0, + G_TEST_SUBPROCESS_DEFAULT); g_test_trap_assert_passed (); g_test_trap_assert_stdout ("*Test /misc/dash-p/subprocess/hidden/sub ran*"); g_test_trap_assert_stdout_unmatched ("*Test /misc/dash-p/subprocess/hidden ran*"); @@ -734,7 +760,8 @@ test_dash_p (void) g_test_trap_assert_stdout_unmatched ("*Test /misc/dash-p/subprocess/hidden/subprocess ran*"); g_test_trap_assert_stdout_unmatched ("*Test /misc/dash-p/child*"); - g_test_trap_subprocess ("/misc/dash-p/child", 0, 0); + g_test_trap_subprocess ("/misc/dash-p/child", 0, + G_TEST_SUBPROCESS_DEFAULT); g_test_trap_assert_passed (); g_test_trap_assert_stdout ("*Test /misc/dash-p/child ran*"); g_test_trap_assert_stdout ("*Test /misc/dash-p/child/sub ran*"); @@ -742,7 +769,8 @@ test_dash_p (void) g_test_trap_assert_stdout_unmatched ("*Test /misc/dash-p/child/subprocess ran*"); g_test_trap_assert_stdout_unmatched ("*Test /misc/dash-p/subprocess/hidden*"); - g_test_trap_subprocess ("/misc/dash-p/child/sub", 0, 0); + g_test_trap_subprocess ("/misc/dash-p/child/sub", 0, + G_TEST_SUBPROCESS_DEFAULT); g_test_trap_assert_passed (); g_test_trap_assert_stdout ("*Test /misc/dash-p/child/sub ran*"); g_test_trap_assert_stdout_unmatched ("*Test /misc/dash-p/child ran*"); @@ -761,7 +789,7 @@ test_nonfatal (void) g_print ("The End\n"); return; } - g_test_trap_subprocess (NULL, 0, 0); + g_test_trap_subprocess (NULL, 0, G_TEST_SUBPROCESS_DEFAULT); g_test_trap_assert_failed (); g_test_trap_assert_stderr ("*assertion failed*4 == 5*"); g_test_trap_assert_stdout ("*The End*"); @@ -800,7 +828,7 @@ test_fail (void) subprocess_fail (); return; } - g_test_trap_subprocess (NULL, 0, 0); + g_test_trap_subprocess (NULL, 0, G_TEST_SUBPROCESS_DEFAULT); g_test_trap_assert_failed (); } @@ -822,7 +850,7 @@ test_incomplete (void) subprocess_incomplete (); return; } - g_test_trap_subprocess (NULL, 0, 0); + g_test_trap_subprocess (NULL, 0, G_TEST_SUBPROCESS_DEFAULT); /* An incomplete test represents functionality that is known not to be * implemented yet (an expected failure), so it does not cause test * failure; but it does count as the test having been skipped, which @@ -839,7 +867,7 @@ test_subprocess_timed_out (void) g_usleep (1000000); return; } - g_test_trap_subprocess (NULL, 50000, 0); + g_test_trap_subprocess (NULL, 50000, G_TEST_SUBPROCESS_DEFAULT); g_assert_true (g_test_trap_reached_timeout ()); } diff --git a/glib/tests/thread-pool.c b/glib/tests/thread-pool.c index 5c7081531..23ee27ee3 100644 --- a/glib/tests/thread-pool.c +++ b/glib/tests/thread-pool.c @@ -108,7 +108,7 @@ test_create_first_pool (gconstpointer shared_first) if (!g_test_subprocess ()) { - g_test_trap_subprocess (NULL, 0, 0); + g_test_trap_subprocess (NULL, 0, G_TEST_SUBPROCESS_DEFAULT); g_test_trap_assert_passed (); return; } diff --git a/glib/tests/utils.c b/glib/tests/utils.c index 6318e1916..b732b79b0 100644 --- a/glib/tests/utils.c +++ b/glib/tests/utils.c @@ -523,7 +523,7 @@ test_debug (void) g_assert_cmpint (res, ==, 0); return; } - g_test_trap_subprocess (NULL, 0, 0); + g_test_trap_subprocess (NULL, 0, G_TEST_SUBPROCESS_DEFAULT); g_test_trap_assert_passed (); g_test_trap_assert_stderr ("*Supported debug values: key1 key2 key3 all help*"); } @@ -553,7 +553,7 @@ test_codeset2 (void) g_assert_cmpstr (c, ==, "UTF-8"); return; } - g_test_trap_subprocess (NULL, 0, 0); + g_test_trap_subprocess (NULL, 0, G_TEST_SUBPROCESS_DEFAULT); g_test_trap_assert_passed (); } @@ -956,7 +956,8 @@ test_aligned_mem (void) if (g_test_undefined ()) \ { \ g_test_message (msg); \ - g_test_trap_subprocess ("/utils/aligned-mem/subprocess/" #name, 0, 0); \ + g_test_trap_subprocess ("/utils/aligned-mem/subprocess/" #name, 0, \ + G_TEST_SUBPROCESS_DEFAULT); \ g_test_trap_assert_failed (); \ } \ } while (0) @@ -1024,7 +1025,7 @@ test_atexit (void) g_atexit (atexit_func); return; } - g_test_trap_subprocess (NULL, 0, 0); + g_test_trap_subprocess (NULL, 0, G_TEST_SUBPROCESS_DEFAULT); g_test_trap_assert_passed (); g_test_trap_assert_stdout ("*atexit called*"); } diff --git a/glib/tests/win32.c b/glib/tests/win32.c index 121997311..31816574d 100644 --- a/glib/tests/win32.c +++ b/glib/tests/win32.c @@ -99,7 +99,8 @@ test_veh_crash_access_violation (void) { g_unsetenv ("G_DEBUGGER"); /* Run a test that crashes */ - g_test_trap_subprocess ("/win32/subprocess/access_violation", 0, 0); + g_test_trap_subprocess ("/win32/subprocess/access_violation", 0, + G_TEST_SUBPROCESS_DEFAULT); g_test_trap_assert_failed (); } @@ -108,7 +109,8 @@ test_veh_crash_illegal_instruction (void) { g_unsetenv ("G_DEBUGGER"); /* Run a test that crashes */ - g_test_trap_subprocess ("/win32/subprocess/illegal_instruction", 0, 0); + g_test_trap_subprocess ("/win32/subprocess/illegal_instruction", 0, + G_TEST_SUBPROCESS_DEFAULT); g_test_trap_assert_failed (); } @@ -125,7 +127,8 @@ test_veh_debug (void) g_setenv ("G_DEBUGGER_OLD_CONSOLE", "1", TRUE); g_free (command); /* Run a test that crashes and runs a debugger */ - g_test_trap_subprocess ("/win32/subprocess/debuggee", 0, 0); + g_test_trap_subprocess ("/win32/subprocess/debuggee", 0, + G_TEST_SUBPROCESS_DEFAULT); g_test_trap_assert_failed (); g_test_trap_assert_stderr ("Debugger invoked, attaching to*"); } |