summaryrefslogtreecommitdiff
path: root/tests/util
diff options
context:
space:
mode:
authorChad Versace <chadversary@chromium.org>2016-10-13 13:04:41 -0700
committerChad Versace <chadversary@chromium.org>2016-10-18 11:15:26 -0700
commit2c7106a0accd887ec676910bfa09cba2214e6a36 (patch)
tree6a02dc3a1e8bf07efda5331d20ed82b880ec28ca /tests/util
parentf30f65e0c8b14b884ffdc6cd7e5c34a430d10f26 (diff)
util: Parse -h|--help in piglit_parse_subtest_args()
If the args contain -h or --help, then print some help and exit. The help test describes how to list and run subtests. Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Diffstat (limited to 'tests/util')
-rw-r--r--tests/util/piglit-util.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/tests/util/piglit-util.c b/tests/util/piglit-util.c
index 6ed9c9c34..4bebf7da6 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;