From mboxrd@z Thu Jan 1 00:00:00 1970 From: Damien Lespiau Subject: [PATCH 1/4] lib: Factor out a function to check if an environment variable is set Date: Wed, 20 Feb 2013 14:53:13 +0000 Message-ID: <1361371996-28166-1-git-send-email-damien.lespiau@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: 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) List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org To: intel-gfx@lists.freedesktop.org List-Id: intel-gfx@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; } -- 1.7.7.5