[libpeas] Fix Python tests on OpenBSD



commit f5c7668f600f16f144c3772cc34c9fd929f98d28
Author: Garrett Regier <garrettregier gmail com>
Date:   Tue May 12 04:48:42 2015 -0700

    Fix Python tests on OpenBSD
    
    The OpenBSD linker spews warnings when a
    symbol has a different size. This was causing
    the stderr is empty assert to fail. Remove the
    assert and only inherit stderr when the
    PEAS_DEBUG environment variable is defined.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=727380
    Signed-off-by: Garrett Regier <garrettregier gmail com>

 tests/libpeas/extension-py.c |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/tests/libpeas/extension-py.c b/tests/libpeas/extension-py.c
index 17f54f1..0d9f913 100644
--- a/tests/libpeas/extension-py.c
+++ b/tests/libpeas/extension-py.c
@@ -180,11 +180,19 @@ test_extension_py_already_initialized_subprocess (void)
 static void
 test_extension_py_mixed_python (void)
 {
+  GTestSubprocessFlags flags = 0;
+
+  /* Loading both Python 2 and Python 3 might cause
+   * the linker to spew warnings, i.e. on OpenBSD, so
+   * only inherit standard error when debugging
+   */
+  if (g_getenv ("PEAS_DEBUG") != NULL)
+    flags |= G_TEST_SUBPROCESS_INHERIT_STDERR;
+
   g_test_trap_subprocess (EXTENSION_TEST_NAME (PY_LOADER,
                                                "mixed-python/subprocess"),
-                          0, G_TEST_SUBPROCESS_INHERIT_STDERR);
+                          0, flags);
   g_test_trap_assert_passed ();
-  g_test_trap_assert_stderr ("");
 }
 
 static void


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