Dominique Leuenberger <[email protected]> wrote:

> > ./test-conformance -l -m thorough
> No DISPLAY found. Unable to run the conformance test suite without a
> display.
> 
> In this case that's what's 'bugging us I would say.

We should probably fix this in Clutter. It should be ok to run
test-conformance -l without an X server. Here's a patch which would do
that.

Eventually it would be nice to think of another way to acheive this
without having to run test-conformance because I think it would also be
a pain for cross-compiling. Maybe we could store the list of tests in a
text file instead and have test-conformance read the text file to
install all of the tests? Then the make rule could independently read
the text file without executing anything.

Regards
- Neil

>From 092c9829cf0a7fd7a2ce14c5832192a35148c300 Mon Sep 17 00:00:00 2001
From: Neil Roberts <[email protected]>
Date: Tue, 21 Sep 2010 13:17:53 +0100
Subject: [PATCH] test-conform: Delay initializing Clutter until a test is run

Instead of calling clutter_init immediately, test-conformance now only
calls it as part of test_conform_simple_fixture_setup. The conformance
tests assert that only one test is run per instance of
test-conformance so it should never end up calling clutter_init
once. Delaying clutter_init has the advantage that calling
"test-conformance -l" will still work even on systems with no X
server. This could be useful for automated build systems.
---
 tests/conform/test-conform-common.c |   21 +++++++++++++++++++++
 tests/conform/test-conform-main.c   |   15 ---------------
 2 files changed, 21 insertions(+), 15 deletions(-)

diff --git a/tests/conform/test-conform-common.c b/tests/conform/test-conform-common.c
index 8ff8d0d..e6fc55d 100644
--- a/tests/conform/test-conform-common.c
+++ b/tests/conform/test-conform-common.c
@@ -1,4 +1,7 @@
+#include "config.h"
+
 #include <clutter/clutter.h>
+#include <stdlib.h>
 
 #ifdef COGL_HAS_XLIB
 #include <X11/Xlib.h>
@@ -16,6 +19,7 @@ void
 test_conform_simple_fixture_setup (TestConformSimpleFixture *fixture,
 				   gconstpointer data)
 {
+  const TestConformSharedState *shared_state = data;
   static int counter = 0;
 
   if (counter != 0)
@@ -27,6 +31,23 @@ test_conform_simple_fixture_setup (TestConformSimpleFixture *fixture,
                 "$ make test-report");
   counter++;
 
+#ifdef HAVE_CLUTTER_GLX
+  {
+    /* on X11 we need a display connection to run the test suite */
+    const gchar *display = g_getenv ("DISPLAY");
+    if (!display || *display == '\0')
+      {
+        g_print ("No DISPLAY found. Unable to run the conformance "
+                 "test suite without a display.\n");
+
+        exit (EXIT_SUCCESS);
+      }
+  }
+#endif
+
+  g_assert (clutter_init (shared_state->argc_addr, shared_state->argv_addr)
+            == CLUTTER_INIT_SUCCESS);
+
 #ifdef COGL_HAS_XLIB
   /* A lot of the tests depend on a specific stage / framebuffer size
    * when they read pixels back to verify the results of the test.
diff --git a/tests/conform/test-conform-main.c b/tests/conform/test-conform-main.c
index 978ce4b..a6b2361 100644
--- a/tests/conform/test-conform-main.c
+++ b/tests/conform/test-conform-main.c
@@ -69,18 +69,6 @@ static void
 clutter_test_init (gint    *argc,
                    gchar ***argv)
 {
-#ifdef HAVE_CLUTTER_GLX
-  /* on X11 we need a display connection to run the test suite */
-  const gchar *display = g_getenv ("DISPLAY");
-  if (!display || *display == '\0')
-    {
-      g_print ("No DISPLAY found. Unable to run the conformance "
-               "test suite without a display.");
-
-      exit (EXIT_SUCCESS);
-    }
-#endif
-
   /* Turning of sync-to-vblank removes a dependency on the specifics of the
    * test environment. It also means that the timeline-only tests are
    * throttled to a reasonable frame rate rather than running in tight
@@ -97,9 +85,6 @@ clutter_test_init (gint    *argc,
   shared_state = g_new0 (TestConformSharedState, 1);
   shared_state->argc_addr = argc;
   shared_state->argv_addr = argv;
-
-  g_assert (clutter_init (shared_state->argc_addr, shared_state->argv_addr)
-	    == CLUTTER_INIT_SUCCESS);
 }
 
 int
-- 
1.7.2.3

_______________________________________________
clutter-app-devel-list mailing list
[email protected]
http://lists.clutter-project.org/listinfo/clutter-app-devel-list

Reply via email to