[igt-dev] [PATCH i-g-t 31/36] kms_psr: Nuke custom main function

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


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

diff --git a/tests/kms_psr.c b/tests/kms_psr.c
index 3e16a6bf..39de0112 100644
--- a/tests/kms_psr.c
+++ b/tests/kms_psr.c
@@ -411,29 +411,28 @@ static int opt_handler(int opt, int opt_index, void *_data)
 		data->with_psr_disabled = true;
 		break;
 	default:
-		igt_assert(0);
+		return IGT_OPT_HANDLER_ERROR;
 	}
 
-	return 0;
+	return IGT_OPT_HANDLER_SUCCESS;
 }
 
-int main(int argc, char *argv[])
+const char *help_str =
+	"  --no-psr\tRun test without PSR/PSR2.";
+static struct option long_options[] = {
+	{"no-psr", 0, 0, 'n'},
+	{ 0, 0, 0, 0 }
+};
+data_t data = {};
+
+igt_main_args("", long_options, help_str, opt_handler, &data)
 {
-	const char *help_str =
-	       "  --no-psr\tRun test without PSR/PSR2.";
-	static struct option long_options[] = {
-		{"no-psr", 0, 0, 'n'},
-		{ 0, 0, 0, 0 }
-	};
-	data_t data = {};
 	enum operations op;
 	const char *append_subtest_name[2] = {
 		"",
 		"psr2_"
 	};
 
-	igt_subtest_init_parse_opts(&argc, argv, "", long_options,
-				    help_str, opt_handler, &data);
 	igt_skip_on_simulation();
 
 	igt_fixture {
@@ -533,6 +532,4 @@ int main(int argc, char *argv[])
 		drm_intel_bufmgr_destroy(data.bufmgr);
 		display_fini(&data);
 	}
-
-	igt_exit();
 }
-- 
2.19.1



More information about the igt-dev mailing list