mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-11 11:56:16 +01:00
gtestutils: Write tap test results atomically
When running multiple tests in parallel using meson, the output could be mixed and if we write the TAP reports in multiple steps the output could be mangled together with other results. An example is: https://gitlab.gnome.org/3v1n0/glib/-/jobs/2507620 Where we have: ok 5 /cancellable/poll-fd# GLib-GIO-DEBUG: Collecting capable appnames: 0ms # Allocating hashtables:...... 0ms # Reading capable apps: 63ms # Reading URL associations:... 0ms # Reading extension assocs: 78ms # Reading exe-only apps:...... 47ms # Reading classes: 312ms # Reading UWP apps: 47ms # Postprocessing:..............16ms # TOTAL: 563ms # SKIP Platform not supported Leading to a clear TAP parsing error
This commit is contained in:
parent
254c71e7c6
commit
5c799ff01d
@ -1034,7 +1034,7 @@ g_test_log (GTestLogType lbit,
|
|||||||
fail = result == G_TEST_RUN_FAILURE;
|
fail = result == G_TEST_RUN_FAILURE;
|
||||||
if (test_tap_log)
|
if (test_tap_log)
|
||||||
{
|
{
|
||||||
const gchar *ok;
|
GString *tap_output;
|
||||||
|
|
||||||
/* The TAP representation for an expected failure starts with
|
/* The TAP representation for an expected failure starts with
|
||||||
* "not ok", even though it does not actually count as failing
|
* "not ok", even though it does not actually count as failing
|
||||||
@ -1043,19 +1043,20 @@ g_test_log (GTestLogType lbit,
|
|||||||
* for which GTestResult does not currently have a
|
* for which GTestResult does not currently have a
|
||||||
* representation. */
|
* representation. */
|
||||||
if (fail || result == G_TEST_RUN_INCOMPLETE)
|
if (fail || result == G_TEST_RUN_INCOMPLETE)
|
||||||
ok = "not ok";
|
tap_output = g_string_new ("not ok");
|
||||||
else
|
else
|
||||||
ok = "ok";
|
tap_output = g_string_new ("ok");
|
||||||
|
|
||||||
g_print ("%s %d %s", ok, test_run_count, string1);
|
g_string_append_printf (tap_output, " %d %s", test_run_count, string1);
|
||||||
if (result == G_TEST_RUN_INCOMPLETE)
|
if (result == G_TEST_RUN_INCOMPLETE)
|
||||||
g_print (" # TODO %s\n", string2 ? string2 : "");
|
g_string_append_printf (tap_output, " # TODO %s", string2 ? string2 : "");
|
||||||
else if (result == G_TEST_RUN_SKIPPED)
|
else if (result == G_TEST_RUN_SKIPPED)
|
||||||
g_print (" # SKIP %s\n", string2 ? string2 : "");
|
g_string_append_printf (tap_output, " # SKIP %s", string2 ? string2 : "");
|
||||||
else if (result == G_TEST_RUN_FAILURE && string2 != NULL)
|
else if (result == G_TEST_RUN_FAILURE && string2 != NULL)
|
||||||
g_print (" - %s\n", string2);
|
g_string_append_printf (tap_output, " - %s", string2);
|
||||||
else
|
|
||||||
g_print ("\n");
|
g_print ("%s\n", tap_output->str);
|
||||||
|
g_string_free (tap_output, TRUE);
|
||||||
}
|
}
|
||||||
else if (g_test_verbose ())
|
else if (g_test_verbose ())
|
||||||
g_print ("GTest: result: %s\n", g_test_result_names[result]);
|
g_print ("GTest: result: %s\n", g_test_result_names[result]);
|
||||||
|
Loading…
Reference in New Issue
Block a user