From: Dan Winship Date: Wed, 11 Dec 2013 15:32:11 +0000 (+0100) Subject: gtestutils: skipping a test should count as success, not failure X-Git-Tag: 2.39.3~133 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8c188fc9e55cc9e24000271f6ad8a47ffdcb62d7;p=platform%2Fupstream%2Fglib.git gtestutils: skipping a test should count as success, not failure In particular, the test program as a whole should exit with status 0 if you skipped some tests but did not fail any. https://bugzilla.gnome.org/show_bug.cgi?id=720263 --- diff --git a/glib/gtestutils.c b/glib/gtestutils.c index bc7bbcf..c8a601c 100644 --- a/glib/gtestutils.c +++ b/glib/gtestutils.c @@ -2117,7 +2117,8 @@ test_case_run (GTestCase *tc) g_free (test_uri_base); test_uri_base = old_base; - return success == G_TEST_RUN_SUCCESS; + return (success == G_TEST_RUN_SUCCESS || + success == G_TEST_RUN_SKIPPED); } static int diff --git a/glib/tests/testing.c b/glib/tests/testing.c index 20c2e79..189223a 100644 --- a/glib/tests/testing.c +++ b/glib/tests/testing.c @@ -575,6 +575,12 @@ test_nonfatal (void) g_test_trap_assert_stdout ("*The End*"); } +static void +test_skip (void) +{ + g_test_skip ("Skipped should count as passed, not failed"); +} + int main (int argc, char *argv[]) @@ -633,5 +639,7 @@ main (int argc, g_test_add_func ("/misc/nonfatal", test_nonfatal); + g_test_add_func ("/misc/skip", test_skip); + return g_test_run(); }