On 12 January 2015 at 18:22, Rodrigo Vivi <rodrigo.vivi@xxxxxxxxx> wrote: > This loop option can help intensive tests everywhere. > The only caveat is that tests reimplementing main function has to implement his own loop. Could you also add a short description of the new command line options to the test program documentation? > > Signed-off-by: Rodrigo Vivi <rodrigo.vivi@xxxxxxxxx> > --- > lib/igt_core.c | 11 +++++++++++ > lib/igt_core.h | 18 ++++++++++++------ > 2 files changed, 23 insertions(+), 6 deletions(-) > > diff --git a/lib/igt_core.c b/lib/igt_core.c > index bd655be..3724348 100644 > --- a/lib/igt_core.c > +++ b/lib/igt_core.c > @@ -234,6 +234,7 @@ enum { > OPT_DESCRIPTION, > OPT_DEBUG, > OPT_INTERACTIVE_DEBUG, > + OPT_LOOP, > OPT_HELP = 'h' > }; > > @@ -405,6 +406,7 @@ static void print_usage(const char *help_str, bool output_on_stderr) > " --run-subtest <pattern>\n" > " --debug[=log-domain]\n" > " --interactive-debug[=domain]\n" > + " --loop[=times]\n" > " --help-description\n" > " --help\n"); > if (help_str) > @@ -438,6 +440,7 @@ static int common_init(int argc, char **argv, > {"help-description", 0, 0, OPT_DESCRIPTION}, > {"debug", optional_argument, 0, OPT_DEBUG}, > {"interactive-debug", optional_argument, 0, OPT_INTERACTIVE_DEBUG}, > + {"loop", optional_argument, 0, OPT_LOOP}, > {"help", 0, 0, OPT_HELP}, > {0, 0, 0, 0} > }; > @@ -520,9 +523,17 @@ static int common_init(int argc, char **argv, > std_short_opts); > assert(ret >= 0); > > + igt_loop = 0; > + > while ((c = getopt_long(argc, argv, short_opts, combined_opts, > &option_index)) != -1) { > switch(c) { > + case OPT_LOOP: > + if (optarg && strlen(optarg) > 0) > + igt_loop = atoi(optarg); > + else > + igt_loop = -1; > + break; > case OPT_INTERACTIVE_DEBUG: > if (optarg && strlen(optarg) > 0) > igt_interactive_debug = strdup(optarg); > diff --git a/lib/igt_core.h b/lib/igt_core.h > index 32041f6..4dbe893 100644 > --- a/lib/igt_core.h > +++ b/lib/igt_core.h > @@ -175,9 +175,11 @@ bool igt_only_list_subtests(void); > #define igt_main \ > static void igt_tokencat(__real_main, __LINE__)(void); \ > int main(int argc, char **argv) { \ > - igt_subtest_init(argc, argv); \ > - igt_tokencat(__real_main, __LINE__)(); \ > - igt_exit(); \ > + do { \ > + igt_subtest_init(argc, argv); \ > + igt_tokencat(__real_main, __LINE__)(); \ > + igt_exit(); \ > + } while (igt_loop == -1 || --igt_loop); \ > } \ > static void igt_tokencat(__real_main, __LINE__)(void) \ > > @@ -198,9 +200,11 @@ void igt_simple_init_parse_opts(int argc, char **argv, > #define igt_simple_main \ > static void igt_tokencat(__real_main, __LINE__)(void); \ > int main(int argc, char **argv) { \ > - igt_simple_init(argc, argv); \ > - igt_tokencat(__real_main, __LINE__)(); \ > - igt_exit(); \ > + do { \ > + igt_simple_init(argc, argv); \ > + igt_tokencat(__real_main, __LINE__)(); \ > + igt_exit(); \ > + } while (igt_loop == -1 || --igt_loop); \ > } \ > static void igt_tokencat(__real_main, __LINE__)(void) \ > > @@ -511,6 +515,8 @@ bool igt_run_in_simulation(void); > > void igt_skip_on_simulation(void); > > +int igt_loop; > + > const char *igt_interactive_debug; > > /* structured logging */ > -- > 2.1.0 > > _______________________________________________ > Intel-gfx mailing list > Intel-gfx@xxxxxxxxxxxxxxxxxxxxx > http://lists.freedesktop.org/mailman/listinfo/intel-gfx _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/intel-gfx