[Piglit] [PATCH 03/13] util/gl: Reject unrecongized subtest names

Chad Versace chad.versace at linux.intel.com
Wed Mar 26 10:40:19 PDT 2014


If the user specifies "-subtest $NAME" on the command line, but
the test defines no subtest with that name, then
piglit_parse_subtest_args() now reports PIGLIT_FAIL.

The test should fail early as possible on usage errors. Pre-patch, if
the user requested an invalid subtest name, the test did not fail until
it attempted to execute the invalid subtest. Post-patch, the test fails
during arg parsing.

Signed-off-by: Chad Versace <chad.versace at linux.intel.com>
---
 tests/util/piglit-framework-gl.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/tests/util/piglit-framework-gl.c b/tests/util/piglit-framework-gl.c
index 8fb7eaf..beaa829 100644
--- a/tests/util/piglit-framework-gl.c
+++ b/tests/util/piglit-framework-gl.c
@@ -80,6 +80,12 @@ piglit_parse_subtest_args(int *argc, char *argv[],
 				piglit_report_result(PIGLIT_FAIL);
 			}
 
+			if (!piglit_find_subtest(subtests, argv[j])) {
+				fprintf(stderr, "Test defines no subtest with "
+					"name '%s'\n", argv[j]);
+				piglit_report_result(PIGLIT_FAIL);
+			}
+
 			selected_subtests =
 				realloc(selected_subtests,
 					(num_selected_subtests + 1)
-- 
1.8.5.3



More information about the Piglit mailing list