From patchwork Wed Jul 23 10:57:51 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Wood X-Patchwork-Id: 4609891 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 11BC3C0515 for ; Wed, 23 Jul 2014 10:58:14 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 54AD2201DC for ; Wed, 23 Jul 2014 10:58:10 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 301DF200EC for ; Wed, 23 Jul 2014 10:58:07 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id DEDC26E620; Wed, 23 Jul 2014 03:58:06 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-wg0-f45.google.com (mail-wg0-f45.google.com [74.125.82.45]) by gabe.freedesktop.org (Postfix) with ESMTP id 6ABCA6E625 for ; Wed, 23 Jul 2014 03:58:05 -0700 (PDT) Received: by mail-wg0-f45.google.com with SMTP id x12so970367wgg.28 for ; Wed, 23 Jul 2014 03:58:04 -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:cc:subject:date:message-id:in-reply-to :references; bh=L+4Pw01D+RF90sKUKUdlOmuQxUt974VpOe4vdMIg0eE=; b=OjS0/o8m7q56a/Wk9yNnHkYbNPVGZQwAe4PeT+GhUc3pahxNtxID9UFNWaxEYV/HiB gZBwDy8puVjnPntrV5rIN2a03+16F4H++KzsPzmQaSi1yc0QzKhucYRON+zVFfLima/3 AAbX73vZ9vZ5KypN2SxMMj7E7uyOzGbCwksjS9m0JFvjz9qTSxcRWa9+Z9rq9ocdVk6B qEW1MEp4lTzATLfG4zD8IyvpxmsNz0maT6UqtofTbK3Ga2AhGDV020x7s1aWgzRK0v3a 3Ij3+9qH7nfaUPJsZKs/6QN73+PJIrDuCtd13SkPrW87g8W+umBgXeD+zwFi6SKONZGT KlIg== X-Gm-Message-State: ALoCoQmHZKJINNGM59qixs2U4gXYvW/PDtceHXrhJJsGIBue+h67yBv40fg1WuGb+hKoG45iN7Tl X-Received: by 10.194.175.41 with SMTP id bx9mr415753wjc.123.1406113083741; Wed, 23 Jul 2014 03:58:03 -0700 (PDT) Received: from pistachio.icx.intel.com ([83.217.123.106]) by mx.google.com with ESMTPSA id de5sm7787760wib.18.2014.07.23.03.58.02 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 23 Jul 2014 03:58:02 -0700 (PDT) From: Thomas Wood To: intel-gfx@lists.freedesktop.org Date: Wed, 23 Jul 2014 11:57:51 +0100 Message-Id: <1406113075-30860-5-git-send-email-thomas.wood@intel.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1406113075-30860-1-git-send-email-thomas.wood@intel.com> References: <1406113075-30860-1-git-send-email-thomas.wood@intel.com> Cc: daniel.vetter@ffwll.ch Subject: [Intel-gfx] [PATCH i-g-t 4/8] lib: add igt_simple_init_parse_opts 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 This function allows simple tests to register additional command line options. Signed-off-by: Thomas Wood Reviewed-by: Tim Gore --- lib/igt_core.c | 22 ++++++++++++++++++++++ lib/igt_core.h | 5 +++++ 2 files changed, 27 insertions(+) diff --git a/lib/igt_core.c b/lib/igt_core.c index ee6f90c..72c77e6 100644 --- a/lib/igt_core.c +++ b/lib/igt_core.c @@ -500,6 +500,28 @@ void igt_simple_init(int argc, char **argv) optind = 1; } +/** + * igt_simple_init_parse_opts: + * @argc: argc from the test's main() + * @argv: argv from the test's main() + * @extra_short_opts: getopt_long() compliant list with additional short options + * @extra_long_opts: getopt_long() compliant list with additional long options + * @help_str: help string for the additional options + * @extra_opt_handler: handler for the additional options + * + * This initializes a simple test without any support for subtests and allows + * an arbitrary set of additional options. + */ +void igt_simple_init_parse_opts(int argc, char **argv, + const char *extra_short_opts, + struct option *extra_long_opts, + const char *help_str, + igt_opt_handler_t extra_opt_handler) +{ + common_init(argc, argv, extra_short_opts, extra_long_opts, help_str, + extra_opt_handler); +} + /* * Note: Testcases which use these helpers MUST NOT output anything to stdout * outside of places protected by igt_run_subtest checks - the piglit diff --git a/lib/igt_core.h b/lib/igt_core.h index 6138487..408cf3a 100644 --- a/lib/igt_core.h +++ b/lib/igt_core.h @@ -162,6 +162,11 @@ bool igt_only_list_subtests(void); static void igt_tokencat(__real_main, __LINE__)(void) \ void igt_simple_init(int argc, char **argv); +void igt_simple_init_parse_opts(int argc, char **argv, + const char *extra_short_opts, + struct option *extra_long_opts, + const char *help_str, + igt_opt_handler_t extra_opt_handler); /** * igt_simple_main: