mutter/tests/interactive/test-main.c
Emmanuele Bassi ca7bdc12a4 2008-11-10 Emmanuele Bassi <ebassi@linux.intel.com>
* tests/conform/test-label-cache.c:
	* tests/conform/test-pick.c:
	* tests/conform/test-timeline.c: Show all the output messages only
	if the test was done with the verbose flag turned on.

	* tests/interactive/test-main.c: Do not use the (gpointer*) cast,
	but use a temporary gpointer instead.
2008-11-10 12:28:42 +00:00

40 lines
866 B
C

#include <glib.h>
#include <gmodule.h>
int
main (int argc, char **argv)
{
GModule *module;
char *unit_test;
char *main_symbol_name;
gpointer func;
int (*unit_test_main) (int argc, char **argv);
int ret;
if (argc != 2)
g_error ("Usage: %s unit_test", argv[0]);
module = g_module_open (NULL, 0);
if (!module)
g_error ("Failed to open self for symbol lookup");
unit_test = g_path_get_basename (argv[1]);
main_symbol_name = g_strdup_printf ("%s_main", unit_test);
main_symbol_name = g_strdelimit (main_symbol_name, "-", '_');
if (!g_module_symbol (module, main_symbol_name, &func))
g_error ("Failed to look up main symbol for the test: %s", unit_test);
unit_test_main = func;
ret = unit_test_main (argc - 1, argv + 1);
g_free (unit_test);
g_free (main_symbol_name);
g_module_close (module);
return ret;
}