[kvm-unit-tests v3 PATCH 1/3] vmx: Cleanup test_vmx_vmlaunch to generate clearer and more consolidated test reports

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

 



In cases when xerror is 0 ( the test is not expected to error ) and
the test does error we get a confusing test result as the vmlaunch status
is based on !xerror:

FAIL: Enable-EPT enabled; EPT page walk length 24: vmlaunch succeeds

This patch also eliminates the double call to report per launch and
clarifies the failure messages. New format suggested by seanjc@xxxxxxxxxx

Signed-off-by: Cathy Avery <cavery@xxxxxxxxxx>
---
 x86/vmx_tests.c | 21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)

diff --git a/x86/vmx_tests.c b/x86/vmx_tests.c
index 3d57ed6..0dab98e 100644
--- a/x86/vmx_tests.c
+++ b/x86/vmx_tests.c
@@ -3392,14 +3392,21 @@ static void test_vmx_vmlaunch(u32 xerror)
 	bool success = vmlaunch_succeeds();
 	u32 vmx_inst_err;
 
-	report(success == !xerror, "vmlaunch %s",
-	       !xerror ? "succeeds" : "fails");
-	if (!success && xerror) {
-		vmx_inst_err = vmcs_read(VMX_INST_ERROR);
+	if (!success)
+	vmx_inst_err = vmcs_read(VMX_INST_ERROR);
+
+	if (success && !xerror)
+		report_pass("VMLAUNCH succeeded as expected");
+	else if (success && xerror)
+		report_fail("VMLAUNCH succeeded unexpectedly, wanted VM-Fail with error code = %d",
+			    xerror);
+	else if (!success && !xerror)
+		report_fail("VMLAUNCH hit unexpected VM-Fail with error code = %d",
+			    vmx_inst_err);
+	else
 		report(vmx_inst_err == xerror,
-		       "VMX inst error is %d (actual %d)", xerror,
-		       vmx_inst_err);
-	}
+		       "VMLAUNCH hit VM-Fail as expected, wanted error code %d, got %d",
+		       xerror, vmx_inst_err);
 }
 
 /*
-- 
2.31.1




[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