[igt-dev] [PATCH i-g-t 11/36] i915/gem_render_copy: Nuke custom main function

Petri Latvala petri.latvala at intel.com
Thu May 23 12:27:02 UTC 2019


Signed-off-by: Petri Latvala <petri.latvala at intel.com>
---
 tests/i915/gem_render_copy.c | 25 ++++++++++++++-----------
 1 file changed, 14 insertions(+), 11 deletions(-)

diff --git a/tests/i915/gem_render_copy.c b/tests/i915/gem_render_copy.c
index b5d1f45f..b8149483 100644
--- a/tests/i915/gem_render_copy.c
+++ b/tests/i915/gem_render_copy.c
@@ -678,24 +678,29 @@ static void test(data_t *data, uint32_t tiling, uint64_t ccs_modifier)
 
 static int opt_handler(int opt, int opt_index, void *data)
 {
-	if (opt == 'd') {
+	switch (opt) {
+	case 'd':
 		opt_dump_png = true;
-	}
-
-	if (opt == 'a') {
+		break;
+	case 'a':
 		check_all_pixels = true;
+		break;
+	default:
+		return IGT_OPT_HANDLER_ERROR;
 	}
 
-	return 0;
+	return IGT_OPT_HANDLER_SUCCESS;
 }
 
-int main(int argc, char **argv)
+const char *help_str =
+	"  -d\tDump PNG\n"
+	"  -a\tCheck all pixels\n"
+	;
+
+igt_main_args("da", NULL, help_str, opt_handler, NULL)
 {
 	data_t data = {0, };
 
-	igt_subtest_init_parse_opts(&argc, argv, "da", NULL, NULL,
-				    opt_handler, NULL);
-
 	igt_fixture {
 		data.drm_fd = drm_open_driver_render(DRIVER_INTEL);
 		data.devid = intel_get_drm_devid(data.drm_fd);
@@ -743,6 +748,4 @@ int main(int argc, char **argv)
 		intel_batchbuffer_free(data.batch);
 		drm_intel_bufmgr_destroy(data.bufmgr);
 	}
-
-	igt_exit();
 }
-- 
2.19.1



More information about the igt-dev mailing list