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

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


Signed-off-by: Petri Latvala <petri.latvala at intel.com>
---
 tests/kms_concurrent.c | 21 ++++++++-------------
 1 file changed, 8 insertions(+), 13 deletions(-)

diff --git a/tests/kms_concurrent.c b/tests/kms_concurrent.c
index d82ca040..23b05ea1 100644
--- a/tests/kms_concurrent.c
+++ b/tests/kms_concurrent.c
@@ -372,30 +372,27 @@ static int opt_handler(int option, int option_index, void *input)
 		opt.seed = strtol(optarg, NULL, 0);
 		break;
 	default:
-		igt_assert(false);
+		return IGT_OPT_HANDLER_ERROR;
 	}
 
-	return 0;
+	return IGT_OPT_HANDLER_SUCCESS;
 }
 
 const char *help_str =
 	"  --iterations Number of iterations for test coverage. -1 loop forever, default 1 iteration\n"
 	"  --seed       Seed for random number generator\n";
+struct option long_options[] = {
+	{ "iterations", required_argument, NULL, 'i'},
+	{ "seed",    required_argument, NULL, 's'},
+	{ 0, 0, 0, 0 }
+};
 
 static data_t data;
 
-int main(int argc, char *argv[])
+igt_main_args("", long_options, help_str, opt_handler, NULL)
 {
-	struct option long_options[] = {
-		{ "iterations", required_argument, NULL, 'i'},
-		{ "seed",    required_argument, NULL, 's'},
-		{ 0, 0, 0, 0 }
-	};
 	enum pipe pipe;
 
-	igt_subtest_init_parse_opts(&argc, argv, "", long_options, help_str,
-				    opt_handler, NULL);
-
 	igt_skip_on_simulation();
 
 	igt_fixture {
@@ -414,6 +411,4 @@ int main(int argc, char *argv[])
 		igt_display_fini(&data.display);
 		close(data.drm_fd);
 	}
-
-	igt_exit();
 }
-- 
2.19.1



More information about the igt-dev mailing list