[Piglit] [PATCH v2 3/5] util: Add a -list-subtests option that will list all the subtests

Paul Berry stereotype441 at gmail.com
Mon Oct 21 11:34:49 PDT 2013


On 15 October 2013 17:32, Ian Romanick <idr at freedesktop.org> wrote:

> From: Ian Romanick <ian.d.romanick at intel.com>
>
> The utility is that all.tests can do 'sometest -list-subtests' to
> automatically get the list of subtests to run.  Since the syntax for
> selecting subtests is regularized, this works quite well.
>
> Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
> Cc: Chad Versace <chad.versace at linux.intel.com>
> ---
>  tests/util/piglit-framework-gl.c | 15 +++++++++++++++
>  tests/util/piglit-framework-gl.h |  8 ++++++++
>  2 files changed, 23 insertions(+)
>
> diff --git a/tests/util/piglit-framework-gl.c
> b/tests/util/piglit-framework-gl.c
> index 635b52c..c297a6a 100644
> --- a/tests/util/piglit-framework-gl.c
> +++ b/tests/util/piglit-framework-gl.c
> @@ -140,6 +140,21 @@ process_args(int *argc, char *argv[], unsigned
> *force_samples,
>                         }
>                         *argc -= 2;
>                         j -= 2;
> +               } else if (!strcmp(argv[j], "-list-subtests")) {
> +                       unsigned i;
> +
> +                       if (config->subtests == NULL) {
> +                               fprintf(stderr, "Test defines no
> subtests!\n");
> +                               exit(1);
> +                       }
> +
> +                       for (i = 0; config->subtests[i].name != NULL; i++)
> {
> +                               printf("%s: %s\n",
> +                                      config->subtests[i].option,
> +                                      config->subtests[i].name);
> +                       }
> +
> +                       exit(0);
>

Can we choose a standard way of marking the end of the subtest list, and
document it?  This patch uses subtests[i].name == NULL to mark the end of
the list, and the previous patch uses subtests[i].subtest_func == NULL.

With that fixed, this patch is:

Reviewed-by: Paul Berry <stereotype441 at gmail.com>


>                 }
>         }
>  }
> diff --git a/tests/util/piglit-framework-gl.h
> b/tests/util/piglit-framework-gl.h
> index 0aca75c..0eb839e 100644
> --- a/tests/util/piglit-framework-gl.h
> +++ b/tests/util/piglit-framework-gl.h
> @@ -184,6 +184,14 @@ struct piglit_gl_test_config {
>         (*display)(void);
>
>         /**
> +        * List of subtests supported by this test case
> +        *
> +        * This is only used during command line argument parsing to
> implement
> +        * the -list-subtests option.
> +        */
> +       const struct piglit_gl_subtest *subtests;
> +
> +       /**
>          * Names of subtests supplied on the command line.
>          *
>          * The paramaters passed to each -subtest command line option is
> --
> 1.8.1.4
>
> _______________________________________________
> Piglit mailing list
> Piglit at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/piglit/attachments/20131021/e1f3d9ab/attachment-0001.html>


More information about the Piglit mailing list