From: Thomas Wood <thomas.wood@intel.com>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH i-g-t v2 2/2] lib: add optional log domain filtering
Date: Wed, 10 Dec 2014 17:24:08 +0000 [thread overview]
Message-ID: <1418232248-25565-2-git-send-email-thomas.wood@intel.com> (raw)
In-Reply-To: <1418232248-25565-1-git-send-email-thomas.wood@intel.com>
v2: add an "application" filter for the default domain (used by
applications)
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
---
docs/reference/intel-gpu-tools/igt_test_programs.xml | 6 ++++--
lib/igt_core.c | 17 +++++++++++++++--
2 files changed, 19 insertions(+), 4 deletions(-)
diff --git a/docs/reference/intel-gpu-tools/igt_test_programs.xml b/docs/reference/intel-gpu-tools/igt_test_programs.xml
index 970ecb9..36ad1f3 100644
--- a/docs/reference/intel-gpu-tools/igt_test_programs.xml
+++ b/docs/reference/intel-gpu-tools/igt_test_programs.xml
@@ -35,9 +35,11 @@
</varlistentry>
<varlistentry>
- <term><option>--debug</option></term>
+ <term><option>--debug[=log-domain]</option></term>
<listitem><para>
- print extra debugging information when running tests
+ print extra debugging information when running tests and
+ optionaly only show the messages from the specified log domain
+ (use "application" to specifiy the default application domain)
</para></listitem>
</varlistentry>
diff --git a/lib/igt_core.c b/lib/igt_core.c
index b6852dd..695437c 100644
--- a/lib/igt_core.c
+++ b/lib/igt_core.c
@@ -228,6 +228,8 @@ enum {
OPT_HELP = 'h'
};
+static char* igt_log_domain_filter;
+
__attribute__((format(printf, 1, 2)))
static void kmsg(const char *format, ...)
#define KERN_EMER "<0>"
@@ -390,7 +392,7 @@ static void print_usage(const char *help_str, bool output_on_stderr)
fprintf(f, "Usage: %s [OPTIONS]\n", command_str);
fprintf(f, " --list-subtests\n"
" --run-subtest <pattern>\n"
- " --debug\n"
+ " --debug[=log-domain]\n"
" --help-description\n"
" --help\n");
if (help_str)
@@ -422,7 +424,7 @@ static int common_init(int argc, char **argv,
{"list-subtests", 0, 0, OPT_LIST_SUBTESTS},
{"run-subtest", 1, 0, OPT_RUN_SUBTEST},
{"help-description", 0, 0, OPT_DESCRIPTION},
- {"debug", 0, 0, OPT_DEBUG},
+ {"debug", optional_argument, 0, OPT_DEBUG},
{"help", 0, 0, OPT_HELP},
{0, 0, 0, 0}
};
@@ -510,6 +512,8 @@ static int common_init(int argc, char **argv,
switch(c) {
case OPT_DEBUG:
igt_log_level = IGT_LOG_DEBUG;
+ if (optarg && strlen(optarg) > 0)
+ igt_log_domain_filter = strdup(optarg);
break;
case OPT_LIST_SUBTESTS:
if (!run_single_subtest)
@@ -1469,6 +1473,15 @@ void igt_vlog(const char *domain, enum igt_log_level level, const char *format,
if (igt_log_level > level)
return;
+ if (igt_log_domain_filter) {
+ /* if null domain and filter is not "application", return */
+ if (!domain && strcmp(igt_log_domain_filter, "application"))
+ return;
+ /* else if domain and filter do not match, return */
+ else if (domain && strcmp(igt_log_domain_filter, domain))
+ return;
+ }
+
if (level == IGT_LOG_WARN) {
file = stderr;
fflush(stdout);
--
2.1.0
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2014-12-10 17:24 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-02 17:15 [PATCH i-g-t 1/5] lib: share common logging code Thomas Wood
2014-12-02 17:15 ` [PATCH i-g-t 2/5] tests/gem_tiled_swapping: use igt_info logging wrapper Thomas Wood
2014-12-02 17:15 ` [PATCH i-g-t 3/5] lib: introduce log domains Thomas Wood
2014-12-03 14:22 ` Daniel Vetter
2014-12-04 10:58 ` Thomas Wood
2014-12-10 17:24 ` [PATCH i-g-t v2 1/2] " Thomas Wood
2014-12-10 17:24 ` Thomas Wood [this message]
2014-12-02 17:15 ` [PATCH i-g-t 4/5] lib: add optional log domain filtering Thomas Wood
2014-12-02 17:15 ` [PATCH i-g-t 5/5] lib: write out recent log output if a test fails Thomas Wood
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1418232248-25565-2-git-send-email-thomas.wood@intel.com \
--to=thomas.wood@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox