diff options
author | Dan Winship <danw@gnome.org> | 2012-12-05 11:28:53 -0500 |
---|---|---|
committer | Dan Winship <danw@gnome.org> | 2013-05-13 12:10:53 -0400 |
commit | e9284ed29731365415992d8c9ed72f10e67cf056 (patch) | |
tree | 945c15c06e6dbd0f7c8f61d82c2368887ff73985 | |
parent | e3d1869ee3b6e269b80723173dc4f85c7cc3eaea (diff) | |
download | glib-e9284ed29731365415992d8c9ed72f10e67cf056.tar.gz |
gtestutils: deprecate g_test_trap_fork()
https://bugzilla.gnome.org/show_bug.cgi?id=679683
-rw-r--r-- | gio/tests/gdbus-non-socket.c | 2 | ||||
-rw-r--r-- | glib/gtestutils.c | 6 | ||||
-rw-r--r-- | glib/gtestutils.h | 3 | ||||
-rw-r--r-- | glib/tests/testing.c | 6 |
4 files changed, 14 insertions, 3 deletions
diff --git a/gio/tests/gdbus-non-socket.c b/gio/tests/gdbus-non-socket.c index 8866b1d16..43b681bdd 100644 --- a/gio/tests/gdbus-non-socket.c +++ b/gio/tests/gdbus-non-socket.c @@ -220,6 +220,7 @@ test_non_socket (void) } /* This is #ifdef G_OS_UNIX anyway, so just use g_test_trap_fork() */ + G_GNUC_BEGIN_IGNORE_DEPRECATIONS; if (!g_test_trap_fork (0, 0)) { /* parent */ @@ -230,6 +231,7 @@ test_non_socket (void) g_assert_cmpint (kill (first_child, SIGTERM), ==, 0); return; } + G_GNUC_END_IGNORE_DEPRECATIONS; /* second child */ diff --git a/glib/gtestutils.c b/glib/gtestutils.c index c157fe17c..aed790832 100644 --- a/glib/gtestutils.c +++ b/glib/gtestutils.c @@ -2384,11 +2384,13 @@ wait_for_child (GPid pid, * } * ]| * - * This function is implemented only on Unix platforms. - * * Returns: %TRUE for the forked child and %FALSE for the executing parent process. * * Since: 2.16 + * + * Deprecated: This function is implemented only on Unix platforms, + * and is not always reliable due to problems inherent in + * fork-without-exec. Use g_test_trap_subprocess() instead. */ gboolean g_test_trap_fork (guint64 usec_timeout, diff --git a/glib/gtestutils.h b/glib/gtestutils.h index 3e37197d9..0051c4190 100644 --- a/glib/gtestutils.h +++ b/glib/gtestutils.h @@ -172,7 +172,8 @@ typedef enum { G_TEST_TRAP_SILENCE_STDERR = 1 << 8, G_TEST_TRAP_INHERIT_STDIN = 1 << 9 } GTestTrapFlags; -GLIB_AVAILABLE_IN_ALL + +GLIB_DEPRECATED_IN_2_38_FOR (g_test_trap_subprocess) gboolean g_test_trap_fork (guint64 usec_timeout, GTestTrapFlags test_trap_flags); diff --git a/glib/tests/testing.c b/glib/tests/testing.c index 0de05c055..979676a8c 100644 --- a/glib/tests/testing.c +++ b/glib/tests/testing.c @@ -85,6 +85,9 @@ test_timer (void) g_test_maximized_result (5, "bogus-quantity: %ddummies", 5); /* simple API test */ } +#ifdef G_OS_UNIX +G_GNUC_BEGIN_IGNORE_DEPRECATIONS + /* fork out for a failing test */ static void test_fork_fail (void) @@ -127,6 +130,9 @@ test_fork_timeout (void) g_assert (g_test_trap_reached_timeout()); } +G_GNUC_END_IGNORE_DEPRECATIONS +#endif /* G_OS_UNIX */ + static void test_subprocess_fail_child (void) { |