tests/kms_psr_sink_crc: Use options
PATCH 1/1 tests/kms_psr_sink_crc: Use options
Env variables are a bit more annoying since much harder to discover. With options you can just see what they do with --help.
--- tests/kms_psr_sink_crc.c | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-)
tests/kms_psr_sink_crc.c +24 -6
@@ -468,16 +468,32 @@ static void run_test(data_t *data) } } -igt_main +static int opt_handler (int opt,int opt_index) { -data_t data = {}; -enum operations op; -char *env_psr; +switch (opt) { +case 'n' : + running_with_psr_disabled = true; +break ; +default : +igt_assert (0 ); + } - env_psr =getenv ("IGT_PSR_DISABLED" ); +return 0 ; +} - running_with_psr_disabled = (bool ) env_psr; +int main (int argc,char *argv[]) +{ +const char *help_str = +" --no-psr\tRun test without PSR to check the CRC test logic." ; +static struct option long_options[] = { + {"no-psr" ,0 ,0 ,'n' }, + {0 ,0 ,0 ,0 } + }; +data_t data = {}; +enum operations op; +igt_subtest_init_parse_opts (argc, argv,"" , long_options, + help_str, opt_handler);igt_skip_on_simulation (); igt_fixture {
@@ -522,4 +538,6 @@ igt_maindrm_intel_bufmgr_destroy (data.bufmgr);display_fini (&data); } + +igt_exit (); }
Signature · 1 line
2.1.0
I had tried options but didn't liked because I was unable to list subtests... so I gave back to env var...
But now I see that I was probably forgetting igt_subtest_init_parse_opts()
Thanks
Acked/Reviewed-by: Rodrigo Vivi <[email protected]>
________________________________________
From: Daniel Vetter [[email protected]]
Sent: Tuesday, September 23, 2014 6:16 AM
To: Intel Graphics Development
Cc: Daniel Vetter; Vivi, Rodrigo; Vetter, Daniel
Subject: [PATCH] tests/kms_psr_sink_crc: Use options
Env variables are a bit more annoying since much harder to discover. With options you can just see what they do with --help.
--- tests/kms_psr_sink_crc.c | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-)
tests/kms_psr_sink_crc.c +24 -6
@@ -468,16 +468,32 @@ static void run_test(data_t *data) } } -igt_main +static int opt_handler (int opt,int opt_index) { -data_t data = {}; -enum operations op; -char *env_psr; +switch (opt) { +case 'n' : + running_with_psr_disabled = true; +break ; +default : +igt_assert (0 ); + } - env_psr =getenv ("IGT_PSR_DISABLED" ); +return 0 ; +} - running_with_psr_disabled = (bool ) env_psr; +int main (int argc,char *argv[]) +{ +const char *help_str = +" --no-psr\tRun test without PSR to check the CRC test logic." ; +static struct option long_options[] = { + {"no-psr" ,0 ,0 ,'n' }, + {0 ,0 ,0 ,0 } + }; +data_t data = {}; +enum operations op; +igt_subtest_init_parse_opts (argc, argv,"" , long_options, + help_str, opt_handler);igt_skip_on_simulation (); igt_fixture {
@@ -522,4 +538,6 @@ igt_maindrm_intel_bufmgr_destroy (data.bufmgr);display_fini (&data); } + +igt_exit (); }
--
2.1.0
Quoted 3 lines · Rodrigo
I had tried options but didn't liked because I was unable to list subtests... so I gave back to env var...
But now I see that I was probably forgetting
igt_subtest_init_parse_opts()
Please poke me next time around you want to do something in igt and it doesn't seem to be easily possible. Writing tests is a nuisance so I want to make it as simple and pain-free as possible, and that only works when people raise issues instead of papering over them.
Quoted 4 lines
Thanks
Acked/Reviewed-by: Rodrigo Vivi <[email protected]>
Thanks for the review, patch merged.
-Daniel
Quoted 69 lines
________________________________________
From: Daniel Vetter [[email protected]]
Sent: Tuesday, September 23, 2014 6:16 AM
To: Intel Graphics Development
Cc: Daniel Vetter; Vivi, Rodrigo; Vetter, Daniel
Subject: [PATCH] tests/kms_psr_sink_crc: Use optionsEnv variables are a bit more annoying since much harder to discover. With options you can just see what they do with --help.
Cc Rodrigo Vivi <[email protected]>Signed-off-by Daniel Vetter <[email protected]>--- tests/kms_psr_sink_crc.c | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-)tests/kms_psr_sink_crc.c +24
-7@@ -468,16 +468,32 @@ static void run_test(data_t *data) } } -igt_main +static int opt_handler (int opt,int opt_index) { -data_t data = {}; -enum operations op; -char *env_psr; +switch (opt) { +case 'n' : + running_with_psr_disabled = true; +break ; +default : +igt_assert (0 ); + } - env_psr =getenv ("IGT_PSR_DISABLED" ); +return 0 ; +} - running_with_psr_disabled = (bool ) env_psr; +int main (int argc,char *argv[]) +{ +const char *help_str = +" --no-psr\tRun test without PSR to check the CRC test logic." ; +static struct option long_options[] = { + {"no-psr" ,0 ,0 ,'n' }, + {0 ,0 ,0 ,0 } + }; +data_t data = {}; +enum operations op; +igt_subtest_init_parse_opts (argc, argv,"" , long_options, + help_str, opt_handler);igt_skip_on_simulation (); igt_fixture {@@ -522,4 +538,6 @@ igt_maindrm_intel_bufmgr_destroy (data.bufmgr);display_fini (&data); } + +igt_exit (); } --2.1.0
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch