Message ID | 1406113075-30860-5-git-send-email-thomas.wood@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Looks fine. > -----Original Message----- > From: Thomas Wood [mailto:thomas.wood@intel.com] > Sent: Wednesday, July 23, 2014 11:58 AM > To: intel-gfx@lists.freedesktop.org > Cc: Gore, Tim; daniel.vetter@ffwll.ch > Subject: [PATCH i-g-t 4/8] lib: add igt_simple_init_parse_opts > > This function allows simple tests to register additional command line options. > > Signed-off-by: Thomas Wood <thomas.wood@intel.com> Reviewed-by: Tim Gore <tim.gore@intel.com> > --- > lib/igt_core.c | 22 ++++++++++++++++++++++ lib/igt_core.h | 5 +++++ > 2 files changed, 27 insertions(+) > > diff --git a/lib/igt_core.c b/lib/igt_core.c index ee6f90c..72c77e6 100644 > --- a/lib/igt_core.c > +++ b/lib/igt_core.c > @@ -500,6 +500,28 @@ void igt_simple_init(int argc, char **argv) > optind = 1; > } > > +/** > + * igt_simple_init_parse_opts: > + * @argc: argc from the test's main() > + * @argv: argv from the test's main() > + * @extra_short_opts: getopt_long() compliant list with additional > +short options > + * @extra_long_opts: getopt_long() compliant list with additional long > +options > + * @help_str: help string for the additional options > + * @extra_opt_handler: handler for the additional options > + * > + * This initializes a simple test without any support for subtests and > +allows > + * an arbitrary set of additional options. > + */ > +void igt_simple_init_parse_opts(int argc, char **argv, > + const char *extra_short_opts, > + struct option *extra_long_opts, > + const char *help_str, > + igt_opt_handler_t extra_opt_handler) { > + common_init(argc, argv, extra_short_opts, extra_long_opts, > help_str, > + extra_opt_handler); > +} > + > /* > * Note: Testcases which use these helpers MUST NOT output anything to > stdout > * outside of places protected by igt_run_subtest checks - the piglit diff --git > a/lib/igt_core.h b/lib/igt_core.h index 6138487..408cf3a 100644 > --- a/lib/igt_core.h > +++ b/lib/igt_core.h > @@ -162,6 +162,11 @@ bool igt_only_list_subtests(void); > static void igt_tokencat(__real_main, __LINE__)(void) \ > > void igt_simple_init(int argc, char **argv); > +void igt_simple_init_parse_opts(int argc, char **argv, > + const char *extra_short_opts, > + struct option *extra_long_opts, > + const char *help_str, > + igt_opt_handler_t extra_opt_handler); > > /** > * igt_simple_main: > -- > 1.9.3
diff --git a/lib/igt_core.c b/lib/igt_core.c index ee6f90c..72c77e6 100644 --- a/lib/igt_core.c +++ b/lib/igt_core.c @@ -500,6 +500,28 @@ void igt_simple_init(int argc, char **argv) optind = 1; } +/** + * igt_simple_init_parse_opts: + * @argc: argc from the test's main() + * @argv: argv from the test's main() + * @extra_short_opts: getopt_long() compliant list with additional short options + * @extra_long_opts: getopt_long() compliant list with additional long options + * @help_str: help string for the additional options + * @extra_opt_handler: handler for the additional options + * + * This initializes a simple test without any support for subtests and allows + * an arbitrary set of additional options. + */ +void igt_simple_init_parse_opts(int argc, char **argv, + const char *extra_short_opts, + struct option *extra_long_opts, + const char *help_str, + igt_opt_handler_t extra_opt_handler) +{ + common_init(argc, argv, extra_short_opts, extra_long_opts, help_str, + extra_opt_handler); +} + /* * Note: Testcases which use these helpers MUST NOT output anything to stdout * outside of places protected by igt_run_subtest checks - the piglit diff --git a/lib/igt_core.h b/lib/igt_core.h index 6138487..408cf3a 100644 --- a/lib/igt_core.h +++ b/lib/igt_core.h @@ -162,6 +162,11 @@ bool igt_only_list_subtests(void); static void igt_tokencat(__real_main, __LINE__)(void) \ void igt_simple_init(int argc, char **argv); +void igt_simple_init_parse_opts(int argc, char **argv, + const char *extra_short_opts, + struct option *extra_long_opts, + const char *help_str, + igt_opt_handler_t extra_opt_handler); /** * igt_simple_main:
This function allows simple tests to register additional command line options. Signed-off-by: Thomas Wood <thomas.wood@intel.com> --- lib/igt_core.c | 22 ++++++++++++++++++++++ lib/igt_core.h | 5 +++++ 2 files changed, 27 insertions(+)