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>
This commit is contained in:
Simon McVittie 2014-02-11 15:24:34 +00:00
parent ffa5fab09a
commit 0f5577de57

View File

@ -1474,8 +1474,11 @@ g_test_get_root (void)
* particular code runs before or after a given test case, use * particular code runs before or after a given test case, use
* g_test_add(), which lets you specify setup and teardown functions. * 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), * 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 * Since: 2.16
*/ */
@ -1485,6 +1488,11 @@ g_test_run (void)
if (g_test_run_suite (g_test_get_root()) != 0) if (g_test_run_suite (g_test_get_root()) != 0)
return 1; 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) if (test_run_count > 0 && test_run_count == test_skipped_count)
return 77; return 77;
else else