mirror of
https://github.com/brl/mutter.git
synced 2024-12-18 09:02:04 +00:00
59a2bff8e2
If a test is not expected to succeed, then running it could be considered to be a waste of resources, particularly if the failure might manifest as an indefinite hang (see cogl!11), or if the test is likely to dump core and trigger "expensive" crash-reporting mechanisms like systemd-coredump, corekeeper, abrt or apport. Skip the tests that are expected to fail. They can still be requested via an environment variable, which can be set after fixing a bug to check which tests are now passing. Originally cogl!15, adapted for mutter's fork of cogl to use gboolean instead of CoglBool. https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1272 Signed-off-by: Simon McVittie <smcv@debian.org>
52 lines
1.1 KiB
C
52 lines
1.1 KiB
C
#include "cogl-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;
|
|
}
|
|
|
|
if (test_utils_init (unit_test->requirement_flags,
|
|
unit_test->known_failure_flags)
|
|
|| g_getenv ("COGL_TEST_TRY_EVERYTHING") != NULL)
|
|
{
|
|
unit_test->run ();
|
|
test_utils_fini ();
|
|
return 0;
|
|
}
|
|
else
|
|
{
|
|
return 1;
|
|
}
|
|
}
|