From: Andrew Jones <drjones@redhat.com>
To: kvm@vger.kernel.org
Cc: rkrcmar@redhat.com, pbonzini@redhat.com, lvivier@redhat.com,
thuth@redhat.com
Subject: [PATCH kvm-unit-tests v3 2/9] arch-run: provide errata from run env
Date: Tue, 13 Jun 2017 13:54:44 +0200 [thread overview]
Message-ID: <20170613115451.6240-3-drjones@redhat.com> (raw)
In-Reply-To: <20170613115451.6240-1-drjones@redhat.com>
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 <drjones@redhat.com>
Reviewed-by: Laurent Vivier <lvivier@redhat.com>
---
scripts/arch-run.bash | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/scripts/arch-run.bash b/scripts/arch-run.bash
index 9efa76d6ae33..135342ef48f2 100644
--- a/scripts/arch-run.bash
+++ b/scripts/arch-run.bash
@@ -158,6 +158,34 @@ search_qemu_binary ()
initrd_create ()
{
+ env_add_errata
unset INITRD
[ -f "$ENV" ] && 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=${line%%=*}
+ test -v $errata && continue
+ eval export "$line"
+ done
+ fi
+
+ if grep -q '^ERRATA_' <(env); then
+ export ENV_OLD="$ENV"
+ export ENV=$(mktemp)
+ trap_exit_push 'rm -f $ENV; [ "$ENV_OLD" ] && export ENV="$ENV_OLD" || unset ENV; unset ENV_OLD'
+ [ -f "$ENV_OLD" ] && grep -v '^ERRATA_' "$ENV_OLD" > $ENV
+ grep '^ERRATA_' <(env) >> $ENV
+ fi
+}
+
+trap_exit_push ()
+{
+ local old_exit=$(trap -p EXIT | sed "s/^[^']*'//;s/'[^']*$//")
+ trap -- "$1; $old_exit" EXIT
+}
--
2.9.4
next prev parent reply other threads:[~2017-06-13 11:54 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-13 11:54 [PATCH kvm-unit-tests v3 0/9] Extend and apply the errata framework Andrew Jones
2017-06-13 11:54 ` [PATCH kvm-unit-tests v3 1/9] arch-run: introduce initrd_create Andrew Jones
2017-06-13 12:09 ` Laurent Vivier
2017-06-13 11:54 ` Andrew Jones [this message]
2017-06-13 11:54 ` [PATCH kvm-unit-tests v3 3/9] x86/run: source config.mak Andrew Jones
2017-06-13 11:54 ` [PATCH kvm-unit-tests v3 4/9] arch-run: generate errata when no environ is provided Andrew Jones
2017-06-13 11:54 ` [PATCH kvm-unit-tests v3 5/9] mkstandalone: provide errata to tests Andrew Jones
2017-06-13 12:15 ` Laurent Vivier
2017-06-13 11:54 ` [PATCH kvm-unit-tests v3 6/9] errata: add ERRATA_FORCE Andrew Jones
2017-06-13 11:54 ` [PATCH kvm-unit-tests v3 7/9] README: add section on guarding unsafe tests Andrew Jones
2017-06-13 12:15 ` Laurent Vivier
2017-06-13 11:54 ` [PATCH kvm-unit-tests v3 8/9] AArch32: apply errata framework to unsafe pmccntr64 test Andrew Jones
2017-06-13 11:54 ` [PATCH kvm-unit-tests v3 9/9] arm/arm64: apply errata framework to unsafe cpu-on test Andrew Jones
2017-06-14 18:58 ` [PATCH kvm-unit-tests v3 0/9] Extend and apply the errata framework Radim Krčmář
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170613115451.6240-3-drjones@redhat.com \
--to=drjones@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=lvivier@redhat.com \
--cc=pbonzini@redhat.com \
--cc=rkrcmar@redhat.com \
--cc=thuth@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox