diff options
author | Simon McVittie <smcv@collabora.com> | 2018-10-31 15:19:19 +0000 |
---|---|---|
committer | Simon McVittie <smcv@collabora.com> | 2018-10-31 16:56:36 +0000 |
commit | 2a2c6e6790a25e96210115ef04b21c332fb4effa (patch) | |
tree | 5f7007d640079be49c7cdd35a01b8cdeee7443e0 /test/test-utils-glib.c | |
parent | d30188a135c12e030b3ca3f1c9c34daca2161725 (diff) | |
download | dbus-2a2c6e6790a25e96210115ef04b21c332fb4effa.tar.gz |
test_incomplete: Add function
This is a wrapper for g_test_incomplete(), which works around bugs in
that function prior to GLib 2.57.3. I originally wrote it for librsvg.
Signed-off-by: Simon McVittie <smcv@collabora.com>
Diffstat (limited to 'test/test-utils-glib.c')
-rw-r--r-- | test/test-utils-glib.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/test/test-utils-glib.c b/test/test-utils-glib.c index 3b447fe8..930b87df 100644 --- a/test/test-utils-glib.c +++ b/test/test-utils-glib.c @@ -863,3 +863,30 @@ test_store_result_cb (GObject *source_object G_GNUC_UNUSED, g_assert_null (*result_p); *result_p = g_object_ref (result); } + +/* + * Report that a test should have failed, but we are tolerating the + * failure because it represents a known bug or missing feature. + * + * This is the same as g_test_incomplete(), but with a workaround for + * GLib bug 1474 so that we don't fail tests on older GLib. + */ +void +test_incomplete (const gchar *message) +{ + if (glib_check_version (2, 57, 3)) + { + /* In GLib >= 2.57.3, g_test_incomplete() behaves as intended: + * the test result is reported as an expected failure and the + * overall test exits 0 */ + g_test_incomplete (message); + } + else + { + /* In GLib < 2.57.3, g_test_incomplete() reported the wrong TAP + * result (an unexpected success) and the overall test exited 1, + * which would break "make check". g_test_skip() is the next + * best thing available. */ + g_test_skip (message); + } +} |