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 <[email protected]> --- 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 _______________________________________________ Piglit mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/piglit
