[igt-dev] [PATCH i-g-t 05/36] i915/gem_hang: Nuke custom main function
Petri Latvala
petri.latvala at intel.com
Thu May 23 12:26:56 UTC 2019
The pipe parameter, previously gotten from argv[1], is now the
parameter -p.
Signed-off-by: Petri Latvala <petri.latvala at intel.com>
---
tests/i915/gem_hang.c | 25 +++++++++++++++----------
1 file changed, 15 insertions(+), 10 deletions(-)
diff --git a/tests/i915/gem_hang.c b/tests/i915/gem_hang.c
index f506fc70..2c61cac0 100644
--- a/tests/i915/gem_hang.c
+++ b/tests/i915/gem_hang.c
@@ -64,17 +64,24 @@ gpu_hang(void)
intel_batchbuffer_flush(batch);
}
-int main(int argc, char **argv)
+static int opt_handler(int opt, int opt_index, void *data)
{
- int fd;
-
- igt_simple_init(argc, argv);
+ switch (opt) {
+ case 'p':
+ bad_pipe = atoi(optarg);
+ break;
+ default:
+ return IGT_OPT_HANDLER_ERROR;
+ }
+
+ return IGT_OPT_HANDLER_SUCCESS;
+}
- igt_assert_f(argc == 2,
- "usage: %s <disabled pipe number>\n",
- argv[0]);
+const char *help_str = " -p\tDisabled pipe number\n";
- bad_pipe = atoi(argv[1]);
+igt_simple_main_args("p:", NULL, help_str, opt_handler, NULL)
+{
+ int fd;
fd = drm_open_driver(DRIVER_INTEL);
@@ -88,6 +95,4 @@ int main(int argc, char **argv)
drm_intel_bufmgr_destroy(bufmgr);
close(fd);
-
- igt_exit();
}
--
2.19.1
More information about the igt-dev
mailing list