KVM: selftests: Fix filename reporting in guest asserts
authorColton Lewis <coltonlewis@google.com>
Wed, 15 Jun 2022 19:31:16 +0000 (19:31 +0000)
committerSean Christopherson <seanjc@google.com>
Thu, 14 Jul 2022 01:14:08 +0000 (18:14 -0700)
Fix filename reporting in guest asserts by ensuring the GUEST_ASSERT
macro records __FILE__ and substituting REPORT_GUEST_ASSERT for many
repetitive calls to TEST_FAIL.

Previously filename was reported by using __FILE__ directly in the
selftest, wrongly assuming it would always be the same as where the
assertion failed.

Signed-off-by: Colton Lewis <coltonlewis@google.com>
Reported-by: Ricardo Koller <ricarkol@google.com>
Fixes: 4e18bccc2e5544f0be28fc1c4e6be47a469d6c60
Link: https://lore.kernel.org/r/20220615193116.806312-5-coltonlewis@google.com
[sean: convert more TEST_FAIL => REPORT_GUEST_ASSERT instances]
Signed-off-by: Sean Christopherson <seanjc@google.com>
41 files changed:
tools/testing/selftests/kvm/aarch64/arch_timer.c
tools/testing/selftests/kvm/aarch64/debug-exceptions.c
tools/testing/selftests/kvm/aarch64/hypercalls.c
tools/testing/selftests/kvm/aarch64/psci_test.c
tools/testing/selftests/kvm/aarch64/vgic_irq.c
tools/testing/selftests/kvm/include/ucall_common.h
tools/testing/selftests/kvm/memslot_perf_test.c
tools/testing/selftests/kvm/s390x/tprot.c
tools/testing/selftests/kvm/set_memory_region_test.c
tools/testing/selftests/kvm/steal_time.c
tools/testing/selftests/kvm/system_counter_offset_test.c
tools/testing/selftests/kvm/x86_64/amx_test.c
tools/testing/selftests/kvm/x86_64/cpuid_test.c
tools/testing/selftests/kvm/x86_64/cr4_cpuid_sync_test.c
tools/testing/selftests/kvm/x86_64/emulator_error_test.c
tools/testing/selftests/kvm/x86_64/evmcs_test.c
tools/testing/selftests/kvm/x86_64/fix_hypercall_test.c
tools/testing/selftests/kvm/x86_64/hyperv_clock.c
tools/testing/selftests/kvm/x86_64/hyperv_features.c
tools/testing/selftests/kvm/x86_64/hyperv_svm_test.c
tools/testing/selftests/kvm/x86_64/kvm_clock_test.c
tools/testing/selftests/kvm/x86_64/kvm_pv_test.c
tools/testing/selftests/kvm/x86_64/monitor_mwait_test.c
tools/testing/selftests/kvm/x86_64/set_boot_cpu_id.c
tools/testing/selftests/kvm/x86_64/state_test.c
tools/testing/selftests/kvm/x86_64/svm_int_ctl_test.c
tools/testing/selftests/kvm/x86_64/svm_nested_soft_inject_test.c
tools/testing/selftests/kvm/x86_64/svm_vmcall_test.c
tools/testing/selftests/kvm/x86_64/triple_fault_event_test.c
tools/testing/selftests/kvm/x86_64/tsc_msrs_test.c
tools/testing/selftests/kvm/x86_64/userspace_io_test.c
tools/testing/selftests/kvm/x86_64/userspace_msr_exit_test.c
tools/testing/selftests/kvm/x86_64/vmx_apic_access_test.c
tools/testing/selftests/kvm/x86_64/vmx_close_while_nested_test.c
tools/testing/selftests/kvm/x86_64/vmx_dirty_log_test.c
tools/testing/selftests/kvm/x86_64/vmx_invalid_nested_guest_state.c
tools/testing/selftests/kvm/x86_64/vmx_nested_tsc_scaling_test.c
tools/testing/selftests/kvm/x86_64/vmx_preemption_timer_test.c
tools/testing/selftests/kvm/x86_64/vmx_tsc_adjust_test.c
tools/testing/selftests/kvm/x86_64/xen_shinfo_test.c
tools/testing/selftests/kvm/x86_64/xen_vmcall_test.c

