From patchwork Wed Feb 20 14:53:13 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lespiau, Damien" X-Patchwork-Id: 2167651 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork1.kernel.org (Postfix) with ESMTP id 31A593FDF1 for ; Wed, 20 Feb 2013 14:56:30 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id F2B1EE6797 for ; Wed, 20 Feb 2013 06:56:29 -0800 (PST) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by gabe.freedesktop.org (Postfix) with ESMTP id EE303E67B3 for ; Wed, 20 Feb 2013 06:53:20 -0800 (PST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP; 20 Feb 2013 06:53:17 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.84,702,1355126400"; d="scan'208";a="265103773" Received: from unknown (HELO dyon.amr.corp.intel.com) ([10.255.12.143]) by orsmga001.jf.intel.com with ESMTP; 20 Feb 2013 06:53:16 -0800 From: Damien Lespiau To: intel-gfx@lists.freedesktop.org Date: Wed, 20 Feb 2013 14:53:13 +0000 Message-Id: <1361371996-28166-1-git-send-email-damien.lespiau@intel.com> X-Mailer: git-send-email 1.7.7.5 Subject: [Intel-gfx] [PATCH 1/4] lib: Factor out a function to check if an environment variable is set X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org Signed-off-by: Damien Lespiau --- lib/drmtest.c | 24 +++++++++++++----------- 1 files changed, 13 insertions(+), 11 deletions(-) diff --git a/lib/drmtest.c b/lib/drmtest.c index 117fb31..641028c 100644 --- a/lib/drmtest.c +++ b/lib/drmtest.c @@ -574,22 +574,24 @@ bool drmtest_only_list_subtests(void) return list_subtests; } +static bool env_set(const char *env_var) +{ + char *val; + + val = getenv(env_var); + if (!val) + return false; + + return atoi(val) != 0; +} + bool drmtest_run_quick(void) { static int run_quick = -1; - if (run_quick == -1) { - char *igt_quick; + if (run_quick == -1) + run_quick = env_set("IGT_QUICK"); - igt_quick = getenv("IGT_QUICK"); - if (!igt_quick) { - run_quick = 0; - goto out; - } - - run_quick = atoi(igt_quick); - } -out: return run_quick; }