[kvm-unit-tests PATCH 5/6] x86: nSVM: Replace check_dbgctl() with TEST_EXPECT_EQ() in LBRV test

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

 



Use TEST_EXPECT_EQ() to check the expected vs. actual DEBUGCTL instead
of using a one-off implementation that doesn't even print the expected
value.

Signed-off-by: Sean Christopherson <seanjc@xxxxxxxxxx>
---
 x86/svm_tests.c | 21 ++++++---------------
 1 file changed, 6 insertions(+), 15 deletions(-)

diff --git a/x86/svm_tests.c b/x86/svm_tests.c
index 9a89155a..de2cedc8 100644
--- a/x86/svm_tests.c
+++ b/x86/svm_tests.c
@@ -2791,15 +2791,6 @@ do {										\
 		asm volatile("ud2");						\
 } while (0)
 
-static bool check_dbgctl(u64 dbgctl, u64 dbgctl_expected)
-{
-	if (dbgctl != dbgctl_expected) {
-		report(false, "Unexpected MSR_IA32_DEBUGCTLMSR value 0x%lx", dbgctl);
-		return false;
-	}
-	return true;
-}
-
 #define DO_BRANCH(branch_name)				\
 	asm volatile (					\
 		      # branch_name "_from:"		\
@@ -2877,9 +2868,9 @@ static void svm_lbrv_test0(void)
 	dbgctl = rdmsr(MSR_IA32_DEBUGCTLMSR);
 	wrmsr(MSR_IA32_DEBUGCTLMSR, 0);
 
-	check_dbgctl(dbgctl, DEBUGCTLMSR_LBR);
+	TEST_EXPECT_EQ(dbgctl, DEBUGCTLMSR_LBR);
 	dbgctl = rdmsr(MSR_IA32_DEBUGCTLMSR);
-	check_dbgctl(dbgctl, 0);
+	TEST_EXPECT_EQ(dbgctl, 0);
 
 	HOST_CHECK_LBR(&host_branch0_from, &host_branch0_to);
 }
@@ -2902,7 +2893,7 @@ static void svm_lbrv_test1(void)
 		return;
 	}
 
-	check_dbgctl(dbgctl, 0);
+	TEST_EXPECT_EQ(dbgctl, 0);
 	HOST_CHECK_LBR(&guest_branch0_from, &guest_branch0_to);
 }
 
@@ -2926,7 +2917,7 @@ static void svm_lbrv_test2(void)
 		return;
 	}
 
-	check_dbgctl(dbgctl, 0);
+	TEST_EXPECT_EQ(dbgctl, 0);
 	HOST_CHECK_LBR(&guest_branch2_from, &guest_branch2_to);
 }
 
@@ -2959,7 +2950,7 @@ static void svm_lbrv_nested_test1(void)
 		return;
 	}
 
-	check_dbgctl(dbgctl, DEBUGCTLMSR_LBR);
+	TEST_EXPECT_EQ(dbgctl, DEBUGCTLMSR_LBR);
 	HOST_CHECK_LBR(&host_branch3_from, &host_branch3_to);
 }
 
@@ -2990,7 +2981,7 @@ static void svm_lbrv_nested_test2(void)
 		return;
 	}
 
-	check_dbgctl(dbgctl, DEBUGCTLMSR_LBR);
+	TEST_EXPECT_EQ(dbgctl, DEBUGCTLMSR_LBR);
 	HOST_CHECK_LBR(&host_branch4_from, &host_branch4_to);
 }
 
-- 
2.41.0.162.gfafddb0af9-goog




[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