From mboxrd@z Thu Jan 1 00:00:00 1970 From: Daniel Vetter Subject: Re: [PATCH 6/6] lib: Add a --igt-debug command line option Date: Wed, 28 May 2014 21:28:02 +0200 Message-ID: <20140528192802.GZ14841@phenom.ffwll.local> References: <1401301444-10824-1-git-send-email-damien.lespiau@intel.com> <1401301444-10824-7-git-send-email-damien.lespiau@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail-wi0-f172.google.com (mail-wi0-f172.google.com [209.85.212.172]) by gabe.freedesktop.org (Postfix) with ESMTP id CA6066E8F3 for ; Wed, 28 May 2014 12:28:07 -0700 (PDT) Received: by mail-wi0-f172.google.com with SMTP id hi2so4481848wib.5 for ; Wed, 28 May 2014 12:28:06 -0700 (PDT) Content-Disposition: inline In-Reply-To: <1401301444-10824-7-git-send-email-damien.lespiau@intel.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" To: Damien Lespiau Cc: intel-gfx@lists.freedesktop.org List-Id: intel-gfx@lists.freedesktop.org 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 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 \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