~satchmo/libvmm

42a51b048b174f554d135c6ba084600b5f774448 — Jason Phan 3 months ago db6d722
kvm: Fix some tests
2 files changed, 5 insertions(+), 8 deletions(-)

M tests/kvm/vcpu.cpp
M tests/kvm/vm.cpp
M tests/kvm/vcpu.cpp => tests/kvm/vcpu.cpp +3 -4
@@ 371,7 371,7 @@ TEST_CASE("Run (x86)") {
    // configure the VM with a memory region containing our code
    vm.set_memslot(slot,
                   guest_addr,
                   size,
                   mem_size,
                   reinterpret_cast<uintptr_t>(mem),
                   KVM_MEM_LOG_DIRTY_PAGES);



@@ 383,13 383,12 @@ TEST_CASE("Run (x86)") {
    kvi.features[0] |= 1 << KVM_ARM_VCPU_PSCI_0_2;
    vcpu.init(kvi);

    auto core_reg_base = uint64_t{0x6030'0000'0010'0000};
    auto mmio_addr = uint64_t{guest_addr + mem_size};

    // Set PC to guest address (where code is)
    auto core_reg_base = uint64_t{0x6030'0000'0010'0000};
    vcpu.set_reg(core_reg_base + 2 * 32, guest_addr);

    // Set x8 and x9 to addreses the guest test code needs
    auto mmio_addr = uint64_t{guest_addr + mem_size};
    vcpu.set_reg(core_reg_base + 2 * 8, guest_addr + 0x10000);
    vcpu.set_reg(core_reg_base + 2 * 9, mmio_addr);


M tests/kvm/vm.cpp => tests/kvm/vm.cpp +2 -4
@@ 252,10 252,8 @@ TEST_CASE("IRQ chip") {
    auto vm = kvm.vm();

    if (vm.check_extension(KVM_CAP_IRQCHIP)) {
        auto vgic_v2_supported = vm.device(KVM_DEV_TYPE_ARM_VGIC_V2,
                                           KVM_CREATE_DEVICE_TEST);

        REQUIRE(vm.irqchip() == vgic_v2_supported);
        REQUIRE_NOTHROW(vm.device(KVM_DEV_TYPE_ARM_VGIC_V2, KVM_CREATE_DEVICE_TEST));
        REQUIRE_NOTHROW(vm.irqchip());
    }
}