KVM: selftests: Use consistent message for test skipping

Signed-off-by: Andrew Jones <drjones@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
Andrew Jones
2020-03-10 10:15:56 +01:00
committed by Paolo Bonzini
parent d9eaf19ecc
commit d0aac3320d
18 changed files with 37 additions and 25 deletions

View File

@@ -82,8 +82,10 @@ test_assert(bool exp, const char *exp_str,
}
va_end(ap);
if (errno == EACCES)
ksft_exit_skip("Access denied - Exiting.\n");
if (errno == EACCES) {
print_skip("Access denied - Exiting");
exit(KSFT_SKIP);
}
exit(254);
}

View File

@@ -92,7 +92,7 @@ static void vm_open(struct kvm_vm *vm, int perm)
exit(KSFT_SKIP);
if (!kvm_check_cap(KVM_CAP_IMMEDIATE_EXIT)) {
fprintf(stderr, "immediate_exit not available, skipping test\n");
print_skip("immediate_exit not available");
exit(KSFT_SKIP);
}

View File

@@ -7,6 +7,7 @@
#include <stdlib.h>
#include <ctype.h>
#include <limits.h>
#include <assert.h>
#include "test_util.h"
/*
@@ -69,3 +70,14 @@ struct timespec timespec_diff(struct timespec start, struct timespec end)
return temp;
}
void print_skip(const char *fmt, ...)
{
va_list ap;
assert(fmt);
va_start(ap, fmt);
vprintf(fmt, ap);
va_end(ap);
puts(", skipping test");
}

View File

@@ -154,7 +154,7 @@ void nested_svm_check_supported(void)
kvm_get_supported_cpuid_entry(0x80000001);
if (!(entry->ecx & CPUID_SVM)) {
fprintf(stderr, "nested SVM not enabled, skipping test\n");
print_skip("nested SVM not enabled");
exit(KSFT_SKIP);
}
}

View File

@@ -381,7 +381,7 @@ void nested_vmx_check_supported(void)
struct kvm_cpuid_entry2 *entry = kvm_get_supported_cpuid_entry(1);
if (!(entry->ecx & CPUID_VMX)) {
fprintf(stderr, "nested VMX not enabled, skipping test\n");
print_skip("nested VMX not enabled");
exit(KSFT_SKIP);
}
}