diff options
author | Thomas Wood <thomas.wood@intel.com> | 2014-07-21 15:57:16 +0100 |
---|---|---|
committer | Thomas Wood <thomas.wood@intel.com> | 2014-07-23 15:23:54 +0100 |
commit | 80d2c9bf82800b3cfc988879067c0e38947e5879 (patch) | |
tree | 8e963dae055c5f637b6bdf81ddbb1c599e133aa7 /tests/gem_ctx_basic.c | |
parent | 82b424a419e48e08ae112345ba517a81609ce7eb (diff) |
tests: convert simple tests to use igt_simple_init_parse_opts
Convert simple tests to use igt_simple_init_parse_opts if they require
extra options.
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
Diffstat (limited to 'tests/gem_ctx_basic.c')
-rw-r--r-- | tests/gem_ctx_basic.c | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/tests/gem_ctx_basic.c b/tests/gem_ctx_basic.c index a2464fde..a0bec602 100644 --- a/tests/gem_ctx_basic.c +++ b/tests/gem_ctx_basic.c @@ -39,7 +39,6 @@ #include <errno.h> #include <sys/stat.h> #include <sys/time.h> -#include <getopt.h> #include "drm.h" #include "ioctl_wrappers.h" #include "drmtest.h" @@ -119,11 +118,9 @@ static void *work(void *arg) pthread_exit(NULL); } -static void parse(int argc, char *argv[]) +static int opt_handler(int opt, int opt_index) { - int opt; - while ((opt = getopt(argc, argv, "i:c:n:muh?")) != -1) { - switch (opt) { + switch (opt) { case 'i': iter = atoi(optarg); break; @@ -136,20 +133,17 @@ static void parse(int argc, char *argv[]) case 'u': uncontexted = 1; break; - case 'h': - case '?': - default: - igt_success(); - break; - } } + + return 0; } int main(int argc, char *argv[]) { int i; - igt_simple_init(argc, argv); + igt_simple_init_parse_opts(argc, argv, "i:c:n:mu", NULL, NULL, + opt_handler); fd = drm_open_any_render(); devid = intel_get_drm_devid(fd); @@ -159,8 +153,6 @@ int main(int argc, char *argv[]) iter = 4; } - parse(argc, argv); - threads = calloc(num_contexts, sizeof(*threads)); for (i = 0; i < num_contexts; i++) |