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

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


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

diff --git a/tests/kms_plane_multiple.c b/tests/kms_plane_multiple.c
index d2d02a5f..a28b30cc 100644
--- a/tests/kms_plane_multiple.c
+++ b/tests/kms_plane_multiple.c
@@ -346,8 +346,8 @@ static int opt_handler(int option, int option_index, void *input)
 		opt.iterations = strtol(optarg, NULL, 0);
 
 		if (opt.iterations < LOOP_FOREVER || opt.iterations == 0) {
-			igt_info("incorrect number of iterations\n");
-			igt_assert(false);
+			igt_info("incorrect number of iterations: %d\n", opt.iterations);
+			return IGT_OPT_HANDLER_ERROR;
 		}
 
 		break;
@@ -356,28 +356,26 @@ 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 64 iterations\n"
 	"  --seed       Seed for random number generator\n";
 
-int main(int argc, char *argv[])
+struct option long_options[] = {
+	{ "iterations", required_argument, NULL, 'i'},
+	{ "seed",    required_argument, NULL, 's'},
+	{ 0, 0, 0, 0 }
+};
+
+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 {
@@ -396,6 +394,4 @@ int main(int argc, char *argv[])
 	igt_fixture {
 		igt_display_fini(&data.display);
 	}
-
-	igt_exit();
 }
-- 
2.19.1



More information about the igt-dev mailing list