From: Laurent Vivier Subject: Re: [PATCH kvm-unit-tests v2 6/9] errata: add ERRATA_FORCE Date: Thu, 8 Jun 2017 12:56:51 +0200 Message-ID: References: <20170606182249.19313-1-drjones@redhat.com> <20170606182249.19313-7-drjones@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Cc: pbonzini@redhat.com, rkrcmar@redhat.com, thuth@redhat.com To: Andrew Jones , kvm@vger.kernel.org Return-path: Received: from mx1.redhat.com ([209.132.183.28]:37254 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751132AbdFHK44 (ORCPT ); Thu, 8 Jun 2017 06:56:56 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 878A680C18 for ; Thu, 8 Jun 2017 10:56:55 +0000 (UTC) In-Reply-To: <20170606182249.19313-7-drjones@redhat.com> Content-Language: en-US Sender: kvm-owner@vger.kernel.org List-ID: On 06/06/2017 20:22, Andrew Jones wrote: > Provide an easy way for test runners to run all tests, even those > guarded by an erratum. Setting ERRATA_FORCE forces errata() and > errata_relaxed() to always return true. ./run_tests.sh -a is > also updated to set it. > > Signed-off-by: Andrew Jones Reviewed-by: Laurent Vivier > --- > lib/errata.h | 21 +++++++++++++++++++-- > run_tests.sh | 2 ++ > 2 files changed, 21 insertions(+), 2 deletions(-) > > diff --git a/lib/errata.h b/lib/errata.h > index 7b089c2578ad..f3ebca2d8a6c 100644 > --- a/lib/errata.h > +++ b/lib/errata.h > @@ -13,16 +13,33 @@ > #define _ERRATA_RELAXED(erratum) errata_relaxed("ERRATA_" # erratum) > #define ERRATA_RELAXED(erratum) _ERRATA_RELAXED(erratum) > > +static inline bool errata_force(void) > +{ > + char *s = getenv("ERRATA_FORCE"); > + > + return s && (*s == '1' || *s == 'y' || *s == 'Y'); > +} > + > static inline bool errata(const char *erratum) > { > - char *s = getenv(erratum); > + char *s; > + > + if (errata_force()) > + return true; > + > + s = getenv(erratum); > > return s && (*s == '1' || *s == 'y' || *s == 'Y'); > } > > static inline bool errata_relaxed(const char *erratum) > { > - char *s = getenv(erratum); > + char *s; > + > + if (errata_force()) > + return true; > + > + s = getenv(erratum); > > return !(s && (*s == '0' || *s == 'n' || *s == 'N')); > } > diff --git a/run_tests.sh b/run_tests.sh > index c7972cbd198b..aa2e65f622ce 100755 > --- a/run_tests.sh > +++ b/run_tests.sh > @@ -19,6 +19,7 @@ Usage: $0 [-h] [-v] [-a] [-g group] [-j NUM-TASKS] > -h: Output this help text > -v: Enables verbose mode > -a: Run all tests, including those flagged as 'nodefault' > + and those guarded by errata. > -g: Only execute tests in the given group > -j: Execute tests in parallel > > @@ -35,6 +36,7 @@ while getopts "ag:hj:v" opt; do > case $opt in > a) > run_all_tests="yes" > + export ERRATA_FORCE=y > ;; > g) > only_group=$OPTARG >