From patchwork Fri Jul 25 16:08:39 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Wood X-Patchwork-Id: 4624481 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 914F09F36A for ; Fri, 25 Jul 2014 16:08:48 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9E2EB201FE for ; Fri, 25 Jul 2014 16:08:47 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 9E44B201F4 for ; Fri, 25 Jul 2014 16:08:46 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E5BE46E07A; Fri, 25 Jul 2014 09:08:45 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-we0-f178.google.com (mail-we0-f178.google.com [74.125.82.178]) by gabe.freedesktop.org (Postfix) with ESMTP id 57F226E07A for ; Fri, 25 Jul 2014 09:08:44 -0700 (PDT) Received: by mail-we0-f178.google.com with SMTP id w61so4571838wes.9 for ; Fri, 25 Jul 2014 09:08:42 -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:in-reply-to :references; bh=z610jvC7X3bI/fqO7dgzJNosiHzB1Ejb4QDxM2iLiQo=; b=P8Gnewlu+5+KVXwCIRsNGXljvPKgcAZsMEfNFBRPjWtKI+akLBwiYvsUpa2glJjLxi MR/hRbM6VNYYK/rLRwDVweGNKtZ6slHFOgE+Y65w3j6pdefR/E0MwUobJMo5htj8xZLL gGtqqJQOcaXa1oA/tx0lj3aRa+54rs0RWcOokN+xXcu4t4HtMn/xJxX/SES8dHxCc0jZ KRe6GsT94PPXi6HXG+RbEMEl2vBGsavsofAZnUY+jTCJWIrv+KsMIrJb3MwM9+Mghjsq 9if0Nub/thhFQNnDpnFRd09B58LXPHIflORpQ9Gguf08j/EbK0Ebtp34IF51CiexO2qN Ok2w== X-Gm-Message-State: ALoCoQmaf4EmJdKHYKeHt/sSTssqolcs2bFqdMSxJ2ErzuDozyG5oln7iYjwmcmvmU8staIVW6Pe X-Received: by 10.194.90.228 with SMTP id bz4mr23305117wjb.65.1406304522749; Fri, 25 Jul 2014 09:08:42 -0700 (PDT) Received: from pistachio.icx.intel.com ([83.217.123.106]) by mx.google.com with ESMTPSA id df1sm7542656wib.4.2014.07.25.09.08.40 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 25 Jul 2014 09:08:41 -0700 (PDT) From: Thomas Wood To: intel-gfx@lists.freedesktop.org Date: Fri, 25 Jul 2014 17:08:39 +0100 Message-Id: <1406304519-7100-1-git-send-email-thomas.wood@intel.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <8FCC70911F3E9548866CA0E51893BCC31A1DAE1E@IRSMSX105.ger.corp.intel.com> References: <8FCC70911F3E9548866CA0E51893BCC31A1DAE1E@IRSMSX105.ger.corp.intel.com> Subject: [Intel-gfx] [PATCH i-g-t] lib: avoid getopt value conflicts with tests X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.15 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, 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 Most tests use a printable character as the value for getopt to return, so avoid conflicts by using non-printing values for the standard options. Signed-off-by: Thomas Wood --- lib/igt_core.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/lib/igt_core.c b/lib/igt_core.c index a0c9499..882614a 100644 --- a/lib/igt_core.c +++ b/lib/igt_core.c @@ -218,6 +218,13 @@ int num_test_children; int test_children_sz; bool test_child; +enum { + OPT_LIST_SUBTESTS, + OPT_RUN_SUBTEST, + OPT_DEBUG, + OPT_HELP +}; + __attribute__((format(printf, 1, 2))) static void kmsg(const char *format, ...) #define KERN_INFO "<5>" @@ -320,10 +327,10 @@ static int common_init(int argc, char **argv, { int c, option_index = 0; static struct option long_options[] = { - {"list-subtests", 0, 0, 'l'}, - {"run-subtest", 1, 0, 'r'}, - {"debug", 0, 0, 'd'}, - {"help", 0, 0, 'h'}, + {"list-subtests", 0, 0, OPT_LIST_SUBTESTS}, + {"run-subtest", 1, 0, OPT_RUN_SUBTEST}, + {"debug", 0, 0, OPT_DEBUG}, + {"help", 0, 0, OPT_HELP}, }; char *short_opts; struct option *combined_opts; @@ -370,18 +377,18 @@ static int common_init(int argc, char **argv, while ((c = getopt_long(argc, argv, short_opts, combined_opts, &option_index)) != -1) { switch(c) { - case 'd': + case OPT_DEBUG: igt_log_level = IGT_LOG_DEBUG; break; - case 'l': + case OPT_LIST_SUBTESTS: if (!run_single_subtest) list_subtests = true; break; - case 'r': + case OPT_RUN_SUBTEST: if (!list_subtests) run_single_subtest = strdup(optarg); break; - case 'h': + case OPT_HELP: print_usage(help_str, false); ret = -1; goto out;