From bbefa739976f3c3d9a43e661571e698526cf6b43 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Fri, 3 Aug 2018 13:51:53 +0100 Subject: [PATCH] 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 --- glib/gtestutils.c | 5 +++-- glib/tests/testing.c | 5 +++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/glib/gtestutils.c b/glib/gtestutils.c index fde5281e4..686a4cad3 100644 --- a/glib/gtestutils.c +++ b/glib/gtestutils.c @@ -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 diff --git a/glib/tests/testing.c b/glib/tests/testing.c index 859105f48..aad8b6317 100644 --- a/glib/tests/testing.c +++ b/glib/tests/testing.c @@ -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 (); }