[glib] g_test_run: return 0 if all tests are skipped in TAP mode



commit 0f5577de57b83841280dbd925c1b64b77bf4a828
Author: Simon McVittie <simon mcvittie collabora co uk>
Date:   Tue Feb 11 15:24:34 2014 +0000

    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>

 glib/gtestutils.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/glib/gtestutils.c b/glib/gtestutils.c
index 09f3adc..0b9aef9 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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]