From: Zixuan Wang <zxwang42@gmail.com>
To: kvm@vger.kernel.org, pbonzini@redhat.com, drjones@redhat.com
Cc: marcorr@google.com, erdemaktas@google.com, rientjes@google.com,
seanjc@google.com, brijesh.singh@amd.com,
Thomas.Lendacky@amd.com, varad.gautam@suse.com, jroedel@suse.de,
bp@suse.de
Subject: [kvm-unit-tests PATCH v1 6/7] scripts: Generalize EFI check
Date: Sat, 30 Oct 2021 22:56:33 -0700 [thread overview]
Message-ID: <20211031055634.894263-7-zxwang42@gmail.com> (raw)
In-Reply-To: <20211031055634.894263-1-zxwang42@gmail.com>
From: Marc Orr <marcorr@google.com>
Previously, the scripts distinguish between seabios and UEFI via a
hard-coded env var in the EFI run script, `arch/x86/efi/run`.
Furthermore, this var is passed to the x86 run script, `arch/x86/run`,
and then not available in other scripts (or to other architectures).
Replace the previous approach with a common helper function to check
whether the repo has been configured to run under EFI. The helper does
this by probing the `config.mak` file generated by `configure`.
Signed-off-by: Marc Orr <marcorr@google.com>
---
scripts/common.bash | 5 +++++
x86/efi/run | 1 -
x86/run | 6 ++++--
3 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/scripts/common.bash b/scripts/common.bash
index 7b983f7..6f45843 100644
--- a/scripts/common.bash
+++ b/scripts/common.bash
@@ -1,5 +1,10 @@
source config.mak
+function running_under_efi()
+{
+ [[ ${TARGET_EFI} == "y" ]] && echo "y" || echo ""
+}
+
function for_each_unittest()
{
local unittests="$1"
diff --git a/x86/efi/run b/x86/efi/run
index 922b266..aacc691 100755
--- a/x86/efi/run
+++ b/x86/efi/run
@@ -52,7 +52,6 @@ popd || exit 2
# run in UEFI, some test cases, e.g. `x86/pmu.c`, require more free memory. A
# simple fix is to increase the QEMU default memory size to 256MiB so that
# UEFI's largest allocatable memory region is large enough.
-EFI_RUN=y \
"$TEST_DIR/run" \
-drive file="$EFI_UEFI",format=raw,if=pflash,readonly=on \
-drive file.dir="$EFI_TEST/$EFI_CASE/",file.driver=vvfat,file.rw=on,format=raw,if=virtio \
diff --git a/x86/run b/x86/run
index 4eba2b9..95b56b6 100755
--- a/x86/run
+++ b/x86/run
@@ -1,5 +1,7 @@
#!/usr/bin/env bash
+source scripts/common.bash
+
if [ -z "$STANDALONE" ]; then
if [ ! -f config.mak ]; then
echo "run ./configure && make first. See ./configure -h"
@@ -39,12 +41,12 @@ fi
command="${qemu} --no-reboot -nodefaults $pc_testdev -vnc none -serial stdio $pci_testdev"
command+=" -machine accel=$ACCEL"
-if ! [ "$EFI_RUN" ]; then
+if ! [ "$(running_under_efi)" ]; then
command+=" -kernel"
fi
command="$(timeout_cmd) $command"
-if [ "$EFI_RUN" ]; then
+if [ "$(running_under_efi)" ]; then
# Set ENVIRON_DEFAULT=n to remove '-initrd' flag for QEMU (see
# 'scripts/arch-run.bash' for more details). This is because when using
# UEFI, the test case binaries are passed to QEMU through the disk
--
2.33.0
next prev parent reply other threads:[~2021-10-31 5:56 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-31 5:56 [kvm-unit-tests PATCH v1 0/7] x86_64 UEFI set up process refactor and scripts fixes Zixuan Wang
2021-10-31 5:56 ` [kvm-unit-tests PATCH v1 1/7] x86 UEFI: Remove mixed_mode Zixuan Wang
2021-10-31 5:56 ` [kvm-unit-tests PATCH v1 2/7] x86 UEFI: Refactor set up process Zixuan Wang
2021-11-05 18:54 ` Sean Christopherson
2021-11-09 17:16 ` Zixuan Wang
2021-10-31 5:56 ` [kvm-unit-tests PATCH v1 3/7] x86 UEFI: Convert x86 test cases to PIC Zixuan Wang
2021-10-31 5:56 ` [kvm-unit-tests PATCH v1 4/7] x86 UEFI: Set UEFI OVMF as readonly Zixuan Wang
2021-10-31 5:56 ` [kvm-unit-tests PATCH v1 5/7] x86 UEFI: Exit QEMU with return code Zixuan Wang
2021-10-31 10:01 ` Paolo Bonzini
2021-10-31 21:36 ` Zixuan Wang
2021-10-31 5:56 ` Zixuan Wang [this message]
2021-10-31 7:13 ` [kvm-unit-tests PATCH v1 6/7] scripts: Generalize EFI check Paolo Bonzini
2021-10-31 15:35 ` Marc Orr
2021-10-31 5:56 ` [kvm-unit-tests PATCH v1 7/7] x86 UEFI: Make run_tests.sh (mostly) work under UEFI Zixuan Wang
2021-10-31 7:28 ` [kvm-unit-tests PATCH v1 0/7] x86_64 UEFI set up process refactor and scripts fixes Paolo Bonzini
2021-10-31 16:14 ` Marc Orr
2021-10-31 21:54 ` Zixuan Wang
2021-11-01 7:11 ` Andrew Jones
2021-11-01 22:35 ` Zixuan Wang
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=20211031055634.894263-7-zxwang42@gmail.com \
--to=zxwang42@gmail.com \
--cc=Thomas.Lendacky@amd.com \
--cc=bp@suse.de \
--cc=brijesh.singh@amd.com \
--cc=drjones@redhat.com \
--cc=erdemaktas@google.com \
--cc=jroedel@suse.de \
--cc=kvm@vger.kernel.org \
--cc=marcorr@google.com \
--cc=pbonzini@redhat.com \
--cc=rientjes@google.com \
--cc=seanjc@google.com \
--cc=varad.gautam@suse.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;
as well as URLs for NNTP newsgroup(s).