On Sun, Oct 31, 2021 at 12:13 AM Paolo Bonzini <pbonzini@xxxxxxxxxx> wrote: > > On 31/10/21 06:56, Zixuan Wang wrote: > > From: Marc Orr<marcorr@xxxxxxxxxx> > > > > 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`. > > It should be possible to just use > > [ "${TARGET_EFI}" == "y" ] > > as the test: > > 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..0a4dda9 100755 > --- a/x86/run > +++ b/x86/run > @@ -39,12 +39,12 @@ fi > > command="${qemu} --no-reboot -nodefaults $pc_testdev -vnc none -serial stdio $pci_testdev" > command+=" -machine accel=$ACCEL" > -if ! [ "$EFI_RUN" ]; then > +if [ ${TARGET_EFI} != "y" ]; then > command+=" -kernel" > fi > command="$(timeout_cmd) $command" > > -if [ "$EFI_RUN" ]; then > +if [ ${TARGET_EFI} = "y" ]; 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 > > Paolo > Agreed. That SGTM.