aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/kvm/aarch64/psci_test.c
diff options
context:
space:
mode:
authorSean Christopherson <seanjc@google.com>2022-05-27 16:24:02 -0700
committerPaolo Bonzini <pbonzini@redhat.com>2022-06-11 11:47:29 -0400
commit7ed397d107d461a53e350e5025d68ec3c4a8934d (patch)
treead575aa65d292978ad352451b1e5ad8662ff07ce /tools/testing/selftests/kvm/aarch64/psci_test.c
parentKVM: selftests: Add kvm_has_cap() to provide syntactic sugar (diff)
downloadlinux-dev-7ed397d107d461a53e350e5025d68ec3c4a8934d.tar.xz
linux-dev-7ed397d107d461a53e350e5025d68ec3c4a8934d.zip
KVM: selftests: Add TEST_REQUIRE macros to reduce skipping copy+paste
Add TEST_REQUIRE() and __TEST_REQUIRE() to replace the myriad open coded instances of selftests exiting with KSFT_SKIP after printing an informational message. In addition to reducing the amount of boilerplate code in selftests, the UPPERCASE macro names make it easier to visually identify a test's requirements. Convert usage that erroneously uses something other than print_skip() and/or "exits" with '0' or some other non-KSFT_SKIP value. Intentionally drop a kvm_vm_free() in aarch64/debug-exceptions.c as part of the conversion. All memory and file descriptors are freed on process exit, so the explicit free is superfluous. Signed-off-by: Sean Christopherson <seanjc@google.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'tools/testing/selftests/kvm/aarch64/psci_test.c')
-rw-r--r--tools/testing/selftests/kvm/aarch64/psci_test.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/tools/testing/selftests/kvm/aarch64/psci_test.c b/tools/testing/selftests/kvm/aarch64/psci_test.c
index 7928c62635fd..a889e1cf5e4d 100644
--- a/tools/testing/selftests/kvm/aarch64/psci_test.c
+++ b/tools/testing/selftests/kvm/aarch64/psci_test.c
@@ -192,10 +192,7 @@ static void host_test_system_suspend(void)
int main(void)
{
- if (!kvm_check_cap(KVM_CAP_ARM_SYSTEM_SUSPEND)) {
- print_skip("KVM_CAP_ARM_SYSTEM_SUSPEND not supported");
- exit(KSFT_SKIP);
- }
+ TEST_REQUIRE(kvm_check_cap(KVM_CAP_ARM_SYSTEM_SUSPEND));
host_test_cpu_on();
host_test_system_suspend();