[Piglit] [PATCH 09/20] fbo: Make an alternate function for initializing fbo-formats.h.

Anuj Phogat anuj.phogat at gmail.com
Thu Jun 7 10:49:58 PDT 2012


On Tue, Jun 5, 2012 at 5:03 PM, Paul Berry <stereotype441 at gmail.com> wrote:
> This patch extracts code from fbo_formats_init() into a separate
> function, fbo_formats_init_test_set(), which skips command line
> parsing and simply initializes fbo-formats.h to use a particular test
> set.  This will allow future tests to make use of fbo-formats.h even
> if they have to use different command-line parsing than what is
> implemented in fbo_formats_init().
>
> In addition, fbo_formats_init() has been changed to a non-static
> function, so that if an fbo test directly calls
> fbo_formats_init_test_set() instead, we won't get a spurious compile
> warning about an unused function.
> ---
>  tests/fbo/fbo-formats.h |   24 +++++++++++++++++-------
>  1 files changed, 17 insertions(+), 7 deletions(-)
>
> diff --git a/tests/fbo/fbo-formats.h b/tests/fbo/fbo-formats.h
> index 8275c39..02bbfc7 100644
> --- a/tests/fbo/fbo-formats.h
> +++ b/tests/fbo/fbo-formats.h
> @@ -568,7 +568,8 @@ fbo_lookup_test_set(const char *test_set_name)
>        exit(1);
>  }
>
> -static void fbo_formats_init(int argc, char **argv, GLboolean print_options)
> +static void
> +fbo_formats_init_test_set(int test_set_index, GLboolean print_options)
>  {
>        if (!piglit_automatic)
>                glutKeyboardFunc(fbo_formats_key_func);
> @@ -576,12 +577,7 @@ static void fbo_formats_init(int argc, char **argv, GLboolean print_options)
>        piglit_require_extension("GL_EXT_framebuffer_object");
>        piglit_require_extension("GL_ARB_texture_env_combine");
>
> -       if (argc == 2) {
> -               test_index = fbo_lookup_test_set(argv[1]);
> -       } else if (argc > 2) {
> -               printf("More than 1 test set specified\n");
> -               exit(1);
> -       }
> +       test_index = test_set_index;
>
>        if (!piglit_automatic && print_options) {
>                printf("    -n   Next test set.\n"
> @@ -593,6 +589,20 @@ static void fbo_formats_init(int argc, char **argv, GLboolean print_options)
>        printf("Using test set: %s\n", test_sets[test_index].param);
>  }
>
> +void
> +fbo_formats_init(int argc, char **argv, GLboolean print_options)
> +{
> +       int test_set_index = 0;
> +       if (argc == 2) {
> +               test_set_index = fbo_lookup_test_set(argv[1]);
> +       } else if (argc > 2) {
> +               printf("More than 1 test set specified\n");
> +               exit(1);
> +       }
> +
> +       fbo_formats_init_test_set(test_set_index, print_options);
> +}
> +
>  static void add_result(bool *all_skip, enum piglit_result *end_result,
>                       enum piglit_result new_result)
>  {
> --
> 1.7.7.6
>
> _______________________________________________
> Piglit mailing list
> Piglit at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit

Reviewed-by: Anuj Phogat <anuj.phogat at gmail.com>


More information about the Piglit mailing list