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 754284 - gtestutils: print the TAP test plan first, not last
gtestutils: print the TAP test plan first, not last
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2015-08-29 13:19 UTC by Dan Winship
Modified: 2015-08-31 18:18 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gtestutils: reorganize g_test_name manipulation (3.14 KB, patch)
2015-08-29 13:19 UTC, Dan Winship
committed Details | Review
gtestutils: make g_test_suite_run{,internal} less confusing (5.38 KB, patch)
2015-08-29 13:19 UTC, Dan Winship
committed Details | Review
gtestutils: move "/subprocess" path special-casing (2.45 KB, patch)
2015-08-29 13:19 UTC, Dan Winship
committed Details | Review
gtestutils: print the TAP test plan first, not last (3.51 KB, patch)
2015-08-29 13:19 UTC, Dan Winship
committed Details | Review

Description Dan Winship 2015-08-29 13:19:09 UTC
Some random gtestutils reorganization to let us print the TAP "1..N"
line at the beginning rather than at the end, so that automake won't
claim "missing test plan" when a test program crashes...

(Counting the tests ahead of time is slightly tricky, and this is a
pretty minor improvement, so I'm cool if this gets WONTFIXed.)
Comment 1 Dan Winship 2015-08-29 13:19:12 UTC
Created attachment 310252 [details] [review]
gtestutils: reorganize g_test_name manipulation
Comment 2 Dan Winship 2015-08-29 13:19:16 UTC
Created attachment 310253 [details] [review]
gtestutils: make g_test_suite_run{,internal} less confusing

Rewrite g_test_suite_run() and g_test_suite_run_internal() to make it
clearer what they do (while still preserving exact backward
compatibility, meaning we need to handle the "-p" case differently
from the non-"-p" case).
Comment 3 Dan Winship 2015-08-29 13:19:20 UTC
Created attachment 310254 [details] [review]
gtestutils: move "/subprocess" path special-casing
Comment 4 Dan Winship 2015-08-29 13:19:24 UTC
Created attachment 310255 [details] [review]
gtestutils: print the TAP test plan first, not last

TAP allows you to print the "test plan" (ie, the expected number of
tests" either at the start or the end of the test program, but if you
put it at the end, and the program crashes, automake will complain
"missing test plan", which is confusing to users (particularly since
it prints that *before* it prints that the test program crashed,
suggesting that somehow the lack of test plan was responsible for the
crash or something, rather than vice versa).

Anyway, change it to count the tests ahead of time, and print the test
plan first. Keeping this simple requires disallowing the '-p', '-s',
and '--GTestSkipCount' options when using '--tap' (although we were
already printing the wrong number in the --GTestSkipCount case
anyway).
Comment 5 Emmanuele Bassi (:ebassi) 2015-08-29 14:02:29 UTC
Review of attachment 310252 [details] [review]:

Okay.
Comment 6 Emmanuele Bassi (:ebassi) 2015-08-29 14:04:27 UTC
Review of attachment 310253 [details] [review]:

::: glib/gtestutils.c
@@ +2185,3 @@
+      GTestCase *tc = iter->data;
+
+      test_run_name = g_build_path ("/", old_name, tc->name, NULL);

Mmh, g_build_path() on Windows will generate a test path like '/foo\bar\baz', which is not what we want…

@@ +2198,3 @@
+      GTestSuite *ts = iter->data;
+
+      test_run_name = g_build_path ("/", old_name, ts->name, NULL);

Same as above.
Comment 7 Emmanuele Bassi (:ebassi) 2015-08-29 14:05:10 UTC
Review of attachment 310254 [details] [review]:

Looks good.
Comment 8 Emmanuele Bassi (:ebassi) 2015-08-29 14:06:12 UTC
Review of attachment 310255 [details] [review]:

Looks good.
Comment 9 Dan Winship 2015-08-29 14:16:21 UTC
(In reply to Emmanuele Bassi (:ebassi) from comment #6)
> +      test_run_name = g_build_path ("/", old_name, tc->name, NULL);
> 
> Mmh, g_build_path() on Windows will generate a test path like
> '/foo\bar\baz', which is not what we want…

No, that's g_build_filename(). g_build_path() takes the separator to use as its first argument. (It only took me a few years to be able to remember this distinction reliably...)
Comment 10 Matthias Clasen 2015-08-31 17:31:45 UTC
Review of attachment 310253 [details] [review]:

Dan explained this, update patch status
Comment 11 Matthias Clasen 2015-08-31 17:32:35 UTC
Review of attachment 310254 [details] [review]:

Looks good to me too
Comment 12 Matthias Clasen 2015-08-31 17:34:13 UTC
Review of attachment 310255 [details] [review]:

Great, I've always wanted to print the test plan first, but couldn't figure out how to make it work.
Comment 13 Dan Winship 2015-08-31 18:18:37 UTC
Attachment 310252 [details] pushed as 510331b - gtestutils: reorganize g_test_name manipulation
Attachment 310253 [details] pushed as 91ff2ba - gtestutils: make g_test_suite_run{,internal} less confusing
Attachment 310254 [details] pushed as 51c91ed - gtestutils: move "/subprocess" path special-casing
Attachment 310255 [details] pushed as 6e38220 - gtestutils: print the TAP test plan first, not last