Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

selftests: kvm: report failed stage when exit reason is unexpected

When we get a report like

==== Test Assertion Failure ====
x86_64/state_test.c:157: run->exit_reason == KVM_EXIT_IO
pid=955 tid=955 - Success
1 0x0000000000401350: main at state_test.c:154
2 0x00007fc31c9e9412: ?? ??:0
3 0x000000000040159d: _start at ??:?
Unexpected exit reason: 8 (SHUTDOWN),

it is not obvious which particular stage failed. Add the info.

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>

authored by

Vitaly Kuznetsov and committed by
Paolo Bonzini
b85c32dd e87555e5

+4 -4
+2 -2
tools/testing/selftests/kvm/x86_64/evmcs_test.c
··· 113 113 for (stage = 1;; stage++) { 114 114 _vcpu_run(vm, VCPU_ID); 115 115 TEST_ASSERT(run->exit_reason == KVM_EXIT_IO, 116 - "Unexpected exit reason: %u (%s),\n", 117 - run->exit_reason, 116 + "Stage %d: unexpected exit reason: %u (%s),\n", 117 + stage, run->exit_reason, 118 118 exit_reason_str(run->exit_reason)); 119 119 120 120 memset(&regs1, 0, sizeof(regs1));
+2 -2
tools/testing/selftests/kvm/x86_64/state_test.c
··· 152 152 for (stage = 1;; stage++) { 153 153 _vcpu_run(vm, VCPU_ID); 154 154 TEST_ASSERT(run->exit_reason == KVM_EXIT_IO, 155 - "Unexpected exit reason: %u (%s),\n", 156 - run->exit_reason, 155 + "Stage %d: unexpected exit reason: %u (%s),\n", 156 + stage, run->exit_reason, 157 157 exit_reason_str(run->exit_reason)); 158 158 159 159 memset(&regs1, 0, sizeof(regs1));