Re: [kvm-unit-tests PATCH v1 5/7] x86 UEFI: Exit QEMU with return code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 31/10/21 06:56, Zixuan Wang wrote:
From: Zixuan Wang <zxwang42@xxxxxxxxx>

kvm-unit-tests runner scripts parse QEMU exit code to determine if a
test case runs successfully. But the UEFI 'reset_system' function always
exits QEMU with code 0, even if the test case returns a non-zero code.

This commit fixes this issue by replacing the 'reset_system' call with
an 'exit' call, which ensures QEMU exit with the correct code.

Signed-off-by: Zixuan Wang <zxwang42@xxxxxxxxx>
---
  lib/efi.c | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/efi.c b/lib/efi.c
index 99eb00c..cc0386c 100644
--- a/lib/efi.c
+++ b/lib/efi.c
@@ -87,7 +87,7 @@ efi_status_t efi_get_system_config_table(efi_guid_t table_guid, void **table)
efi_status_t efi_main(efi_handle_t handle, efi_system_table_t *sys_tab)
  {
-	int ret;
+	unsigned long ret;

Why this change?

  	efi_status_t status;
  	efi_bootinfo_t efi_bootinfo;
@@ -134,14 +134,14 @@ efi_status_t efi_main(efi_handle_t handle, efi_system_table_t *sys_tab)
  	ret = main(__argc, __argv, __environ);
/* Shutdown the guest VM */
-	efi_rs_call(reset_system, EFI_RESET_SHUTDOWN, ret, 0, NULL);
+	exit(ret);
/* Unreachable */
  	return EFI_UNSUPPORTED;
efi_main_error:
  	/* Shutdown the guest with error EFI status */
-	efi_rs_call(reset_system, EFI_RESET_SHUTDOWN, status, 0, NULL);
+	exit(status);
/* Unreachable */
  	return EFI_UNSUPPORTED;

It's better to keep the exit() *and* the efi_rs_call(), I think, in case the testdev is missing and therefore the exit() does not work.

Paolo




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux