[Spice-devel] [PATCH spice-gtk 3/5] test-session: Do not fail on g_warning
Victor Toso
lists at victortoso.com
Tue May 31 10:10:05 UTC 2016
Hi,
On Fri, May 20, 2016 at 02:50:58PM +0200, Pavel Grunt wrote:
> Following commit adds tests for password set in uri which will produce
> a runtime warning. Reset fatal mask set by g_test_init() to avoid
> failing.
> ---
> tests/session.c | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/tests/session.c b/tests/session.c
> index a6276c2..549378b 100644
> --- a/tests/session.c
> +++ b/tests/session.c
> @@ -70,8 +70,17 @@ static void test_session_uri(void)
>
> int main(int argc, char* argv[])
> {
> + GLogLevelFlags fatal_mask;
> +
> + fatal_mask = (GLogLevelFlags)g_log_set_always_fatal((GLogLevelFlags) G_LOG_FATAL_MASK);
> +
> g_test_init(&argc, &argv, NULL);
>
> + /* Reset fatal mask set by g_test_init() as we don't want
> + * warnings/criticals to be fatal by default since this is what some of the
> + * test cases are going to test */
> + g_log_set_always_fatal(fatal_mask & G_LOG_LEVEL_MASK);
> +
I don't agree with this one. We should treat warnings/criticals with
g_test_expect_message().
Reviewed-by: Victor Toso <victortoso at redhat.com>
> g_test_add_func("/session/uri", test_session_uri);
>
> return g_test_run();
> --
> 2.8.2
>
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/spice-devel
More information about the Spice-devel
mailing list