diff options
author | Damien Lespiau <damien.lespiau@intel.com> | 2015-05-14 14:19:01 +0100 |
---|---|---|
committer | Damien Lespiau <damien.lespiau@intel.com> | 2015-05-15 12:22:14 +0100 |
commit | fd6846c99f00e265f558cf0106c833b96caf977f (patch) | |
tree | 44831be4a5e81f6cbbea73e6734dbaf68b99ad14 /tests | |
parent | 7a5e1c6f0aebcfabecc3db96cb87add894530326 (diff) |
lib: Add a user data pointer to the argument parsing functions
It can be useful to have one of those to carry state between the handler
parsing the options and the rest of the test. Right now the only thing
we can do is to use global variables for that.
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/gem_ctx_basic.c | 4 | ||||
-rw-r--r-- | tests/gem_render_copy.c | 5 | ||||
-rw-r--r-- | tests/gem_seqno_wrap.c | 4 | ||||
-rw-r--r-- | tests/gem_stress.c | 4 | ||||
-rw-r--r-- | tests/kms_psr_sink_crc.c | 4 | ||||
-rw-r--r-- | tests/kms_setmode.c | 4 | ||||
-rw-r--r-- | tests/pm_rpm.c | 4 |
7 files changed, 15 insertions, 14 deletions
diff --git a/tests/gem_ctx_basic.c b/tests/gem_ctx_basic.c index 9e9d925d..9aad7f84 100644 --- a/tests/gem_ctx_basic.c +++ b/tests/gem_ctx_basic.c @@ -120,7 +120,7 @@ static void *work(void *arg) pthread_exit(NULL); } -static int opt_handler(int opt, int opt_index) +static int opt_handler(int opt, int opt_index, void *data) { switch (opt) { case 'i': @@ -145,7 +145,7 @@ int main(int argc, char *argv[]) int i; igt_simple_init_parse_opts(&argc, argv, "i:c:n:mu", NULL, NULL, - opt_handler); + opt_handler, NULL); fd = drm_open_any_render(); devid = intel_get_drm_devid(fd); diff --git a/tests/gem_render_copy.c b/tests/gem_render_copy.c index df1ac881..ee37f8ad 100644 --- a/tests/gem_render_copy.c +++ b/tests/gem_render_copy.c @@ -120,7 +120,7 @@ scratch_buf_check(data_t *data, struct igt_buf *buf, int x, int y, color, val, x, y); } -static int opt_handler(int opt, int opt_index) +static int opt_handler(int opt, int opt_index, void *data) { if (opt == 'd') { opt_dump_png = true; @@ -141,7 +141,8 @@ int main(int argc, char **argv) igt_render_copyfunc_t render_copy = NULL; int opt_dump_aub = igt_aub_dump_enabled(); - igt_simple_init_parse_opts(&argc, argv, "da", NULL, NULL, opt_handler); + igt_simple_init_parse_opts(&argc, argv, "da", NULL, NULL, + opt_handler, NULL); igt_fixture { data.drm_fd = drm_open_any_render(); diff --git a/tests/gem_seqno_wrap.c b/tests/gem_seqno_wrap.c index 43da4505..d7d56ed1 100644 --- a/tests/gem_seqno_wrap.c +++ b/tests/gem_seqno_wrap.c @@ -434,7 +434,7 @@ static void background_run_once(void) sleep(3); } -static int parse_options(int opt, int opt_index) +static int parse_options(int opt, int opt_index, void *data) { switch(opt) { case 'b': @@ -504,7 +504,7 @@ int main(int argc, char **argv) options.buffers = 10; igt_simple_init_parse_opts(&argc, argv, "n:bvt:dp:ri:", long_options, - help, parse_options); + help, parse_options, NULL); card_index = drm_get_card(); diff --git a/tests/gem_stress.c b/tests/gem_stress.c index 804684f5..472263d4 100644 --- a/tests/gem_stress.c +++ b/tests/gem_stress.c @@ -624,7 +624,7 @@ static void sanitize_tiles_per_buf(void) options.tiles_per_buf = options.scratch_buf_size / TILE_BYTES(options.tile_size); } -static int parse_options(int opt, int opt_index) +static int parse_options(int opt, int opt_index, void *data) { int tmp; @@ -855,7 +855,7 @@ int main(int argc, char **argv) options.check_render_cpyfn = 0; igt_simple_init_parse_opts(&argc, argv,"ds:g:c:t:rbuxmo:fp:", - long_options, NULL, parse_options); + long_options, NULL, parse_options, NULL); drm_fd = drm_open_any(); devid = intel_get_drm_devid(drm_fd); diff --git a/tests/kms_psr_sink_crc.c b/tests/kms_psr_sink_crc.c index f5f95f49..099391b4 100644 --- a/tests/kms_psr_sink_crc.c +++ b/tests/kms_psr_sink_crc.c @@ -537,7 +537,7 @@ static void dpms_off_on(data_t data) DRM_MODE_DPMS_ON); } -static int opt_handler(int opt, int opt_index) +static int opt_handler(int opt, int opt_index, void *data) { switch (opt) { case 'n': @@ -562,7 +562,7 @@ int main(int argc, char *argv[]) enum operations op; igt_subtest_init_parse_opts(&argc, argv, "", long_options, - help_str, opt_handler); + help_str, opt_handler, NULL); igt_skip_on_simulation(); igt_fixture { diff --git a/tests/kms_setmode.c b/tests/kms_setmode.c index 5520dcc8..82769ab7 100644 --- a/tests/kms_setmode.c +++ b/tests/kms_setmode.c @@ -662,7 +662,7 @@ static void run_test(const struct test_config *tconf) test_combinations(tconf, connector_num); } -static int opt_handler(int opt, int opt_index) +static int opt_handler(int opt, int opt_index, void *data) { switch (opt) { case 'd': @@ -700,7 +700,7 @@ int main(int argc, char **argv) int ret; ret = igt_subtest_init_parse_opts(&argc, argv, "dt:", NULL, help_str, - opt_handler); + opt_handler, NULL); if (ret < 0) return ret == -1 ? 0 : ret; diff --git a/tests/pm_rpm.c b/tests/pm_rpm.c index 1a93fe8e..a1f40132 100644 --- a/tests/pm_rpm.c +++ b/tests/pm_rpm.c @@ -1791,7 +1791,7 @@ static void fences_subtest(bool dpms) int rounds = 40; bool stay = false; -static int opt_handler(int opt, int opt_index) +static int opt_handler(int opt, int opt_index, void *data) { switch (opt) { case 'q': @@ -1819,7 +1819,7 @@ int main(int argc, char *argv[]) }; igt_subtest_init_parse_opts(&argc, argv, "", long_options, - help_str, opt_handler); + help_str, opt_handler, NULL); /* Skip instead of failing in case the machine is not prepared to reach * PC8+. We don't want bug reports from cases where the machine is just |