On Wed, May 28, 2014 at 07:24:04PM +0100, Damien Lespiau wrote:
> Sometimes it's practical to be able to set the logging level to debug
> from the command line arguments.
> 
> Signed-off-by: Damien Lespiau <damien.lesp...@intel.com>

The problem with this is that it won't work with simple igt tests which
don't use this for cmdline parsing. And I kinda don't like inconsistent
interfaces - I've originally considered this but then decided against it
since I didn't want to do the churn of going through all simple tests.

But now we have igt_simple_main which covers most simple tests, so this
would be feasible again. Care to do this right?

For bikesheds: I'd vote for -d --debug only, and maybe set the
igt_log_level variable directly.
-Daniel

> ---
>  lib/igt_core.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/lib/igt_core.c b/lib/igt_core.c
> index 6e553cf..9d59ab4 100644
> --- a/lib/igt_core.c
> +++ b/lib/igt_core.c
> @@ -274,6 +274,7 @@ static void print_usage(const char *command_str, const 
> char *help_str,
>       FILE *f = output_on_stderr ? stderr : stdout;
>  
>       fprintf(f, "Usage: %s [OPTIONS]\n"
> +                "  --igt-debug\n"
>                  "  --list-subtests\n"
>                  "  --run-subtest <pattern>\n", command_str);
>       if (help_str)
> @@ -317,6 +318,7 @@ int igt_subtest_init_parse_opts(int argc, char **argv,
>  {
>       int c, option_index = 0;
>       static struct option long_options[] = {
> +             {"igt-debug", 0, 0, 'd'},
>               {"list-subtests", 0, 0, 'l'},
>               {"run-subtest", 1, 0, 'r'},
>               {"help", 0, 0, 'h'},
> @@ -357,6 +359,9 @@ int igt_subtest_init_parse_opts(int argc, char **argv,
>       while ((c = getopt_long(argc, argv, short_opts, combined_opts,
>                              &option_index)) != -1) {
>               switch(c) {
> +             case 'd':
> +                     setenv("IGT_LOG_LEVEL", "debug", 1);
> +                     break;
>               case 'l':
>                       if (!run_single_subtest)
>                               list_subtests = true;
> -- 
> 1.8.3.1
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to