GNOME Bugzilla – Bug 592419
gtester-report ignores messages output by the tests via g_test_message()
Last modified: 2018-05-24 11:58:17 UTC
Created attachment 141218 [details] A patch to fix the described problem It seems that gtester-report includes only messages from g_assert()-like functions in the test output but ignores the messages the test has output via g_test_message(). Meanwhile, both types of messages can be present in the xml file generated by gtester. That is, if a test fails, gtester-report looks for its output only in <error>...</error> sections of that xml file but not in <message>...</message>. That can result in test reports like just the following: ERROR:test_glib_arrays.c:9835:test_5_2: assertion failed: (new_size == old_size + n) The test may have output some more messages that could help the developer understand in which circumstances the failure occured and what exactly failed. Like this: Test target(s): g_array_set_size The length of the array is 2, but it should be 3. The following requirement failed: g_array_set_size() sets the size of the array, expanding it if necessary. ERROR:test_glib_arrays.c:9835:test_5_2: assertion failed: (new_size == old_size + n) The first four lines of this report are output by the test via g_test_message() before calling g_assert(new_size == old_size + n). I suppose, it it clearer from the second report what happened in the test than from the first one. The attached patch fixes this issue in gtester-report.
I agree with the submitter... Without his patch, gtester-report does not reference the XML "<message>" blocks at all, so no g_test_message() output ever appears in the HTML report. With his patch, the output from g_test_message() does appear in the Detail pop-up window -- thank you Eugene -- but only if the test case succeeds. In my opinion, the fix should actually go a step further: I think that all g_test_message() messages should always appear in the Detail pop-up regardless of test case success or failure -- that is exactly what it g_test_message() is for. Furthermore, I think that all g_debug() messages (XML "<error>" blocks) should also appear in the Detail pop-up regardless of test case success or failure -- it will help developers notice stray debug messages that have been accidentally been left enabled. My attached patch implements those small changes (and includes Eugene's original patch). The glib test suite only gets a handful of new Detail links from stray (?) debug messages.
Created attachment 150051 [details] [review] [PATCH] Make gtester-report always show g_test_message() Make gtester-report always show any g_test_message() and g_debug() output in the Detail pop-up window, regardless of testcase success or failure. Fixes https://bugzilla.gnome.org/show_bug.cgi?id=592419 .
I'd like this; but the patch needs some work to apply after the subunit patch got committed.
*** Bug 668040 has been marked as a duplicate of this bug. ***
-- GitLab Migration Automatic Message -- This bug has been migrated to GNOME's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/glib/issues/240.