[kvm-unit-tests PATCH 2/2] x86/vmx: report failure if tests don't progress as expected

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

 



The test could have reported PASS even though it unexpectedly ended.
Make sure they FAIL.

Signed-off-by: Radim Krčmář <rkrcmar@xxxxxxxxxx>
---
 x86/vmx_tests.c | 40 ++++++++++++++++++++--------------------
 1 file changed, 20 insertions(+), 20 deletions(-)

diff --git a/x86/vmx_tests.c b/x86/vmx_tests.c
index 25e91aa81477..f353f234f39b 100644
--- a/x86/vmx_tests.c
+++ b/x86/vmx_tests.c
@@ -167,7 +167,7 @@ int preemption_timer_exit_handler()
 			       saved_rip == guest_rip);
 			break;
 		default:
-			printf("Invalid stage.\n");
+			report("Invalid stage.", false);
 			print_vmexit_info();
 			break;
 		}
@@ -208,14 +208,14 @@ int preemption_timer_exit_handler()
 			break;
 		default:
 			// Should not reach here
-			printf("ERROR : unexpected stage, %d\n",
+			report("unexpected stage, %d", false,
 			       vmx_get_test_stage());
 			print_vmexit_info();
 			return VMX_TEST_VMEXIT;
 		}
 		break;
 	default:
-		printf("Unknown exit reason, %ld\n", reason);
+		report("Unknown exit reason, %ld", false, reason);
 		print_vmexit_info();
 	}
 	vmcs_write(PIN_CONTROLS, vmcs_read(PIN_CONTROLS) & ~PIN_PREEMPT);
@@ -512,7 +512,7 @@ static int cr_shadowing_exit_handler()
 			break;
 		default:
 			// Should not reach here
