[Piglit] [PATCH 2/4] util: Parse -h|--help in piglit_parse_subtest_args()
Chad Versace
chadversary at chromium.org
Thu Oct 13 22:09:15 UTC 2016
If the args contain -h or --help, then print some help and exit.
The help test describes how to list and run subtests.
---
tests/util/piglit-util.c | 20 +++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)
diff --git a/tests/util/piglit-util.c b/tests/util/piglit-util.c
index 6ed9c9c..4bebf7d 100644
--- a/tests/util/piglit-util.c
+++ b/tests/util/piglit-util.c
@@ -650,8 +650,26 @@ piglit_parse_subtest_args(int *argc, char *argv[],
const char **selected_subtests = NULL;
size_t num_selected_subtests = 0;
+ const char *usage =
+ "usage:\n"
+ " %1$s\n"
+ " Run all subtests.\n"
+ "\n"
+ " %1$s -list-subtests\n"
+ " List all subtests.\n"
+ "\n"
+ " %1$s -subtest SUBTEST [-subtest SUBTEST [...]]\n"
+ " Run only the given subtests.\n"
+ "\n"
+ " %1$s -h|--help\n"
+ " Print this help message.\n"
+ ;
+
for (j = 1; j < *argc; j++) {
- if (streq(argv[j], "-subtest")) {
+ if (streq(argv[j], "-h") || streq(argv[j], "--help")) {
+ printf(usage, basename(argv[0]));
+ exit(EXIT_SUCCESS);
+ } else if (streq(argv[j], "-subtest")) {
int i;
++j;
--
2.10.0
More information about the Piglit
mailing list