[Cogl] [PATCH 1/3] tests: Don't report success when the test is skipped

Robert Bragg robert at sixbynine.org
Mon Nov 19 07:45:54 PST 2012


This looks good to me:

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

thanks,
- Robert

On Fri, Nov 9, 2012 at 4:56 PM, Neil Roberts <neil at linux.intel.com> wrote:

> 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.
> ---
>  tests/conform/test-conform-main.c       | 10 +++----
>  tests/conform/test-custom-attributes.c  | 52
> +++++++++++++++------------------
>  tests/conform/test-just-vertex-shader.c | 15 +++-------
>  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, 85 insertions(+), 111 deletions(-)
>
> diff --git a/tests/conform/test-conform-main.c
> b/tests/conform/test-conform-main.c
> index 9e2df06..701581c 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 e726488..fce541e 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_has_feature (test_ctx, COGL_FEATURE_ID_GLSL))
> -    {
> -      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);
> -
> -      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);
> -
> -      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");
> +  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);
> +
> +  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);
> +
> +  cogl_object_unref (state.pipeline);
> +  cogl_object_unref (snippet);
> +
> +  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 a87b4cf..26f5072 100644
> --- a/tests/conform/test-just-vertex-shader.c
> +++ b/tests/conform/test-just-vertex-shader.c
> @@ -95,16 +95,9 @@ test_just_vertex_shader (void)
>                                   -1,
>                                   100);
>
> -  /* If GLSL isn't supported then we can't run the test */
> -  if (cogl_has_feature (test_ctx, COGL_FEATURE_ID_GLSL))
> -    {
> -      paint (&state);
> -      validate_result (test_fb);
> +  paint (&state);
> +  validate_result (test_fb);
>
> -      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 d174550..3b41af0 100644
> --- a/tests/conform/test-pipeline-uniforms.c
> +++ b/tests/conform/test-pipeline-uniforms.c
> @@ -374,39 +374,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_has_feature (test_ctx, COGL_FEATURE_ID_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 c14ed58..51bd090 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_has_feature (test_ctx, COGL_FEATURE_ID_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 3ca1aa5..3891c31 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 c11b678..4ee0856 100644
> --- a/tests/conform/test-utils.c
> +++ b/tests/conform/test-utils.c
> @@ -88,6 +88,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 6ab278f..acd4fad 100644
> --- a/tests/conform/test-utils.h
> +++ b/tests/conform/test-utils.h
> @@ -15,7 +15,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;
> --
> 1.7.11.3.g3c3efa5
>
> _______________________________________________
> Cogl mailing list
> Cogl at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/cogl
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/cogl/attachments/20121119/ca50115d/attachment-0001.html>


More information about the Cogl mailing list