mutter/tests/unit/test-unit-main.c
Neil Roberts b1542cf9dd Don't include cogl/cogl.h from test-utils.h
There was a circular depedency when building from a fresh git clone
where test-fixtures needs to be built before the cogl directory, but
test-fixtures also indirectly includes cogl-enum-types.h which is only
generated when building the cogl directory. If we change the header to
just include specific cogl headers instead of cogl/cogl.h then we can
break the circular dependency.

This needs a tweak to test-no-gl-header because that first undefines
COGL_COMPILATION before including test-utils.h. However it doesn't
really do any actual work so we can get away without including it.

Reviewed-by: Robert Bragg <robert@linux.intel.com>

(cherry picked from commit adb26bd13a48ed571ef4cae4de005e039b34e361)
2013-07-04 11:50:31 +01:00

46 lines
986 B
C

#include <config.h>
#include <gmodule.h>
#include <test-fixtures/test-unit.h>
#include <stdlib.h>
int
main (int argc, char **argv)
{
GModule *main_module;
const CoglUnitTest *unit_test;
int i;
if (argc != 2)
{
g_printerr ("usage %s UNIT_TEST\n", argv[0]);
exit (1);
}
/* Just for convenience in case people try passing the wrapper
* filenames for the UNIT_TEST argument we normalize '-' characters
* to '_' characters... */
for (i = 0; argv[1][i]; i++)
{
if (argv[1][i] == '-')
argv[1][i] = '_';
}
main_module = g_module_open (NULL, /* use main module */
0 /* flags */);
if (!g_module_symbol (main_module, argv[1], (void **) &unit_test))
{
g_printerr ("Unknown test name \"%s\"\n", argv[1]);
return 1;
}
test_utils_init (unit_test->requirement_flags,
unit_test->known_failure_flags);
unit_test->run ();
test_utils_fini ();
return 0;
}