index f68019b..574eb73 100644 (file)
@@ -231,10 +231,13 @@ static void *test_vcpu_run(void *arg)
                break;
        case UCALL_ABORT:
                sync_global_from_guest(vm, *shared_data);
-               TEST_FAIL("%s at %s:%ld\n\tvalues: %lu, %lu; %lu, vcpu: %u; stage: %u; iter: %u",
-                       (const char *)uc.args[0], __FILE__, uc.args[1],
-                       uc.args[2], uc.args[3], uc.args[4], vcpu_idx,
-                       shared_data->guest_stage, shared_data->nr_iter);
+               REPORT_GUEST_ASSERT_N(uc, "values: %lu, %lu; %lu, vcpu %u; stage; %u; iter: %u",
+                                     GUEST_ASSERT_ARG(uc, 0),
+                                     GUEST_ASSERT_ARG(uc, 1),
+                                     GUEST_ASSERT_ARG(uc, 2),
+                                     vcpu_idx,
+                                     shared_data->guest_stage,
+                                     shared_data->nr_iter);
                break;
        default:
                TEST_FAIL("Unexpected guest exit\n");
index b8072b4..2ee35cf 100644 (file)
@@ -283,9 +283,7 @@ int main(int argc, char *argv[])
                                stage, (ulong)uc.args[1]);
                        break;
                case UCALL_ABORT:
-                       TEST_FAIL("%s at %s:%ld\n\tvalues: %#lx, %#lx",
-                               (const char *)uc.args[0],
-                               __FILE__, uc.args[1], uc.args[2], uc.args[3]);
+                       REPORT_GUEST_ASSERT_2(uc, "values: %#lx, %#lx");
                        break;
                case UCALL_DONE:
                        goto done;
index 5fce496..a39da3f 100644 (file)
@@ -291,9 +291,10 @@ static void test_run(void)
                        guest_done = true;
                        break;
                case UCALL_ABORT:
-                       TEST_FAIL("%s at %s:%ld\n\tvalues: 0x%lx, 0x%lx; 0x%lx, stage: %u",
-                       (const char *)uc.args[0], __FILE__, uc.args[1],
-                       uc.args[2], uc.args[3], uc.args[4], stage);
+                       REPORT_GUEST_ASSERT_N(uc, "values: 0x%lx, 0x%lx; 0x%lx, stage: %u",
+                                             GUEST_ASSERT_ARG(uc, 0),
+                                             GUEST_ASSERT_ARG(uc, 1),
+                                             GUEST_ASSERT_ARG(uc, 2), stage);
                        break;
                default:
                        TEST_FAIL("Unexpected guest exit\n");
index b665b53..f7621f6 100644 (file)
@@ -94,8 +94,7 @@ static void enter_guest(struct kvm_vcpu *vcpu)
 
        vcpu_run(vcpu);
        if (get_ucall(vcpu, &uc) == UCALL_ABORT)
-               TEST_FAIL("%s at %s:%ld", (const char *)uc.args[0], __FILE__,
-                         uc.args[1]);
+               REPORT_GUEST_ASSERT(uc);
 }
 
 static void assert_vcpu_reset(struct kvm_vcpu *vcpu)
index 046ba4f..1741722 100644 (file)
@@ -782,9 +782,7 @@ static void test_vgic(uint32_t nr_irqs, bool level_sensitive, bool eoi_split)
                        run_guest_cmd(vcpu, gic_fd, &inject_args, &args);
                        break;
                case UCALL_ABORT:
-                       TEST_FAIL("%s at %s:%ld\n\tvalues: %#lx, %#lx",
-                                       (const char *)uc.args[0],
-                                       __FILE__, uc.args[1], uc.args[2], uc.args[3]);
+                       REPORT_GUEST_ASSERT_2(uc, "values: %#lx, %#lx");
                        break;
                case UCALL_DONE:
                        goto done;
index e8af3b4..ee79d18 100644 (file)
@@ -41,11 +41,12 @@ enum guest_assert_builtin_args {
        GUEST_ASSERT_BUILTIN_NARGS
 };
 
