From patchwork Tue Oct 28 15:03:53 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Wood X-Patchwork-Id: 5177951 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id F20E7C11AC for ; Tue, 28 Oct 2014 15:04:08 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4EA652021F for ; Tue, 28 Oct 2014 15:04:04 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 3E3F8201B4 for ; Tue, 28 Oct 2014 15:04:03 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9CBB06E491; Tue, 28 Oct 2014 08:04:02 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-wi0-f182.google.com (mail-wi0-f182.google.com [209.85.212.182]) by gabe.freedesktop.org (Postfix) with ESMTP id A616D6E3F5 for ; Tue, 28 Oct 2014 08:04:01 -0700 (PDT) Received: by mail-wi0-f182.google.com with SMTP id d1so1883644wiv.9 for ; Tue, 28 Oct 2014 08:04:00 -0700 (PDT) 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; bh=dilqwgALKKg3QX0NTh+M1DGmTCYcns8b/HV8NWPfiE4=; b=A+xjylqJH8wWqRRX4iVSgByxzgOFLx/nrKqJg1oncBKPzf/xoBXaKwBbHXIZjEoasm PvWwLMXdasoN7HLY082ns6uUKxSnNKsv6y42naVk4I4BtDrLbSdy0gNknhxosykgN8EZ hh73Ok43CD0bjOKuyxNAcNQTlLigx09SUEnM+teDUgXKBUSM+XFDYHgmlqE35Zpy5CFT vL0hAR1TnaVWp8KDMddz8In2nKXSYaHL6p64ZsWnl3eox7VZX+TK76mLT0sbunyxVlf9 /JQhLTmAJEBF5xO/XzYOehbSgtxVLq/D+5GDP3S9yqyX8dbHSiTxhC14JMa8AB61uw8e HAzQ== X-Gm-Message-State: ALoCoQl7wrzXTyiwfe9UMtzdun78FqlIy521kJncAOJrJFX7rKDTdh5o3qI+R67+9o725g+kpBnc X-Received: by 10.180.11.200 with SMTP id s8mr28424156wib.20.1414508640088; Tue, 28 Oct 2014 08:04:00 -0700 (PDT) Received: from pistachio.icx.intel.com ([83.217.123.106]) by mx.google.com with ESMTPSA id ic4sm15688465wid.19.2014.10.28.08.03.58 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 Oct 2014 08:03:59 -0700 (PDT) From: Thomas Wood To: intel-gfx@lists.freedesktop.org Date: Tue, 28 Oct 2014 15:03:53 +0000 Message-Id: <1414508636-13543-1-git-send-email-thomas.wood@intel.com> X-Mailer: git-send-email 2.1.0 Subject: [Intel-gfx] [PATCH i-g-t 1/4] lib: add the ability to include a description with a test 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.8 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, 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 Signed-off-by: Thomas Wood --- lib/igt_core.c | 19 ++++++++++++++++--- lib/igt_core.h | 3 +++ 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/lib/igt_core.c b/lib/igt_core.c index e3d5fb0..3861121 100644 --- a/lib/igt_core.c +++ b/lib/igt_core.c @@ -223,6 +223,7 @@ bool test_child; enum { OPT_LIST_SUBTESTS, OPT_RUN_SUBTEST, + OPT_DESCRIPTION, OPT_DEBUG, OPT_HELP = 'h' }; @@ -360,6 +361,12 @@ static void common_exit_handler(int sig) assert(sig != 0 || igt_exit_called); } +static void print_test_description(void) +{ + if (&__igt_test_description) + printf("%s\n", __igt_test_description); +} + static void print_version(void) { struct utsname uts; @@ -380,11 +387,12 @@ static void print_usage(const char *help_str, bool output_on_stderr) { FILE *f = output_on_stderr ? stderr : stdout; - fprintf(f, "Usage: %s [OPTIONS]\n" - " --list-subtests\n" + fprintf(f, "Usage: %s [OPTIONS]\n", command_str); + fprintf(f, " --list-subtests\n" " --run-subtest \n" " --debug\n" - " --help\n", command_str); + " --help-description\n" + " --help\n"); if (help_str) fprintf(f, "%s\n", help_str); } @@ -413,6 +421,7 @@ static int common_init(int argc, char **argv, static struct option long_options[] = { {"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}, {"help", 0, 0, OPT_HELP}, {0, 0, 0, 0} @@ -510,6 +519,10 @@ static int common_init(int argc, char **argv, if (!list_subtests) run_single_subtest = strdup(optarg); break; + case OPT_DESCRIPTION: + print_test_description(); + ret = -1; + goto out; case OPT_HELP: print_usage(help_str, false); ret = -1; diff --git a/lib/igt_core.h b/lib/igt_core.h index b8f6702..98b8951 100644 --- a/lib/igt_core.h +++ b/lib/igt_core.h @@ -38,6 +38,9 @@ #include #include +extern const char* __igt_test_description __attribute__((weak)); +#define IGT_TEST_DESCRIPTION(a) const char* __igt_test_description = a; + /** * IGT_EXIT_TIMEOUT: *