From: Ian Romanick <ian.d.roman...@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.roman...@intel.com>
Cc: Chad Versace <chad.vers...@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);
                }
        }
 }
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@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit

Reply via email to