@@ -103,15 +103,13 @@ int main(int argc, char *argv[])
{
struct kvm_vcpu *vcpu;
struct kvm_vm *vm;
- int rc;
/* Tell stdout not to buffer its content */
setbuf(stdout, NULL);
- vm = vm_create_with_one_vcpu(&vcpu, guest_code);
+ TEST_REQUIRE(kvm_has_cap(KVM_CAP_EXIT_ON_EMULATION_FAILURE));
- rc = kvm_check_cap(KVM_CAP_EXIT_ON_EMULATION_FAILURE);
- TEST_ASSERT(rc, "KVM_CAP_EXIT_ON_EMULATION_FAILURE is unavailable");
+ vm = vm_create_with_one_vcpu(&vcpu, guest_code);
vm_enable_cap(vm, KVM_CAP_EXIT_ON_EMULATION_FAILURE, 1);
/*
Skip emulator_error_test if KVM_CAP_EXIT_ON_EMULATION_FAILURE is not available rather than failing. This makes emulator_error_test skip on older kernels and also deletes a net 2 lines of code from the test. Signed-off-by: David Matlack <dmatlack@google.com> --- tools/testing/selftests/kvm/x86_64/emulator_error_test.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)