summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2014-07-23 21:14:24 +0200
committerDaniel Vetter <daniel.vetter@ffwll.ch>2014-07-23 21:41:18 +0200
commit3efcb8c8ee3bade05cd01edf809f803a376f24a5 (patch)
treefa7e3ec361b866a0b0bd992c0eb42e922d167c5b /tests
parent556ebc7a7cdec2f5cfa90c8503e0a7e9493154c5 (diff)
tests/pm_rpm: Convert to new optparsing
Thomas missed the add-hoc parameter parsing in here, which did break things for Paulo since the core now fails for unknown options. Convert them over to the new infrastructure, which has the nice upside that we can remove the comments and put them into the usage available with --help. Cc: Thomas Wood <thomas.wood@intel.com> Cc: Paulo Zanoni <paulo.r.zanoni@intel.com> Tested-by: Paulo Zanoni <paulo.r.zanoni@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'tests')
-rw-r--r--tests/pm_rpm.c42
1 files changed, 28 insertions, 14 deletions
diff --git a/tests/pm_rpm.c b/tests/pm_rpm.c
index 1e63bc8f..869e6f3d 100644
--- a/tests/pm_rpm.c
+++ b/tests/pm_rpm.c
@@ -1407,24 +1407,38 @@ static void dpms_mode_unset_subtest(enum screen_type type)
igt_assert(wait_for_suspended());
}
-int main(int argc, char *argv[])
+int rounds = 50;
+bool stay = false;
+
+static int opt_handler(int opt, int opt_index)
{
- int rounds = 50;
- bool stay = false;
+ switch (opt) {
+ case 'q':
+ rounds = 10;
+ break;
+ case 's':
+ stay = true;
+ break;
+ default:
+ igt_assert(0);
+ }
- igt_subtest_init(argc, argv);
+ return 0;
+}
- /* The --quick option makes the stress tests not so stressful. Useful
- * when you're developing and just want to make a quick test to make
- * sure you didn't break everything. */
- if (argc > 1 && strcmp(argv[1], "--quick") == 0)
- rounds = 10;
+int main(int argc, char *argv[])
+{
+ const char *help_str =
+ " --quick\t\tMake the stress-tests not stressful, for quick regression testing.\n"
+ " --stay\t\tDisable all screen and try to go into runtime pm. Useful for debugging.";
+ static struct option long_options[] = {
+ {"quick", 0, 0, 'q'},
+ {"stay", 0, 0, 's'},
+ { 0, 0, 0, 0 }
+ };
- /* The --stay option enables a mode where we disable all the screens,
- * then stay like that, runtime suspended. This mode is useful for
- * running manual tests while debugging. */
- if (argc > 1 && strcmp(argv[1], "--stay") == 0)
- stay = true;
+ igt_subtest_init_parse_opts(argc, argv, "", long_options,
+ help_str, opt_handler);
/* Skip instead of failing in case the machine is not prepared to reach
* PC8+. We don't want bug reports from cases where the machine is just