mirror of
https://github.com/brl/mutter.git
synced 2024-12-28 05:42:14 +00:00
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 twice. 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.
This commit is contained in:
parent
ddf1e4c77b
commit
bcd4385a0e
@ -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.
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user