testutils: Treat incomplete tests more like skipped tests

If a test is marked with g_test_incomplete(), then it is expected to
fail, so when it fails the test executable should still exit 0
(or possibly 77, if all tests are either skipped or incomplete).

Signed-off-by: Simon McVittie <smcv@collabora.com>
This commit is contained in:
Simon McVittie 2018-08-03 13:51:53 +01:00
parent ba3b442152
commit bbefa73997
2 changed files with 8 additions and 2 deletions

View File

@ -990,7 +990,7 @@ g_test_log (GTestLogType lbit,
g_print ("Bail out!\n");
g_abort ();
}
if (result == G_TEST_RUN_SKIPPED)
if (result == G_TEST_RUN_SKIPPED || result == G_TEST_RUN_INCOMPLETE)
test_skipped_count++;
break;
case G_TEST_LOG_MIN_RESULT:
@ -2338,7 +2338,8 @@ test_case_run (GTestCase *tc)
test_uri_base = old_base;
return (success == G_TEST_RUN_SUCCESS ||
success == G_TEST_RUN_SKIPPED);
success == G_TEST_RUN_SKIPPED ||
success == G_TEST_RUN_INCOMPLETE);
}
static gboolean

View File

@ -660,6 +660,11 @@ test_incomplete (void)
return;
}
g_test_trap_subprocess (NULL, 0, 0);
/* An incomplete test represents functionality that is known not to be
* implemented yet (an expected failure), so it does not cause test
* failure; but it does count as the test having been skipped, which
* causes nonzero exit status 77, which is treated as failure by
* g_test_trap_subprocess(). */
g_test_trap_assert_failed ();
}