tests: Add a flag to say that the test is known to fail in all cases

This renames the TestRequirement enum to TestFlags and then adds a
TEST_KNOWN_FAILURE flag. The rename is because the new flag is not
really a requirement. If the flag is set then the test is assumed to
always fail.

Reviewed-by: Robert Bragg <robert@linux.intel.com>
This commit is contained in:
Neil Roberts 2012-03-06 23:41:49 +00:00
parent 73c8aa979f
commit 58cf84f8ef
2 changed files with 14 additions and 8 deletions

View File

@ -11,7 +11,7 @@ static gboolean cogl_test_is_verbose;
void
test_utils_init (TestUtilsSharedState *state,
TestRequirement requirements)
TestFlags flags)
{
static int counter = 0;
GError *error = NULL;
@ -50,24 +50,29 @@ test_utils_init (TestUtilsSharedState *state,
display = cogl_context_get_display (state->ctx);
renderer = cogl_display_get_renderer (display);
if (requirements & TEST_REQUIREMENT_GL &&
if (flags & TEST_REQUIREMENT_GL &&
cogl_renderer_get_driver (renderer) != COGL_DRIVER_GL)
{
missing_requirement = TRUE;
}
if (requirements & TEST_REQUIREMENT_NPOT &&
if (flags & TEST_REQUIREMENT_NPOT &&
!cogl_has_feature (state->ctx, COGL_FEATURE_ID_TEXTURE_NPOT))
{
missing_requirement = TRUE;
}
if (requirements & TEST_REQUIREMENT_TEXTURE_3D &&
if (flags & TEST_REQUIREMENT_TEXTURE_3D &&
!cogl_has_feature (state->ctx, COGL_FEATURE_ID_TEXTURE_3D))
{
missing_requirement = TRUE;
}
if (flags & TEST_KNOWN_FAILURE)
{
missing_requirement = TRUE;
}
if (getenv ("COGL_TEST_ONSCREEN"))
{
onscreen = cogl_onscreen_new (state->ctx, 640, 480);

View File

@ -7,12 +7,13 @@
#pragma GCC diagnostic ignored "-Wmissing-declarations"
#endif
typedef enum _TestRequirement
typedef enum _TestFlags
{
TEST_REQUIREMENT_GL = 1<<0,
TEST_KNOWN_FAILURE = 1<<0,
TEST_REQUIREMENT_GL = 1<<1,
TEST_REQUIREMENT_NPOT = 1<<2,
TEST_REQUIREMENT_TEXTURE_3D = 1<<3
} TestRequirement;
} TestFlags;
/* For compatability since we used to use the glib gtester
* infrastructure and all our unit tests have an entry
@ -33,7 +34,7 @@ typedef struct _TestUtilsSharedState
void
test_utils_init (TestUtilsSharedState *state,
TestRequirement requirements);
TestFlags flags);
void
test_utils_fini (TestUtilsSharedState *state);