From 0f410a6cfe63efa1d0f60e80bc11e560d26efb19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Mon, 16 Jan 2023 19:56:30 +0100 Subject: [PATCH] fixup! gtestutils: Use test print handler to write subprocess output --- glib/gtestutils.c | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/glib/gtestutils.c b/glib/gtestutils.c index cf82e8356..19d40d819 100644 --- a/glib/gtestutils.c +++ b/glib/gtestutils.c @@ -849,10 +849,8 @@ static void gtest_default_log_handler (const gchar *log_domain, GLogLevelFlags log_level, const gchar *message, gpointer unused_data); -static void g_test_default_print (const char *format, - ...) G_GNUC_PRINTF (1, 2); -static void g_test_tap_print (gboolean commented, - unsigned subtest_level, +static void g_test_tap_print (unsigned subtest_level, + gboolean commented, const char *format, ...) G_GNUC_PRINTF (3, 4); @@ -989,8 +987,8 @@ g_test_print_handler (const gchar *string) } static void -g_test_tap_print (gboolean commented, - unsigned subtest_level, +g_test_tap_print (unsigned subtest_level, + gboolean commented, const char *format, ...) { @@ -1103,11 +1101,11 @@ g_test_log (GTestLogType lbit, { if (!is_subtest ()) { - g_test_tap_print (FALSE, 0, "TAP version 13\n"); + g_test_tap_print (0, FALSE, "TAP version 13\n"); } else { - g_test_tap_print (TRUE, subtest_level > 0 ? subtest_level - 1 : 0, + g_test_tap_print (subtest_level > 0 ? subtest_level - 1 : 0, TRUE, "Subtest: %s\n", test_argv0); } @@ -1126,7 +1124,7 @@ g_test_log (GTestLogType lbit, if (string1[0] != 0) g_print ("Start of %s tests\n", string1); else if (test_paths == NULL) - g_test_tap_print (FALSE, subtest_level, "1..%d\n", test_count); + g_test_tap_print (subtest_level, FALSE, "1..%d\n", test_count); } break; case G_TEST_LOG_STOP_SUITE: @@ -1138,7 +1136,7 @@ g_test_log (GTestLogType lbit, if (string1[0] != 0) g_print ("End of %s tests\n", string1); else if (test_paths != NULL) - g_test_tap_print (FALSE, subtest_level, "1..%d\n", test_run_count); + g_test_tap_print (subtest_level, FALSE, "1..%d\n", test_run_count); } break; case G_TEST_LOG_STOP_CASE: @@ -1181,7 +1179,7 @@ g_test_log (GTestLogType lbit, if (fail && test_mode_fatal) { if (test_tap_log) - g_test_tap_print (FALSE, 0, "Bail out!\n"); + g_test_tap_print (0, FALSE, "Bail out!\n"); g_abort (); } if (result == G_TEST_RUN_SKIPPED || result == G_TEST_RUN_INCOMPLETE) @@ -1190,7 +1188,7 @@ g_test_log (GTestLogType lbit, case G_TEST_LOG_SKIP_CASE: if (test_tap_log) { - g_test_tap_print (FALSE, subtest_level, "ok %d %s # SKIP\n", + g_test_tap_print (subtest_level, FALSE, "ok %d %s # SKIP\n", test_run_count, string1); } break; @@ -1214,7 +1212,7 @@ g_test_log (GTestLogType lbit, break; case G_TEST_LOG_ERROR: if (test_tap_log) - g_test_tap_print (FALSE, 0, "Bail out! %s\n", string1); + g_test_tap_print (0, FALSE, "Bail out! %s\n", string1); else if (g_test_verbose ()) g_print ("(ERROR: %s)\n", string1); break;