1
0
Fork 0

tests: Don't report success when the test is skipped

The tests that were using GLSL or 3D textures were directly printing
“Skipped” and then reporting success. Instead of doing this they now
just try to continue without checking for the feature but the
appropriate test requirement flag is now set in test-conform-main so
the table of results will correctly display that is a failure.

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

(cherry picked from commit b8f918e44b243a5fa36d5f382a90bebb0de0728f)
This commit is contained in:
Neil Roberts 2012-11-09 15:14:33 +00:00 committed by Robert Bragg
parent fa62fe2a4f
commit 0b8780f94c
8 changed files with 86 additions and 112 deletions

View file

@ -69,7 +69,7 @@ main (int argc, char **argv)
ADD_TEST (test_sub_texture, 0);
ADD_TEST (test_pixel_buffer, 0);
UNPORTED_TEST (test_texture_rectangle);
ADD_TEST (test_texture_3d, 0);
ADD_TEST (test_texture_3d, TEST_REQUIREMENT_TEXTURE_3D);
ADD_TEST (test_wrap_modes, 0);
UNPORTED_TEST (test_texture_pixmap_x11);
UNPORTED_TEST (test_texture_get_set_data);
@ -83,10 +83,10 @@ main (int argc, char **argv)
ADD_TEST (test_primitive, 0);
ADD_TEST (test_just_vertex_shader, 0);
ADD_TEST (test_pipeline_uniforms, 0);
ADD_TEST (test_snippets, 0);
ADD_TEST (test_custom_attributes, 0);
ADD_TEST (test_just_vertex_shader, TEST_REQUIREMENT_GLSL);
ADD_TEST (test_pipeline_uniforms, TEST_REQUIREMENT_GLSL);
ADD_TEST (test_snippets, TEST_REQUIREMENT_GLSL);
ADD_TEST (test_custom_attributes, TEST_REQUIREMENT_GLSL);
ADD_TEST (test_bitmask, 0);

View file

@ -270,33 +270,27 @@ paint (TestState *state)
void
test_custom_attributes (void)
{
/* If shaders aren't supported then we can't run the test */
if (cogl_features_available (COGL_FEATURE_SHADERS_GLSL))
{
CoglSnippet *snippet;
TestState state;
CoglSnippet *snippet;
TestState state;
cogl_framebuffer_orthographic (test_fb,
0, 0,
cogl_framebuffer_get_width (test_fb),
cogl_framebuffer_get_height (test_fb),
-1,
100);
cogl_framebuffer_orthographic (test_fb,
0, 0,
cogl_framebuffer_get_width (test_fb),
cogl_framebuffer_get_height (test_fb),
-1,
100);
state.pipeline = cogl_pipeline_new (test_ctx);
snippet = cogl_snippet_new (COGL_SNIPPET_HOOK_VERTEX,
"attribute vec4 color;",
"cogl_color_out = color;");
cogl_pipeline_add_snippet (state.pipeline, snippet);
state.pipeline = cogl_pipeline_new (test_ctx);
snippet = cogl_snippet_new (COGL_SNIPPET_HOOK_VERTEX,
"attribute vec4 color;",
"cogl_color_out = color;");
cogl_pipeline_add_snippet (state.pipeline, snippet);
paint (&state);
paint (&state);
cogl_object_unref (state.pipeline);
cogl_object_unref (snippet);
cogl_object_unref (state.pipeline);
cogl_object_unref (snippet);
if (cogl_test_verbose ())
g_print ("OK\n");
}
else if (cogl_test_verbose ())
g_print ("Skipping\n");
if (cogl_test_verbose ())
g_print ("OK\n");
}

View file

@ -186,25 +186,18 @@ test_just_vertex_shader (void)
-1,
100);
/* If shaders aren't supported then we can't run the test */
if (cogl_features_available (COGL_FEATURE_SHADERS_GLSL))
{
/* XXX: we have to push/pop a framebuffer since this test currently
* uses the legacy cogl_rectangle() api. */
cogl_push_framebuffer (test_fb);
/* XXX: we have to push/pop a framebuffer since this test currently
* uses the legacy cogl_rectangle() api. */
cogl_push_framebuffer (test_fb);
paint_legacy (&state);
validate_result (test_fb);
paint_legacy (&state);
validate_result (test_fb);
paint (&state);
validate_result (test_fb);
paint (&state);
validate_result (test_fb);
cogl_pop_framebuffer ();
cogl_pop_framebuffer ();
if (cogl_test_verbose ())
g_print ("OK\n");
}
else if (cogl_test_verbose ())
g_print ("Skipping\n");
if (cogl_test_verbose ())
g_print ("OK\n");
}

View file

