From: Laurent Vivier Subject: Re: [PATCH kvm-unit-tests 2/8] arch-run: provide errata from run env Date: Mon, 29 May 2017 16:36:00 +0200 Message-ID: References: <20170524160818.4326-1-drjones@redhat.com> <20170524160818.4326-3-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]:34476 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750987AbdE2OgF (ORCPT ); Mon, 29 May 2017 10:36:05 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 87B724E4D0 for ; Mon, 29 May 2017 14:36:04 +0000 (UTC) In-Reply-To: <20170524160818.4326-3-drjones@redhat.com> Content-Language: en-US Sender: kvm-owner@vger.kernel.org List-ID: On 24/05/2017 18:08, Andrew Jones wrote: > Allow the run script environment to provide ERRATA_* variables > to the unit tests. These variables will augment/override variables > in any provided unit test environ (the file specified with $ENV) > or trigger the creation of a temporary environ file, which contains > them. > > Now something like > > ERRATA_abcd01234567=y ./run_tests.sh > > may be run in order to inform all unit tests that they may execute > all subtests guarded by ERRATA_abcd01234567. > > Signed-off-by: Andrew Jones > --- > scripts/arch-run.bash | 28 ++++++++++++++++++++++++++++ > 1 file changed, 28 insertions(+) > > diff --git a/scripts/arch-run.bash b/scripts/arch-run.bash > index 581552a21f2e..3ba6354608da 100644 > --- a/scripts/arch-run.bash > +++ b/scripts/arch-run.bash > @@ -158,5 +158,33 @@ search_qemu_binary () > > initrd_create () > { > + env_add_errata > [ -f "$ENV" ] && export INITRD="-initrd $ENV" > } > + > +env_add_errata () > +{ > + local line errata > + > + if [ -f "$ENV" ] && grep -q '^ERRATA_' <(env); then > + for line in $(grep '^ERRATA_' "$ENV"); do > + errata=$(echo "$line" | cut -d= -f1) > + grep -q $errata <(env) && continue > + eval export "$line" > + done > + fi If you want fun, you can get this with: [ -f "$ENV" ] && for errata in \ $(grep -vF "$(tr ' ' '\n' <<<${!ERRATA_@})" "$ENV"); do eval export $errata done Laurent