-#define __GUEST_ASSERT(_condition, _condstr, _nargs, _args...) do {    \
-       if (!(_condition))                                              \
-               ucall(UCALL_ABORT, 2 + _nargs,                          \
-                       "Failed guest assert: "                         \
-                       _condstr, __LINE__, _args);                     \
+#define __GUEST_ASSERT(_condition, _condstr, _nargs, _args...)         \
+do {                                                                   \
+       if (!(_condition))                                              \
+               ucall(UCALL_ABORT, GUEST_ASSERT_BUILTIN_NARGS + _nargs, \
+                     "Failed guest assert: " _condstr,                 \
+                     __FILE__, __LINE__, ##_args);                     \
 } while (0)
 
 #define GUEST_ASSERT(_condition) \
index 5f98489..4499544 100644 (file)
@@ -162,9 +162,7 @@ static void *vcpu_worker(void *__data)
                                goto done;
                        break;
                case UCALL_ABORT:
-                       TEST_FAIL("%s at %s:%ld, val = %lu",
-                                       (const char *)uc.args[0],
-                                       __FILE__, uc.args[1], uc.args[2]);
+                       REPORT_GUEST_ASSERT_1(uc, "val = %lu");
                        break;
                case UCALL_DONE:
                        goto done;
index 015a130..a9a0b76 100644 (file)
@@ -181,20 +181,18 @@ static void guest_code(void)
        GUEST_SYNC(perform_next_stage(&i, mapped_0));
 }
 
-#define HOST_SYNC_NO_TAP(vcpup, stage)                                         \
-({                                                                             \
-       struct kvm_vcpu *__vcpu = (vcpup);                                      \
-       struct ucall uc;                                                        \
-       int __stage = (stage);                                                  \
-                                                                               \
-       vcpu_run(__vcpu);                                                       \
-       get_ucall(__vcpu, &uc);                                                 \
-       if (uc.cmd == UCALL_ABORT) {                                            \
-               TEST_FAIL("line %lu: %s, hints: %lu, %lu", uc.args[1],          \
-                         (const char *)uc.args[0], uc.args[2], uc.args[3]);    \
-       }                                                                       \
-       ASSERT_EQ(uc.cmd, UCALL_SYNC);                                          \
-       ASSERT_EQ(uc.args[1], __stage);                                         \
+#define HOST_SYNC_NO_TAP(vcpup, stage)                         \
+({                                                             \
+       struct kvm_vcpu *__vcpu = (vcpup);                      \
+       struct ucall uc;                                        \
+       int __stage = (stage);                                  \
+                                                               \
+       vcpu_run(__vcpu);                                       \
+       get_ucall(__vcpu, &uc);                                 \
+       if (uc.cmd == UCALL_ABORT)                              \
+               REPORT_GUEST_ASSERT_2(uc, "hints: %lu, %lu");   \
+       ASSERT_EQ(uc.cmd, UCALL_SYNC);                          \
+       ASSERT_EQ(uc.args[1], __stage);                         \
 })
 
 #define HOST_SYNC(vcpu, stage)                 \
index 47b219d..0d55f50 100644 (file)
@@ -88,8 +88,7 @@ static void *vcpu_worker(void *data)
        }
 
        if (run->exit_reason == KVM_EXIT_IO && cmd == UCALL_ABORT)
-               TEST_FAIL("%s at %s:%ld, val = %lu", (const char *)uc.args[0],
-                         __FILE__, uc.args[1], uc.args[2]);
+               REPORT_GUEST_ASSERT_1(uc, "val = %lu");
 
        return NULL;
 }
index d122f1e..9866a71 100644 (file)
@@ -234,8 +234,7 @@ static void run_vcpu(struct kvm_vcpu *vcpu)
        case UCALL_DONE:
                break;
        case UCALL_ABORT:
-               TEST_ASSERT(false, "%s at %s:%ld", (const char *)uc.args[0],
-                           __FILE__, uc.args[1]);
+               REPORT_GUEST_ASSERT(uc);
        default:
                TEST_ASSERT(false, "Unexpected exit: %s",
                            exit_reason_str(vcpu->run->exit_reason));
index 862a8e9..1c27493 100644 (file)
@@ -83,8 +83,7 @@ static void handle_sync(struct ucall *uc, uint64_t start, uint64_t end)
 
 static void handle_abort(struct ucall *uc)
 {
-       TEST_FAIL("%s at %s:%ld", (const char *)uc->args[0],
-                 __FILE__, uc->args[1]);
+       REPORT_GUEST_ASSERT(*uc);
 }
 
 static void enter_guest(struct kvm_vcpu *vcpu)
