test_serror() never looks at the vCPU after the SError is delivered, so a stale pending SError goes unnoticed. Read the vCPU events back and check the SError is no longer pending.
Signed-off-by: Fuad Tabba <[email protected]> --- tools/testing/selftests/kvm/arm64/external_aborts.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tools/testing/selftests/kvm/arm64/external_aborts.c b/tools/testing/selftests/kvm/arm64/external_aborts.c index d8fe17a6cc592..b276a4998a92c 100644 --- a/tools/testing/selftests/kvm/arm64/external_aborts.c +++ b/tools/testing/selftests/kvm/arm64/external_aborts.c @@ -239,6 +239,7 @@ static void test_serror_guest(void) static void test_serror(void) { + struct kvm_vcpu_events events; struct kvm_vcpu *vcpu; struct kvm_vm *vm = vm_create_with_dabt_handler(&vcpu, test_serror_guest, unexpected_dabt_handler); @@ -247,6 +248,11 @@ static void test_serror(void) vcpu_inject_serror(vcpu); vcpu_run_expect_done(vcpu); + + vcpu_events_get(vcpu, &events); + TEST_ASSERT(!events.exception.serror_pending, + "SError still pending after the guest took it"); + kvm_vm_free(vm); } -- 2.39.5

