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>
diff --git a/glib/gtestutils.c b/glib/gtestutils.c
index fde5281..686a4ca 100644
--- a/glib/gtestutils.c
+++ b/glib/gtestutils.c
@@ -990,7 +990,7 @@
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_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 859105f..aad8b63 100644
--- a/glib/tests/testing.c
+++ b/glib/tests/testing.c
@@ -660,6 +660,11 @@
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 ();
}