index dab4ca1..b71763b 100644 (file)
@@ -373,8 +373,7 @@ int main(int argc, char *argv[])
 
                switch (get_ucall(vcpu, &uc)) {
                case UCALL_ABORT:
-                       TEST_FAIL("%s at %s:%ld", (const char *)uc.args[0],
-                                 __FILE__, uc.args[1]);
+                       REPORT_GUEST_ASSERT(uc);
                        /* NOT REACHED */
                case UCALL_SYNC:
                        switch (uc.args[1]) {
index 4aa7849..3767a0c 100644 (file)
@@ -132,8 +132,7 @@ static void run_vcpu(struct kvm_vcpu *vcpu, int stage)
        case UCALL_DONE:
                return;
        case UCALL_ABORT:
-               TEST_ASSERT(false, "%s at %s:%ld\n\tvalues: %#lx, %#lx", (const char *)uc.args[0],
-                           __FILE__, uc.args[1], uc.args[2], uc.args[3]);
+               REPORT_GUEST_ASSERT_2(uc, "values: %#lx, %#lx");
        default:
                TEST_ASSERT(false, "Unexpected exit: %s",
                            exit_reason_str(vcpu->run->exit_reason));
index a80940a..56d8ab9 100644 (file)
@@ -94,7 +94,7 @@ int main(int argc, char *argv[])
                        vcpu_sregs_set(vcpu, &sregs);
                        break;
                case UCALL_ABORT:
-                       TEST_FAIL("Guest CR4 bit (OSXSAVE) unsynchronized with CPUID bit.");
+                       REPORT_GUEST_ASSERT(uc);
                        break;
                case UCALL_DONE:
                        goto done;
index bfff2d2..3aa3d17 100644 (file)
@@ -92,8 +92,7 @@ static void process_exit_on_emulation_error(struct kvm_vcpu *vcpu)
 
 static void do_guest_assert(struct ucall *uc)
 {
-       TEST_FAIL("%s at %s:%ld", (const char *)uc->args[0], __FILE__,
-                 uc->args[1]);
+       REPORT_GUEST_ASSERT(*uc);
 }
 
 static void check_for_guest_assert(struct kvm_vcpu *vcpu)
index 8dda527..aacad86 100644 (file)
@@ -236,8 +236,7 @@ int main(int argc, char *argv[])
 
                switch (get_ucall(vcpu, &uc)) {
                case UCALL_ABORT:
-                       TEST_FAIL("%s at %s:%ld", (const char *)uc.args[0],
-                                 __FILE__, uc.args[1]);
+                       REPORT_GUEST_ASSERT(uc);
                        /* NOT REACHED */
                case UCALL_SYNC:
                        break;
index f6f251c..b1905d2 100644 (file)
@@ -112,7 +112,7 @@ static void enter_guest(struct kvm_vcpu *vcpu)
        case UCALL_DONE:
                return;
        case UCALL_ABORT:
-               TEST_FAIL("%s at %s:%ld", (const char *)uc.args[0], __FILE__, uc.args[1]);
+               REPORT_GUEST_ASSERT(uc);
        default:
                TEST_FAIL("Unhandled ucall: %ld\nexit_reason: %u (%s)",
                          uc.cmd, run->exit_reason, exit_reason_str(run->exit_reason));
index f7a9e29..d576bc8 100644 (file)
@@ -234,8 +234,7 @@ int main(void)
 
                switch (get_ucall(vcpu, &uc)) {
                case UCALL_ABORT:
-                       TEST_FAIL("%s at %s:%ld", (const char *)uc.args[0],
-                                 __FILE__, uc.args[1]);
+                       REPORT_GUEST_ASSERT(uc);
                        /* NOT REACHED */
                case UCALL_SYNC:
                        break;
index c05acd7..2070ba0 100644 (file)
@@ -447,9 +447,7 @@ static void guest_test_msrs_access(void)
 
                switch (get_ucall(vcpu, &uc)) {
                case UCALL_ABORT:
-                       TEST_FAIL("%s at %s:%ld, MSR = %lx, vector = %lx",
-                                 (const char *)uc.args[0], __FILE__,
-                                 uc.args[1], uc.args[2], uc.args[3]);
+                       REPORT_GUEST_ASSERT_2(uc, "MSR = %lx, vector = %lx");
                        return;
                case UCALL_DONE:
                        break;
@@ -618,9 +616,7 @@ static void guest_test_hcalls_access(void)
 
                switch (get_ucall(vcpu, &uc)) {
                case UCALL_ABORT:
-                       TEST_FAIL("%s at %s:%ld, arg1 = %lx, arg2 = %lx",
-                                 (const char *)uc.args[0], __FILE__,
-                                 uc.args[1], uc.args[2], uc.args[3]);
+                       REPORT_GUEST_ASSERT_2(uc, "arg1 = %lx, arg2 = %lx");
                        return;
                case UCALL_DONE:
                        break;
index c5cd983..b7dc243 100644 (file)
@@ -145,8 +145,7 @@ int main(int argc, char *argv[])
 
                switch (get_ucall(vcpu, &uc)) {
                case UCALL_ABORT:
-                       TEST_FAIL("%s at %s:%ld", (const char *)uc.args[0],
-                                 __FILE__, uc.args[1]);
+                       REPORT_GUEST_ASSERT(uc);
                        /* NOT REACHED */
                case UCALL_SYNC:
                        break;
index 1384555..813ce28 100644 (file)
@@ -71,8 +71,7 @@ static void handle_sync(struct ucall *uc, struct kvm_clock_data *start,
 
 static void handle_abort(struct ucall *uc)
 {
-       TEST_FAIL("%s at %s:%ld", (const char *)uc->args[0],
-                 __FILE__, uc->args[1]);
+       REPORT_GUEST_ASSERT(*uc);
 }
 
 static void setup_clock(struct kvm_vm *vm, struct test_case *test_case)
index feff85e..ea45244 100644 (file)
@@ -137,9 +137,7 @@ static void enter_guest(struct kvm_vcpu *vcpu)
                        pr_hcall(&uc);
                        break;
                case UCALL_ABORT:
-                       TEST_FAIL("%s at %s:%ld, vector = %lu",
-                                 (const char *)uc.args[0], __FILE__,
-                                 uc.args[1], uc.args[2]);
+                       REPORT_GUEST_ASSERT_1(uc, "vector = %lu");
                        return;
                case UCALL_DONE:
                        return;
index 094c68d..2bf6851 100644 (file)
@@ -100,9 +100,7 @@ int main(int argc, char *argv[])
                        testcase = uc.args[1];
                        break;
                case UCALL_ABORT:
-                       TEST_FAIL("%s at %s:%ld, testcase = %lx, vector = %ld",
-                                 (const char *)uc.args[0], __FILE__,
-                                 uc.args[1], uc.args[2], uc.args[3]);
+                       REPORT_GUEST_ASSERT_2(uc, "testcase = %lx, vector = %ld");
                        goto done;
                case UCALL_DONE:
                        goto done;
index 7ef713f..b25d755 100644 (file)
@@ -65,9 +65,7 @@ static void run_vcpu(struct kvm_vcpu *vcpu)
                                        stage);
                        break;
                case UCALL_ABORT:
-                       TEST_ASSERT(false, "%s at %s:%ld\n\tvalues: %#lx, %#lx",
-                                               (const char *)uc.args[0], __FILE__,
-                                               uc.args[1], uc.args[2], uc.args[3]);
+                       REPORT_GUEST_ASSERT_2(uc, "values: %#lx, %#lx");
                default:
                        TEST_ASSERT(false, "Unexpected exit: %s",
                                    exit_reason_str(vcpu->run->exit_reason));
index e2f1f35..2b0de15 100644 (file)
@@ -190,8 +190,7 @@ int main(int argc, char *argv[])
 
                switch (get_ucall(vcpu, &uc)) {
                case UCALL_ABORT:
-                       TEST_FAIL("%s at %s:%ld", (const char *)uc.args[0],
-                                 __FILE__, uc.args[1]);
+                       REPORT_GUEST_ASSERT(uc);
                        /* NOT REACHED */
                case UCALL_SYNC:
                        break;
index 9c68a47..d978d16 100644 (file)
@@ -113,7 +113,7 @@ int main(int argc, char *argv[])
 
        switch (get_ucall(vcpu, &uc)) {
        case UCALL_ABORT:
-               TEST_FAIL("%s", (const char *)uc.args[0]);
+               REPORT_GUEST_ASSERT(uc);
                break;
                /* NOT REACHED */
        case UCALL_DONE:
index 1c3f457..07253e2 100644 (file)
@@ -181,8 +181,7 @@ static void run_test(bool is_nmi)
 
        switch (get_ucall(vcpu, &uc)) {
        case UCALL_ABORT:
-               TEST_FAIL("%s at %s:%ld, vals = 0x%lx 0x%lx 0x%lx", (const char *)uc.args[0],
-                         __FILE__, uc.args[1], uc.args[2], uc.args[3], uc.args[4]);
+               REPORT_GUEST_ASSERT_3(uc, "vals = 0x%lx 0x%lx 0x%lx");
                break;
                /* NOT REACHED */
        case UCALL_DONE:
index e6d7191..d53b1f7 100644 (file)
@@ -58,7 +58,7 @@ int main(int argc, char *argv[])
 
                switch (get_ucall(vcpu, &uc)) {
                case UCALL_ABORT:
-                       TEST_FAIL("%s", (const char *)uc.args[0]);
+                       REPORT_GUEST_ASSERT(uc);
                        /* NOT REACHED */
                case UCALL_SYNC:
                        break;
index 5a202ec..d1274c0 100644 (file)
@@ -82,7 +82,7 @@ int main(void)
        case UCALL_DONE:
                break;
        case UCALL_ABORT:
-               TEST_FAIL("%s", (const char *)uc.args[0]);
+               REPORT_GUEST_ASSERT(uc);
        default:
                TEST_FAIL("Unexpected ucall: %lu", uc.cmd);
        }
index 3165d3f..22d366c 100644 (file)
@@ -79,9 +79,7 @@ static void run_vcpu(struct kvm_vcpu *vcpu, int stage)
        case UCALL_DONE:
                return;
        case UCALL_ABORT:
-               TEST_ASSERT(false, "%s at %s:%ld\n" \
-                           "\tvalues: %#lx, %#lx", (const char *)uc.args[0],
-                           __FILE__, uc.args[1], uc.args[2], uc.args[3]);
+               REPORT_GUEST_ASSERT_2(uc, "values: %#lx, %#lx");
        default:
                TEST_ASSERT(false, "Unexpected exit: %s",
                            exit_reason_str(vcpu->run->exit_reason));
index 7538d57..7316521 100644 (file)
@@ -98,9 +98,7 @@ int main(int argc, char *argv[])
        case UCALL_DONE:
                break;
        case UCALL_ABORT:
-               TEST_FAIL("%s at %s:%ld : argN+1 = 0x%lx, argN+2 = 0x%lx",
-                         (const char *)uc.args[0], __FILE__, uc.args[1],
-                         uc.args[2], uc.args[3]);
+               REPORT_GUEST_ASSERT_2(uc, "argN+1 = 0x%lx, argN+2 = 0x%lx");
        default:
                TEST_FAIL("Unknown ucall %lu", uc.cmd);
        }
index f84dc37..a4f0637 100644 (file)
@@ -400,8 +400,7 @@ static void check_for_guest_assert(struct kvm_vcpu *vcpu)
 
        if (vcpu->run->exit_reason == KVM_EXIT_IO &&
            get_ucall(vcpu, &uc) == UCALL_ABORT) {
-               TEST_FAIL("%s at %s:%ld",
-                         (const char *)uc.args[0], __FILE__, uc.args[1]);
+               REPORT_GUEST_ASSERT(uc);
        }
 }
 
@@ -610,7 +609,7 @@ static int handle_ucall(struct kvm_vcpu *vcpu)
 
        switch (get_ucall(vcpu, &uc)) {
        case UCALL_ABORT:
-               TEST_FAIL("Guest assertion not met");
+               REPORT_GUEST_ASSERT(uc);
                break;
        case UCALL_SYNC:
                vm_ioctl(vcpu->vm, KVM_X86_SET_MSR_FILTER, &no_filter_deny);
index ccb05ef..d3582ce 100644 (file)
@@ -114,8 +114,7 @@ int main(int argc, char *argv[])
 
                switch (get_ucall(vcpu, &uc)) {
                case UCALL_ABORT:
-                       TEST_FAIL("%s at %s:%ld", (const char *)uc.args[0],
-                                 __FILE__, uc.args[1]);
+                       REPORT_GUEST_ASSERT(uc);
                        /* NOT REACHED */
                case UCALL_SYNC:
                        apic_access_addr = uc.args[1];
index 40c77bb..e69e896 100644 (file)
@@ -74,7 +74,7 @@ int main(int argc, char *argv[])
 
                switch (get_ucall(vcpu, &uc)) {
                case UCALL_ABORT:
-                       TEST_FAIL("%s", (const char *)uc.args[0]);
+                       REPORT_GUEST_ASSERT(uc);
                        /* NOT REACHED */
                default:
                        TEST_FAIL("Unknown ucall %lu", uc.cmd);
index 215ffa0..f378960 100644 (file)
@@ -123,8 +123,7 @@ int main(int argc, char *argv[])
 
                switch (get_ucall(vcpu, &uc)) {
                case UCALL_ABORT:
-                       TEST_FAIL("%s at %s:%ld", (const char *)uc.args[0],
-                                 __FILE__, uc.args[1]);
+                       REPORT_GUEST_ASSERT(uc);
                        /* NOT REACHED */
                case UCALL_SYNC:
                        /*
index 683f4f0..8c85473 100644 (file)
@@ -98,7 +98,7 @@ int main(int argc, char *argv[])
        case UCALL_DONE:
                break;
        case UCALL_ABORT:
-               TEST_FAIL("%s", (const char *)uc.args[0]);
+               REPORT_GUEST_ASSERT(uc);
        default:
                TEST_FAIL("Unexpected ucall: %lu", uc.cmd);
        }
index ff46440..6bfef77 100644 (file)
@@ -194,7 +194,7 @@ int main(int argc, char *argv[])
 
                switch (get_ucall(vcpu, &uc)) {
                case UCALL_ABORT:
-                       TEST_FAIL("%s", (const char *) uc.args[0]);
+                       REPORT_GUEST_ASSERT(uc);
                case UCALL_SYNC:
                        switch (uc.args[0]) {
                        case USLEEP:
index 99e57b0..0a8e989 100644 (file)
@@ -189,8 +189,7 @@ int main(int argc, char *argv[])
 
                switch (get_ucall(vcpu, &uc)) {
                case UCALL_ABORT:
-                       TEST_FAIL("%s at %s:%ld", (const char *)uc.args[0],
-                                 __FILE__, uc.args[1]);
+                       REPORT_GUEST_ASSERT(uc);
                        /* NOT REACHED */
                case UCALL_SYNC:
                        break;
index e32bfb1..2e75eef 100644 (file)
@@ -147,7 +147,7 @@ int main(int argc, char *argv[])
 
                switch (get_ucall(vcpu, &uc)) {
                case UCALL_ABORT:
-                       TEST_FAIL("%s", (const char *)uc.args[0]);
+                       REPORT_GUEST_ASSERT(uc);
                        /* NOT REACHED */
                case UCALL_SYNC:
                        report(uc.args[1]);
index a4a7863..8a5cb80 100644 (file)
@@ -542,7 +542,7 @@ int main(int argc, char *argv[])
 
                switch (get_ucall(vcpu, &uc)) {
                case UCALL_ABORT:
-                       TEST_FAIL("%s", (const char *)uc.args[0]);
+                       REPORT_GUEST_ASSERT(uc);
                        /* NOT REACHED */
                case UCALL_SYNC: {
                        struct kvm_xen_vcpu_attr rst;
index 8b76cad..88914d4 100644 (file)
@@ -129,7 +129,7 @@ int main(int argc, char *argv[])
 
                switch (get_ucall(vcpu, &uc)) {
                case UCALL_ABORT:
-                       TEST_FAIL("%s", (const char *)uc.args[0]);
+                       REPORT_GUEST_ASSERT(uc);
                        /* NOT REACHED */
                case UCALL_SYNC:
                        break;