mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-14 05:16:18 +01:00
tests: skip spawn-path-search tests on win32
Manipulating PATH the way the test does, it breaks DLL lookups and fails to run helper programs. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
This commit is contained in:
parent
68aff6dd07
commit
2583a66ee7
@ -23,6 +23,17 @@
|
|||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
skip_win32 (void)
|
||||||
|
{
|
||||||
|
#ifdef G_OS_WIN32
|
||||||
|
g_test_skip ("The test manipulate PATH, and breaks DLL lookups.");
|
||||||
|
return TRUE;
|
||||||
|
#else
|
||||||
|
return FALSE;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
test_do_not_search (void)
|
test_do_not_search (void)
|
||||||
{
|
{
|
||||||
@ -38,6 +49,9 @@ test_do_not_search (void)
|
|||||||
g_test_summary ("Without G_SPAWN_SEARCH_PATH, spawn-test-helper "
|
g_test_summary ("Without G_SPAWN_SEARCH_PATH, spawn-test-helper "
|
||||||
"means ./spawn-test-helper.");
|
"means ./spawn-test-helper.");
|
||||||
|
|
||||||
|
if (skip_win32 ())
|
||||||
|
return;
|
||||||
|
|
||||||
envp = g_environ_setenv (envp, "PATH", subdir, TRUE);
|
envp = g_environ_setenv (envp, "PATH", subdir, TRUE);
|
||||||
|
|
||||||
g_ptr_array_add (argv,
|
g_ptr_array_add (argv,
|
||||||
@ -90,6 +104,9 @@ test_search_path (void)
|
|||||||
g_test_summary ("With G_SPAWN_SEARCH_PATH, spawn-test-helper "
|
g_test_summary ("With G_SPAWN_SEARCH_PATH, spawn-test-helper "
|
||||||
"means $PATH/spawn-test-helper.");
|
"means $PATH/spawn-test-helper.");
|
||||||
|
|
||||||
|
if (skip_win32 ())
|
||||||
|
return;
|
||||||
|
|
||||||
envp = g_environ_setenv (envp, "PATH", subdir, TRUE);
|
envp = g_environ_setenv (envp, "PATH", subdir, TRUE);
|
||||||
|
|
||||||
g_ptr_array_add (argv,
|
g_ptr_array_add (argv,
|
||||||
@ -143,6 +160,9 @@ test_search_path_from_envp (void)
|
|||||||
g_test_summary ("With G_SPAWN_SEARCH_PATH_FROM_ENVP, spawn-test-helper "
|
g_test_summary ("With G_SPAWN_SEARCH_PATH_FROM_ENVP, spawn-test-helper "
|
||||||
"means $PATH/spawn-test-helper with $PATH from envp.");
|
"means $PATH/spawn-test-helper with $PATH from envp.");
|
||||||
|
|
||||||
|
if (skip_win32 ())
|
||||||
|
return;
|
||||||
|
|
||||||
envp = g_environ_setenv (envp, "PATH", here, TRUE);
|
envp = g_environ_setenv (envp, "PATH", here, TRUE);
|
||||||
|
|
||||||
g_ptr_array_add (argv,
|
g_ptr_array_add (argv,
|
||||||
@ -198,6 +218,9 @@ test_search_path_ambiguous (void)
|
|||||||
g_test_summary ("With G_SPAWN_SEARCH_PATH and G_SPAWN_SEARCH_PATH_FROM_ENVP, "
|
g_test_summary ("With G_SPAWN_SEARCH_PATH and G_SPAWN_SEARCH_PATH_FROM_ENVP, "
|
||||||
"the latter wins.");
|
"the latter wins.");
|
||||||
|
|
||||||
|
if (skip_win32 ())
|
||||||
|
return;
|
||||||
|
|
||||||
envp = g_environ_setenv (envp, "PATH", here, TRUE);
|
envp = g_environ_setenv (envp, "PATH", here, TRUE);
|
||||||
|
|
||||||
g_ptr_array_add (argv,
|
g_ptr_array_add (argv,
|
||||||
@ -252,6 +275,10 @@ test_search_path_fallback_in_environ (void)
|
|||||||
int wait_status = -1;
|
int wait_status = -1;
|
||||||
|
|
||||||
g_test_summary ("With G_SPAWN_SEARCH_PATH but no PATH, a fallback is used.");
|
g_test_summary ("With G_SPAWN_SEARCH_PATH but no PATH, a fallback is used.");
|
||||||
|
|
||||||
|
if (skip_win32 ())
|
||||||
|
return;
|
||||||
|
|
||||||
/* We can't make a meaningful assertion about what the fallback *is*,
|
/* We can't make a meaningful assertion about what the fallback *is*,
|
||||||
* but we can assert that it *includes* the current working directory. */
|
* but we can assert that it *includes* the current working directory. */
|
||||||
|
|
||||||
@ -319,6 +346,9 @@ test_search_path_fallback_in_envp (void)
|
|||||||
/* We can't make a meaningful assertion about what the fallback *is*,
|
/* We can't make a meaningful assertion about what the fallback *is*,
|
||||||
* but we can assert that it *includes* the current working directory. */
|
* but we can assert that it *includes* the current working directory. */
|
||||||
|
|
||||||
|
if (skip_win32 ())
|
||||||
|
return;
|
||||||
|
|
||||||
if (g_file_test ("/usr/bin/spawn-test-helper", G_FILE_TEST_IS_EXECUTABLE) ||
|
if (g_file_test ("/usr/bin/spawn-test-helper", G_FILE_TEST_IS_EXECUTABLE) ||
|
||||||
g_file_test ("/bin/spawn-test-helper", G_FILE_TEST_IS_EXECUTABLE))
|
g_file_test ("/bin/spawn-test-helper", G_FILE_TEST_IS_EXECUTABLE))
|
||||||
{
|
{
|
||||||
@ -384,6 +414,9 @@ test_search_path_heap_allocation (void)
|
|||||||
int wait_status = -1;
|
int wait_status = -1;
|
||||||
gsize i;
|
gsize i;
|
||||||
|
|
||||||
|
if (skip_win32 ())
|
||||||
|
return;
|
||||||
|
|
||||||
memset (placeholder, '_', sizeof (placeholder));
|
memset (placeholder, '_', sizeof (placeholder));
|
||||||
/* Force search_path_buffer to be heap-allocated */
|
/* Force search_path_buffer to be heap-allocated */
|
||||||
long_dir = g_test_build_filename (G_TEST_BUILT, "path-test-subdir", placeholder, NULL);
|
long_dir = g_test_build_filename (G_TEST_BUILT, "path-test-subdir", placeholder, NULL);
|
||||||
|
Loading…
Reference in New Issue
Block a user