From 0b8780f94c499601c9570ff2708a9334bf6003c9 Mon Sep 17 00:00:00 2001 From: Neil Roberts Date: Fri, 9 Nov 2012 15:14:33 +0000 Subject: [PATCH] tests: Don't report success when the test is skipped MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 (cherry picked from commit b8f918e44b243a5fa36d5f382a90bebb0de0728f) --- tests/conform/test-conform-main.c | 10 ++--- tests/conform/test-custom-attributes.c | 42 +++++++++------------ tests/conform/test-just-vertex-shader.c | 27 +++++-------- tests/conform/test-pipeline-uniforms.c | 50 +++++++++++-------------- tests/conform/test-snippets.c | 26 +++++-------- tests/conform/test-texture-3d.c | 34 +++++++---------- tests/conform/test-utils.c | 6 +++ tests/conform/test-utils.h | 3 +- 8 files changed, 86 insertions(+), 112 deletions(-) diff --git a/tests/conform/test-conform-main.c b/tests/conform/test-conform-main.c index f2d0eb1b9..4e2c8bbbf 100644 --- a/tests/conform/test-conform-main.c +++ b/tests/conform/test-conform-main.c @@ -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); diff --git a/tests/conform/test-custom-attributes.c b/tests/conform/test-custom-attributes.c index 7c75149c4..fce541e70 100644 --- a/tests/conform/test-custom-attributes.c +++ b/tests/conform/test-custom-attributes.c @@ -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"); } diff --git a/tests/conform/test-just-vertex-shader.c b/tests/conform/test-just-vertex-shader.c index 7bbc33c52..9f06f823c 100644 --- a/tests/conform/test-just-vertex-shader.c +++ b/tests/conform/test-just-vertex-shader.c @@ -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"); } - diff --git a/tests/conform/test-pipeline-uniforms.c b/tests/conform/test-pipeline-uniforms.c index 61c7a3957..4d27558d2 100644 --- a/tests/conform/test-pipeline-uniforms.c +++ b/tests/conform/test-pipeline-uniforms.c @@ -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"); } diff --git a/tests/conform/test-snippets.c b/tests/conform/test-snippets.c index 072303f1e..51bd090a7 100644 --- a/tests/conform/test-snippets.c +++ b/tests/conform/test-snippets.c @@ -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"); } diff --git a/tests/conform/test-texture-3d.c b/tests/conform/test-texture-3d.c index 5080cbe09..97c47cf4d 100644 --- a/tests/conform/test-texture-3d.c +++ b/tests/conform/test-texture-3d.c @@ -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"); } - diff --git a/tests/conform/test-utils.c b/tests/conform/test-utils.c index 1901d1866..661926bef 100644 --- a/tests/conform/test-utils.c +++ b/tests/conform/test-utils.c @@ -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; diff --git a/tests/conform/test-utils.h b/tests/conform/test-utils.h index 511f39017..93cce27ba 100644 --- a/tests/conform/test-utils.h +++ b/tests/conform/test-utils.h @@ -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;