[glib] gio/tests/gsubprocess.c: Fix on Windows



commit b27a2d436bad5fcda5fea52bb84a39fd42e66041
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Tue Nov 5 17:33:09 2013 +0800

    gio/tests/gsubprocess.c: Fix on Windows
    
    We need to check for the correct line endings on Windows (\r\n) for the
    echo tests and currently need to skip the test_echo_eof test there, as
    it depends on the cat utility that is not normally found on Windows, and
    using an external installation of cat via MSYS or Cygwin would render the
    test program to hang as cat waits for user input.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=711047

 gio/tests/gsubprocess.c |   15 ++++++++++++++-
 1 files changed, 14 insertions(+), 1 deletions(-)
---
diff --git a/gio/tests/gsubprocess.c b/gio/tests/gsubprocess.c
index f38bbdc..48de292 100644
--- a/gio/tests/gsubprocess.c
+++ b/gio/tests/gsubprocess.c
@@ -8,6 +8,14 @@
 #include <gio/gfiledescriptorbased.h>
 #endif
 
+#ifdef G_OS_WIN32
+#define LINEEND "\r\n"
+#define EXEEXT ".exe"
+#else
+#define LINEEND "\n"
+#define EXEEXT
+#endif
+
 static GPtrArray *
 get_test_subprocess_args (const char *mode,
                           ...) G_GNUC_NULL_TERMINATED;
@@ -199,7 +207,7 @@ test_echo1 (void)
   result = splice_to_string (stdout, error);
   g_assert_no_error (local_error);
 
-  g_assert_cmpstr (result, ==, "hello\nworld!\n");
+  g_assert_cmpstr (result, ==, "hello" LINEEND "world!" LINEEND);
 
   g_free (result);
   g_object_unref (proc);
@@ -337,6 +345,11 @@ test_cat_eof (void)
   gchar buffer;
   gssize s;
 
+#ifdef G_OS_WIN32
+  g_test_skip ("This test has not been ported to Win32");
+  return;
+#endif
+
   /* Spawn 'cat' */
   cat = g_subprocess_new (G_SUBPROCESS_FLAGS_STDIN_PIPE | G_SUBPROCESS_FLAGS_STDOUT_PIPE, &error, "cat", 
NULL);
   g_assert_no_error (error);


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