[glib: 5/7] tests: skip spawn-path-search tests on win32




commit 2583a66ee7a6104b774444c9d6264c9b7cd77950
Author: Marc-André Lureau <marcandre lureau redhat com>
Date:   Wed Feb 16 02:56:00 2022 +0400

    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>

 glib/tests/spawn-path-search.c | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)
---
diff --git a/glib/tests/spawn-path-search.c b/glib/tests/spawn-path-search.c
index 2a8911139..5008fc960 100644
--- a/glib/tests/spawn-path-search.c
+++ b/glib/tests/spawn-path-search.c
@@ -23,6 +23,17 @@
 #include <sys/wait.h>
 #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
 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 "
                   "means ./spawn-test-helper.");
 
+  if (skip_win32 ())
+    return;
+
   envp = g_environ_setenv (envp, "PATH", subdir, TRUE);
 
   g_ptr_array_add (argv,
@@ -90,6 +104,9 @@ test_search_path (void)
   g_test_summary ("With G_SPAWN_SEARCH_PATH, spawn-test-helper "
                   "means $PATH/spawn-test-helper.");
 
+  if (skip_win32 ())
+    return;
+
   envp = g_environ_setenv (envp, "PATH", subdir, TRUE);
 
   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 "
                   "means $PATH/spawn-test-helper with $PATH from envp.");
 
+  if (skip_win32 ())
+    return;
+
   envp = g_environ_setenv (envp, "PATH", here, TRUE);
 
   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, "
                   "the latter wins.");
 
+  if (skip_win32 ())
+    return;
+
   envp = g_environ_setenv (envp, "PATH", here, TRUE);
 
   g_ptr_array_add (argv,
@@ -252,6 +275,10 @@ test_search_path_fallback_in_environ (void)
   int wait_status = -1;
 
   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*,
    * 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*,
    * 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) ||
       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;
   gsize i;
 
+  if (skip_win32 ())
+    return;
+
   memset (placeholder, '_', sizeof (placeholder));
   /* Force search_path_buffer to be heap-allocated */
   long_dir = g_test_build_filename (G_TEST_BUILT, "path-test-subdir", placeholder, NULL);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]