summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2014-02-11 15:24:34 +0000
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2014-02-13 14:31:27 +0000
commit0f5577de57b83841280dbd925c1b64b77bf4a828 (patch)
tree50f8b054356b20e4ba03733ac4e972c6390dc08c
parentffa5fab09a504cc6d2ff862b4cff123e27e118e1 (diff)
downloadglib-0f5577de57b83841280dbd925c1b64b77bf4a828.tar.gz
g_test_run: return 0 if all tests are skipped in TAP mode
Exit status 77 is special to Automake's default test driver, but is treated as an error by TAP. Bug: https://bugzilla.gnome.org/show_bug.cgi?id=724124 Reviewed-by: Dan Winship <danw>
-rw-r--r--glib/gtestutils.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/glib/gtestutils.c b/glib/gtestutils.c
index 09f3adc6a..0b9aef9cb 100644
--- a/glib/gtestutils.c
+++ b/glib/gtestutils.c
@@ -1474,8 +1474,11 @@ g_test_get_root (void)
* particular code runs before or after a given test case, use
* g_test_add(), which lets you specify setup and teardown functions.
*
+ * If all tests are skipped, this function will return 0 if
+ * producing TAP output, or 77 (treated as "skip test" by Automake) otherwise.
+ *
* Returns: 0 on success, 1 on failure (assuming it returns at all),
- * 77 if all tests were skipped with g_test_skip().
+ * 0 or 77 if all tests were skipped with g_test_skip()
*
* Since: 2.16
*/
@@ -1485,6 +1488,11 @@ g_test_run (void)
if (g_test_run_suite (g_test_get_root()) != 0)
return 1;
+ /* 77 is special to Automake's default driver, but not Automake's TAP driver
+ * or Perl's prove(1) TAP driver. */
+ if (test_tap_log)
+ return 0;
+
if (test_run_count > 0 && test_run_count == test_skipped_count)
return 77;
else