All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Radim Krčmář" <rkrcmar@redhat.com>
To: kvm@vger.kernel.org
Cc: Paolo Bonzini <pbonzini@redhat.com>
Subject: [kvm-unit-tests PATCH 2/2] x86/vmx: report failure if tests don't progress as expected
Date: Mon,  3 Jul 2017 19:58:53 +0200	[thread overview]
Message-ID: <20170703175853.1939-3-rkrcmar@redhat.com> (raw)
In-Reply-To: <20170703175853.1939-1-rkrcmar@redhat.com>

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

Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
---
 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

      parent reply	other threads:[~2017-07-03 17:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-03 17:58 [kvm-unit-tests PATCH 0/2] x86/vmx: fix PML test Radim Krčmář
2017-07-03 17:58 ` [kvm-unit-tests PATCH 1/2] x86/vmx: fix unexpected stage error in " Radim Krčmář
2017-07-03 17:58 ` Radim Krčmář [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170703175853.1939-3-rkrcmar@redhat.com \
    --to=rkrcmar@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.