[Cogl] [PATCH] Set G_DEBUG=fatal-warnings in run-tests.sh

Neil Roberts neil at linux.intel.com
Thu Jun 20 10:36:18 PDT 2013


We want any run-time warnings to cause the conformance tests to fail.
We are currently setting G_DEBUG in test_utils_init and this would
previously cause the fatal-warnings debug option to be set. However
since commit 47444dac of glib this no longer works because the
environment variable is read in a magic constructor of libglib so it
is too late to try to set it there. This patch makes it also set it in
run-tests.sh to avoid the problem.
---
 test-fixtures/test-utils.c | 3 +++
 tests/run-tests.sh         | 8 ++++++++
 2 files changed, 11 insertions(+)

diff --git a/test-fixtures/test-utils.c b/test-fixtures/test-utils.c
index fdab99b..6c4291f 100644
--- a/test-fixtures/test-utils.c
+++ b/test-fixtures/test-utils.c
@@ -145,6 +145,9 @@ test_utils_init (TestFlags requirement_flags,
       is_boolean_env_set ("V"))
     cogl_test_is_verbose = TRUE;
 
+  /* NB: This doesn't have any effect since commit 47444dac of glib
+   * because the environment variable is read in a magic constructor
+   * so it is too late to set them here */
   if (g_getenv ("G_DEBUG"))
     {
       char *debug = g_strconcat (g_getenv ("G_DEBUG"), ",fatal-warnings", NULL);
diff --git a/tests/run-tests.sh b/tests/run-tests.sh
index a004943..388fa03 100755
--- a/tests/run-tests.sh
+++ b/tests/run-tests.sh
@@ -1,5 +1,13 @@
 #!/bin/bash
 
+if test -z "$G_DEBUG"; then
+    G_DEBUG=fatal-warnings
+else
+    G_DEBUG="$G_DEBUG,fatal-warnings"
+fi
+
+export G_DEBUG
+
 ENVIRONMENT_CONFIG=$1
 shift
 
-- 
1.7.11.3.g3c3efa5



More information about the Cogl mailing list