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 788467 - Fatal errors and warnings should be reported as TAP
Fatal errors and warnings should be reported as TAP
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: general
2.54.x
Other Linux
: Normal enhancement
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2017-10-03 12:39 UTC by Simon McVittie
Modified: 2017-10-03 16:24 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
testutils: Report fatal errors and warnings as TAP (2.85 KB, patch)
2017-10-03 12:39 UTC, Simon McVittie
committed Details | Review
g_test_log: Consistently use GLib whitespace style (2.81 KB, patch)
2017-10-03 14:19 UTC, Simon McVittie
committed Details | Review

Description Simon McVittie 2017-10-03 12:39:48 UTC
Created attachment 360827 [details] [review]
testutils: Report fatal errors and warnings as TAP

Lines starting with "Bail out!" are special TAP syntax: they mark
the entire test execution (one binary or script) as failed, and stop
processing. Automake's parallel test harness knows this, and will print
the diagnostic in the test results, leading to clearer output.

Without this change, having changed glib/tests/bytes.c to emit a
spurious g_warning():

ERROR: bytes - too few tests run (expected 15, got 0)
ERROR: bytes - exited with status 133 (terminated by signal 5?)

With this change, it's clearer what has happened:

ERROR: bytes - Bail out! FATAL-WARNING: I broke this as a demonstration

---

I'm partly proposing this to make developers' lives easier when debugging test failures that happened locally, and partly because autobuilder maintainers reporting a failed build have a tendency to quote the first error seen, and "ERROR: foo - too few tests run" is not very useful.

This should work for any g_error(), and for any g_critical() or g_warning() that has been made fatal.
Comment 1 Philip Withnall 2017-10-03 13:49:42 UTC
Review of attachment 360827 [details] [review]:

Looks good to me. Please push to master with or without the nitpick fix.

::: glib/gtestutils.c
@@ +875,3 @@
+      if (test_tap_log)
+        g_print ("Bail out! %s\n", string1);
+      else if (g_test_verbose())

Nitpick: Missing space before `()` (I realise this is a pre-existing problem from the code above which has been copied, but let’s fix both instances in this patch).
Comment 2 Simon McVittie 2017-10-03 14:19:14 UTC
Comment on attachment 360827 [details] [review]
testutils: Report fatal errors and warnings as TAP

Committed as 23ba8aec9, thanks.

(In reply to Philip Withnall from comment #1)
> Nitpick: Missing space before `()` (I realise this is a pre-existing problem
> from the code above which has been copied, but let’s fix both instances in
> this patch).

It's sufficiently consistently wrong that I didn't feel comfortable changing it, because having fixed one instance, it seemed strange not to fix the next, and it turns out there are quite a lot in that function. I've prepared another commit instead.
Comment 3 Simon McVittie 2017-10-03 14:19:57 UTC
Created attachment 360841 [details] [review]
g_test_log: Consistently use GLib whitespace style
Comment 4 Philip Withnall 2017-10-03 15:21:02 UTC
Review of attachment 360841 [details] [review]:

You are an excellent person, thank you.
Comment 5 Simon McVittie 2017-10-03 16:23:31 UTC
Comment on attachment 360841 [details] [review]
g_test_log: Consistently use GLib whitespace style

Pushed as 733c7bd9c
Comment 6 Simon McVittie 2017-10-03 16:24:16 UTC
Fixed in git for 2.55.0