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

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


Signed-off-by: Petri Latvala <petri.latvala at intel.com>
---
 tests/i915/i915_pm_rpm.c | 29 ++++++++++++-----------------
 1 file changed, 12 insertions(+), 17 deletions(-)

diff --git a/tests/i915/i915_pm_rpm.c b/tests/i915/i915_pm_rpm.c
index a2c9d0ed..736cf72b 100644
--- a/tests/i915/i915_pm_rpm.c
+++ b/tests/i915/i915_pm_rpm.c
@@ -1950,26 +1950,23 @@ static int opt_handler(int opt, int opt_index, void *data)
 		stay = 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 =
-	       "  --stress\t\tMake the stress-tests more stressful.\n"
-	       "  --stay\t\tDisable all screen and try to go into runtime pm. Useful for debugging.";
-	static struct option long_options[] = {
-		{"stress", 0, 0, 'l'},
-		{"stay", 0, 0, 's'},
-		{ 0, 0, 0, 0 }
-	};
-
-	igt_subtest_init_parse_opts(&argc, argv, "", long_options,
-				    help_str, opt_handler, NULL);
+const char *help_str =
+	"  --stress\t\tMake the stress-tests more stressful.\n"
+	"  --stay\t\tDisable all screen and try to go into runtime pm. Useful for debugging.";
+static struct option long_options[] = {
+	{"stress", 0, 0, 'l'},
+	{"stay", 0, 0, 's'},
+	{ 0, 0, 0, 0 }
+};
 
+igt_main_args("", long_options, help_str, opt_handler, NULL)
+{
 	igt_subtest("basic-rte") {
 		igt_assert(setup_environment());
 		basic_subtest();
@@ -2120,6 +2117,4 @@ int main(int argc, char *argv[])
 		/* Remove our mmio_debugging module */
 		igt_i915_driver_unload();
 	}
-
-	igt_exit();
 }
-- 
2.19.1



More information about the igt-dev mailing list