-			printf("ERROR : unexpected stage, %d\n",
+			report("unexpected stage, %d", false,
 			       vmx_get_test_stage());
 			print_vmexit_info();
 			return VMX_TEST_VMEXIT;
@@ -551,7 +551,7 @@ static int cr_shadowing_exit_handler()
 			break;
 		default:
 			// Should not reach here
-			printf("ERROR : unexpected stage, %d\n",
+			report("unexpected stage, %d", false,
 			       vmx_get_test_stage());
 			print_vmexit_info();
 			return VMX_TEST_VMEXIT;
@@ -559,7 +559,7 @@ static int cr_shadowing_exit_handler()
 		vmcs_write(GUEST_RIP, guest_rip + insn_len);
 		return VMX_TEST_RESUME;
 	default:
-		printf("Unknown exit reason, %ld\n", reason);
+		report("Unknown exit reason, %ld", false, reason);
 		print_vmexit_info();
 	}
 	return VMX_TEST_VMEXIT;
@@ -690,7 +690,7 @@ static int iobmp_exit_handler()
 			break;
 		default:
 			// Should not reach here
-			printf("ERROR : unexpected stage, %d\n",
+			report("unexpected stage, %d", false,
 			       vmx_get_test_stage());
 			print_vmexit_info();
 			return VMX_TEST_VMEXIT;
@@ -711,7 +711,7 @@ static int iobmp_exit_handler()
 			break;
 		default:
 			// Should not reach here
-			printf("ERROR : unexpected stage, %d\n",
+			report("unexpected stage, %d", false,
 			       vmx_get_test_stage());
 			print_vmexit_info();
 			return VMX_TEST_VMEXIT;
@@ -1141,7 +1141,7 @@ static int pml_exit_handler(void)
 			clear_ept_ad(pml4, guest_cr3, (unsigned long)data_page2);
 			break;
 		default:
-			printf("ERROR - unexpected stage, %d.\n",
+			report("unexpected stage, %d.", false,
 			       vmx_get_test_stage());
 			print_vmexit_info();
 			return VMX_TEST_VMEXIT;
@@ -1153,7 +1153,7 @@ static int pml_exit_handler(void)
 		vmcs_write(GUEST_PML_INDEX, PML_INDEX - 1);
 		return VMX_TEST_RESUME;
 	default:
-		printf("Unknown exit reason, %ld\n", reason);
+		report("Unknown exit reason, %ld", false, reason);
 		print_vmexit_info();
 	}
 	return VMX_TEST_VMEXIT;
@@ -1234,7 +1234,7 @@ static int ept_exit_handler_common(bool have_ad)
 			break;
 		// Should not reach here
 		default:
-			printf("ERROR - unexpected stage, %d.\n",
+			report("ERROR - unexpected stage, %d.", false,
 			       vmx_get_test_stage());
 			print_vmexit_info();
 			return VMX_TEST_VMEXIT;
@@ -1253,7 +1253,7 @@ static int ept_exit_handler_common(bool have_ad)
 			break;
 		// Should not reach here
 		default:
-			printf("ERROR - unexpected stage, %d.\n",
+			report("ERROR - unexpected stage, %d.", false,
 			       vmx_get_test_stage());
 			print_vmexit_info();
 			return VMX_TEST_VMEXIT;
@@ -1286,14 +1286,14 @@ static int ept_exit_handler_common(bool have_ad)
 			break;
 		default:
 			// Should not reach here
-			printf("ERROR : unexpected stage, %d\n",
+			report("ERROR : unexpected stage, %d", false,
 			       vmx_get_test_stage());
 			print_vmexit_info();
 			return VMX_TEST_VMEXIT;
 		}
 		return VMX_TEST_RESUME;
 	default:
-		printf("Unknown exit reason, %ld\n", reason);
+		report("Unknown exit reason, %ld", false, reason);
 		print_vmexit_info();
 	}
 	return VMX_TEST_VMEXIT;
@@ -1445,7 +1445,7 @@ static int vpid_exit_handler()
 				vmx_inc_test_stage();
 			break;
 		default:
-			printf("ERROR: unexpected stage, %d\n",
+			report("ERROR: unexpected stage, %d", false,
 					vmx_get_test_stage());
 			print_vmexit_info();
 			return VMX_TEST_VMEXIT;
@@ -1453,7 +1453,7 @@ static int vpid_exit_handler()
 		vmcs_write(GUEST_RIP, guest_rip + insn_len);
 		return VMX_TEST_RESUME;
 	default:
-		printf("Unknown exit reason, %ld\n", reason);
+		report("Unknown exit reason, %ld", false, reason);
 		print_vmexit_info();
 	}
 	return VMX_TEST_VMEXIT;
@@ -1610,7 +1610,7 @@ static int interrupt_exit_handler(void)
 			vmcs_write(GUEST_ACTV_STATE, ACTV_ACTIVE);
 		return VMX_TEST_RESUME;
 	default:
-		printf("Unknown exit reason, %ld\n", reason);
+		report("Unknown exit reason, %ld", false, reason);
 		print_vmexit_info();
 	}
 
@@ -1723,7 +1723,7 @@ static int dbgctls_exit_handler(void)
 		vmcs_write(GUEST_RIP, guest_rip + insn_len);
 		return VMX_TEST_RESUME;
 	default:
-		printf("Unknown exit reason, %d\n", reason);
+		report("Unknown exit reason, %d", false, reason);
 		print_vmexit_info();
 	}
 	return VMX_TEST_VMEXIT;
@@ -1845,7 +1845,7 @@ static int vmmcall_exit_handler()
 		       (vmcs_read(EXI_INTR_INFO) & 0xff) == UD_VECTOR);
 		break;
 	default:
-		printf("Unknown exit reason, %ld\n", reason);
+		report("Unknown exit reason, %ld", false, reason);
 		print_vmexit_info();
 	}
 
@@ -1917,7 +1917,7 @@ static int disable_rdtscp_exit_handler(void)
 		break;
 
 	default:
-		printf("Unknown exit reason, %d\n", reason);
+		report("Unknown exit reason, %d", false, reason);
 		print_vmexit_info();
 	}
 	return VMX_TEST_VMEXIT;
-- 
2.13.2




[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