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

Ian Romanick idr at freedesktop.org
Tue Oct 15 17:32:47 PDT 2013


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);
 		}
 	}
 }
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



More information about the Piglit mailing list