98f942fd72
* tests/conform/wrapper.sh: * tests/conform/test-conform-main.c: * tests/conform/test-timeline.c: Adds Neil's updates to test-timeline.c so it now works with the new unit testing infrastructure. Also some fixes to ensure wrappers get setup correctly for the timeline tests. * tests/interactive/test-main.c: cast the symbol return pointer as (gpointer *) to avoid warning * tests/conform/test-pick.c: g_assert that the test passes, instead of using exit() * test/conform/ADDING_NEW_TESTS: Fixes a silly typo
38 lines
837 B
C
38 lines
837 B
C
#include <glib.h>
|
|
#include <gmodule.h>
|
|
|
|
|
|
int
|
|
main (int argc, char **argv)
|
|
{
|
|
GModule *module;
|
|
char *unit_test;
|
|
char *main_symbol_name;
|
|
int (*unit_test_main) (int argc, char **argv);
|
|
int ret;
|
|
|
|
if (argc != 2)
|
|
g_error ("Usage: %s unit_test");
|
|
|
|
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, (gpointer *)&unit_test_main))
|
|
g_error ("Failed to look up main symbol for the test: %s", unit_test);
|
|
|
|
ret = unit_test_main (argc - 1, argv + 1);
|
|
|
|
g_free (unit_test);
|
|
g_free (main_symbol_name);
|
|
g_module_close (module);
|
|
|
|
return ret;
|
|
}
|
|
|