From patchwork Wed Dec 10 17:24:08 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Wood X-Patchwork-Id: 5471051 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 187E79F444 for ; Wed, 10 Dec 2014 17:24:19 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 30D84200CF for ; Wed, 10 Dec 2014 17:24:18 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 4CE26200BE for ; Wed, 10 Dec 2014 17:24:17 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B9A406E5EE; Wed, 10 Dec 2014 09:24:16 -0800 (PST) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-wg0-f54.google.com (mail-wg0-f54.google.com [74.125.82.54]) by gabe.freedesktop.org (Postfix) with ESMTP id 6227A6E5EE for ; Wed, 10 Dec 2014 09:24:13 -0800 (PST) Received: by mail-wg0-f54.google.com with SMTP id l2so4249021wgh.13 for ; Wed, 10 Dec 2014 09:24:12 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=8eOEHMQvJgXYvtgVAQYwwcE6wpxttB6Zr9M7QKV+b2A=; b=RxbxO+GbX9JrhRqspIOLlGs/zZKiKyOQQzp/vKt/EVVsINunJgxOa/hHdJq8plc4Tk H2QESDfSAuGTn9Gx07P+wt4ClNv+cX3x2xwjmjqKuPhbFGmb/KIHI0ekGewvy6ZlCGIl W8d6jqh5QLIZdxCoTpwT6dLtvbn1ZoUOPHxVOjjyI1Jod/eTM+e/VbyizPXXXr0rfmEQ VYfrNNG4YAf7i72ge8Tgwvtdh+SqAufTeaJdRLRQKYvbPCx+Dib9D5bAiONaoGkW6Oog efwZCdwxa45g5hWYVv8qWTof11TazB4UBcA2VidgxOEWCh1zACDTeyfdwCyfxBwWczkw aaLQ== X-Gm-Message-State: ALoCoQk1uceUiT7yB6LqIR/iBVmQsmX981CqleYoSFKkabq4z8zMWoLuksPtQS9jf5pw1EtbjsJS X-Received: by 10.180.73.178 with SMTP id m18mr8007566wiv.65.1418232252776; Wed, 10 Dec 2014 09:24:12 -0800 (PST) Received: from pistachio.icx.intel.com ([83.217.123.106]) by mx.google.com with ESMTPSA id d5sm6653988wjb.34.2014.12.10.09.24.11 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 10 Dec 2014 09:24:11 -0800 (PST) From: Thomas Wood To: intel-gfx@lists.freedesktop.org Date: Wed, 10 Dec 2014 17:24:08 +0000 Message-Id: <1418232248-25565-2-git-send-email-thomas.wood@intel.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1418232248-25565-1-git-send-email-thomas.wood@intel.com> References: <1418232248-25565-1-git-send-email-thomas.wood@intel.com> Subject: [Intel-gfx] [PATCH i-g-t v2 2/2] lib: add optional log domain filtering X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP v2: add an "application" filter for the default domain (used by applications) Signed-off-by: Thomas Wood --- 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 @@ - + - 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) 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 \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);