After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 592419 - gtester-report ignores messages output by the tests via g_test_message()
gtester-report ignores messages output by the tests via g_test_message()
Status: RESOLVED OBSOLETE
Product: glib
Classification: Platform
Component: gtest
unspecified
Other All
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
: 668040 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2009-08-20 07:33 UTC by Eugene Shatokhin
Modified: 2018-05-24 11:58 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
A patch to fix the described problem (1.01 KB, application/octet-stream)
2009-08-20 07:33 UTC, Eugene Shatokhin
  Details
[PATCH] Make gtester-report always show g_test_message() (3.67 KB, patch)
2009-12-19 04:31 UTC, Kamal Mostafa
needs-work Details | Review

Description Eugene Shatokhin 2009-08-20 07:33:19 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.
Comment 1 Kamal Mostafa 2009-12-19 04:29:11 UTC
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.
Comment 2 Kamal Mostafa 2009-12-19 04:31:08 UTC
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 .
Comment 3 Matthias Clasen 2010-06-15 06:06:30 UTC
I'd like this; but the patch needs some work to apply after the subunit patch got committed.
Comment 4 Matthias Clasen 2013-02-03 05:38:14 UTC
*** Bug 668040 has been marked as a duplicate of this bug. ***
Comment 5 GNOME Infrastructure Team 2018-05-24 11:58:17 UTC
-- 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.