diff options
author | Philip Chimento <philip@endlessm.com> | 2018-06-07 17:18:43 -0700 |
---|---|---|
committer | Philip Chimento <philip@endlessm.com> | 2018-06-07 17:18:43 -0700 |
commit | 42300cc65ea465f171710d5b08d7cde248f1be06 (patch) | |
tree | 881346566c542a1c82649ec8038bdcfb2cd31f99 | |
parent | 7e456e2a5534aa2617465b98ae551b8d26e7bf58 (diff) |
tests: Move g_test_trap_fork() to _subprocess()
g_test_trap_fork() is deprecated, and in some recent release it stopped
working with gtester --tap. We could track this down but an easy fix is
to switch to its replacement, g_test_trap_subprocess(). This fixes the
unit tests.
https://phabricator.endlessm.com/T22827
-rw-r--r-- | test/endless/test-application.c | 11 | ||||
-rw-r--r-- | test/endless/test-window.c | 6 |
2 files changed, 9 insertions, 8 deletions
diff --git a/test/endless/test-application.c b/test/endless/test-application.c index 13a53b4..9db6763 100644 --- a/test/endless/test-application.c +++ b/test/endless/test-application.c @@ -21,14 +21,14 @@ test_two_windows (EosApplication *app) { GtkWidget *win1 = eos_window_new (app); - /* Unix-only test */ - if (g_test_trap_fork(0 /* timeout */, G_TEST_TRAP_SILENCE_STDERR)) + if (g_test_subprocess ()) { GtkWidget *win2 = eos_window_new (app); gtk_widget_destroy (win2); - exit (0); + return; } + g_test_trap_subprocess (NULL, 0, 0); g_test_trap_assert_failed (); g_test_trap_assert_stderr (EXPECTED_TWO_WINDOW_ERRMSG); @@ -155,12 +155,13 @@ test_config_dir_fails_if_not_writable (UniqueAppFixture *fixture, set_writable (precreated_config_dir, FALSE); - /* Unix-only test */ - if (g_test_trap_fork(0 /* timeout */, G_TEST_TRAP_SILENCE_STDERR)) + if (g_test_subprocess ()) { GFile *config_dir = eos_application_get_config_dir (fixture->app); + return; } + g_test_trap_subprocess (NULL, 0, 0); g_test_trap_assert_failed (); g_test_trap_assert_stderr (EXPECTED_CONFIG_NOT_WRITABLE_ERRMSG); diff --git a/test/endless/test-window.c b/test/endless/test-window.c index a6fc28a..cb061b4 100644 --- a/test/endless/test-window.c +++ b/test/endless/test-window.c @@ -26,14 +26,14 @@ test_assign_application (GApplication *app) static void test_application_not_null (GApplication *app) { - /* Unix-only test */ - if (g_test_trap_fork(0 /* timeout */, G_TEST_TRAP_SILENCE_STDERR)) + if (g_test_subprocess ()) { GtkWidget *win = eos_window_new (NULL); gtk_widget_destroy (win); - exit (0); + return; } + g_test_trap_subprocess (NULL, 0, 0); g_test_trap_assert_failed (); g_test_trap_assert_stderr (EXPECTED_NULL_APPLICATION_ERRMSG); |