@ -383,39 +383,33 @@ validate_long_pipeline_result (void)
void
test_pipeline_uniforms (void)
{
/* If shaders aren't supported then we can't run the test */
if (cogl_features_available (COGL_FEATURE_SHADERS_GLSL))
{
TestState state;
TestState state;
init_state (&state);
init_state (&state);
cogl_framebuffer_orthographic (test_fb,
0, 0,
cogl_framebuffer_get_width (test_fb),
cogl_framebuffer_get_height (test_fb),
-1,
100);
cogl_framebuffer_orthographic (test_fb,
0, 0,
cogl_framebuffer_get_width (test_fb),
cogl_framebuffer_get_height (test_fb),
-1,
100);
paint (&state);
validate_result ();
paint (&state);
validate_result ();
/* Try the test again after querying the location of a large
number of uniforms. This should verify that the bitmasks
still work even if they have to allocate a separate array to
store the bits */
/* Try the test again after querying the location of a large
number of uniforms. This should verify that the bitmasks
still work even if they have to allocate a separate array to
store the bits */
init_long_pipeline_state (&state);
paint (&state);
paint_long_pipeline (&state);
validate_result ();
validate_long_pipeline_result ();
init_long_pipeline_state (&state);
paint (&state);
paint_long_pipeline (&state);
validate_result ();
validate_long_pipeline_result ();
destroy_state (&state);
destroy_state (&state);
if (cogl_test_verbose ())
g_print ("OK\n");
}
else if (cogl_test_verbose ())
g_print ("Skipping\n");
if (cogl_test_verbose ())
g_print ("OK\n");
}

View file

@ -691,23 +691,17 @@ run_tests (TestState *state)
void
test_snippets (void)
{
/* If shaders aren't supported then we can't run the test */
if (cogl_features_available (COGL_FEATURE_SHADERS_GLSL))
{
TestState state;
TestState state;
cogl_framebuffer_orthographic (test_fb,
0, 0,
cogl_framebuffer_get_width (test_fb),
cogl_framebuffer_get_height (test_fb),
-1,
100);
cogl_framebuffer_orthographic (test_fb,
0, 0,
cogl_framebuffer_get_width (test_fb),
cogl_framebuffer_get_height (test_fb),
-1,
100);
run_tests (&state);
run_tests (&state);
if (cogl_test_verbose ())
g_print ("OK\n");
}
else if (cogl_test_verbose ())
g_print ("Skipping\n");
if (cogl_test_verbose ())
g_print ("OK\n");
}

View file

@ -256,30 +256,22 @@ test_multi_texture (TestState *state)
void
test_texture_3d (void)
{
/* Check whether GL supports the rectangle extension. If not we'll
just assume the test passes */
if (cogl_has_feature (test_ctx, COGL_FEATURE_ID_TEXTURE_3D))
{
TestState state;
TestState state;
state.fb_width = cogl_framebuffer_get_width (test_fb);
state.fb_height = cogl_framebuffer_get_height (test_fb);
state.fb_width = cogl_framebuffer_get_width (test_fb);
state.fb_height = cogl_framebuffer_get_height (test_fb);
cogl_framebuffer_orthographic (test_fb,
0, 0, /* x_1, y_1 */
state.fb_width, /* x_2 */
state.fb_height /* y_2 */,
-1, 100 /* near/far */);
cogl_framebuffer_orthographic (test_fb,
0, 0, /* x_1, y_1 */
state.fb_width, /* x_2 */
state.fb_height /* y_2 */,
-1, 100 /* near/far */);
draw_frame (&state);
validate_result ();
draw_frame (&state);
validate_result ();
test_multi_texture (&state);
test_multi_texture (&state);
if (cogl_test_verbose ())
g_print ("OK\n");
}
else if (cogl_test_verbose ())
g_print ("Skipping\n");
if (cogl_test_verbose ())
g_print ("OK\n");
}

View file

@ -89,6 +89,12 @@ test_utils_init (TestFlags flags)
missing_requirement = TRUE;
}
if (flags & TEST_REQUIREMENT_GLSL &&
!cogl_has_feature (test_ctx, COGL_FEATURE_ID_GLSL))
{
missing_requirement = TRUE;
}
if (flags & TEST_KNOWN_FAILURE)
{
missing_requirement = TRUE;

View file

@ -17,7 +17,8 @@ typedef enum _TestFlags
TEST_REQUIREMENT_TEXTURE_3D = 1<<3,
TEST_REQUIREMENT_POINT_SPRITE = 1<<4,
TEST_REQUIREMENT_GLES2_CONTEXT = 1<<5,
TEST_REQUIREMENT_MAP_WRITE = 1<<6
TEST_REQUIREMENT_MAP_WRITE = 1<<6,
TEST_REQUIREMENT_GLSL = 1<<7
} TestFlags;
extern CoglContext *test_ctx;