Commit 65612e99 authored by Andrew Jones's avatar Andrew Jones Committed by Sean Christopherson

KVM: selftests: x86_64: Remove redundant newlines

TEST_* functions append their own newline. Remove newlines from
TEST_* callsites to avoid extra newlines in output.
Signed-off-by: default avatarAndrew Jones <ajones@ventanamicro.com>
Link: https://lore.kernel.org/r/20231206170241.82801-12-ajones@ventanamicro.com
[sean: keep the newline in the "tsc\n" strncmp()]
Signed-off-by: default avatarSean Christopherson <seanjc@google.com>
parent a38125f1
...@@ -170,10 +170,10 @@ static uint64_t *virt_create_upper_pte(struct kvm_vm *vm, ...@@ -170,10 +170,10 @@ static uint64_t *virt_create_upper_pte(struct kvm_vm *vm,
* this level. * this level.
*/ */
TEST_ASSERT(current_level != target_level, TEST_ASSERT(current_level != target_level,
"Cannot create hugepage at level: %u, vaddr: 0x%lx\n", "Cannot create hugepage at level: %u, vaddr: 0x%lx",
current_level, vaddr); current_level, vaddr);
TEST_ASSERT(!(*pte & PTE_LARGE_MASK), TEST_ASSERT(!(*pte & PTE_LARGE_MASK),
"Cannot create page table at level: %u, vaddr: 0x%lx\n", "Cannot create page table at level: %u, vaddr: 0x%lx",
current_level, vaddr); current_level, vaddr);
} }
return pte; return pte;
...@@ -220,7 +220,7 @@ void __virt_pg_map(struct kvm_vm *vm, uint64_t vaddr, uint64_t paddr, int level) ...@@ -220,7 +220,7 @@ void __virt_pg_map(struct kvm_vm *vm, uint64_t vaddr, uint64_t paddr, int level)
/* Fill in page table entry. */ /* Fill in page table entry. */
pte = virt_get_pte(vm, pde, vaddr, PG_LEVEL_4K); pte = virt_get_pte(vm, pde, vaddr, PG_LEVEL_4K);
TEST_ASSERT(!(*pte & PTE_PRESENT_MASK), TEST_ASSERT(!(*pte & PTE_PRESENT_MASK),
"PTE already present for 4k page at vaddr: 0x%lx\n", vaddr); "PTE already present for 4k page at vaddr: 0x%lx", vaddr);
*pte = PTE_PRESENT_MASK | PTE_WRITABLE_MASK | (paddr & PHYSICAL_PAGE_MASK); *pte = PTE_PRESENT_MASK | PTE_WRITABLE_MASK | (paddr & PHYSICAL_PAGE_MASK);
} }
...@@ -253,7 +253,7 @@ static bool vm_is_target_pte(uint64_t *pte, int *level, int current_level) ...@@ -253,7 +253,7 @@ static bool vm_is_target_pte(uint64_t *pte, int *level, int current_level)
if (*pte & PTE_LARGE_MASK) { if (*pte & PTE_LARGE_MASK) {
TEST_ASSERT(*level == PG_LEVEL_NONE || TEST_ASSERT(*level == PG_LEVEL_NONE ||
*level == current_level, *level == current_level,
"Unexpected hugepage at level %d\n", current_level); "Unexpected hugepage at level %d", current_level);
*level = current_level; *level = current_level;
} }
...@@ -825,7 +825,7 @@ void vcpu_args_set(struct kvm_vcpu *vcpu, unsigned int num, ...) ...@@ -825,7 +825,7 @@ void vcpu_args_set(struct kvm_vcpu *vcpu, unsigned int num, ...)
struct kvm_regs regs; struct kvm_regs regs;
TEST_ASSERT(num >= 1 && num <= 6, "Unsupported number of args,\n" TEST_ASSERT(num >= 1 && num <= 6, "Unsupported number of args,\n"
" num: %u\n", " num: %u",
num); num);
va_start(ap, num); va_start(ap, num);
......
...@@ -54,7 +54,7 @@ int vcpu_enable_evmcs(struct kvm_vcpu *vcpu) ...@@ -54,7 +54,7 @@ int vcpu_enable_evmcs(struct kvm_vcpu *vcpu)
/* KVM should return supported EVMCS version range */ /* KVM should return supported EVMCS version range */
TEST_ASSERT(((evmcs_ver >> 8) >= (evmcs_ver & 0xff)) && TEST_ASSERT(((evmcs_ver >> 8) >= (evmcs_ver & 0xff)) &&
(evmcs_ver & 0xff) > 0, (evmcs_ver & 0xff) > 0,
"Incorrect EVMCS version range: %x:%x\n", "Incorrect EVMCS version range: %x:%x",
evmcs_ver & 0xff, evmcs_ver >> 8); evmcs_ver & 0xff, evmcs_ver >> 8);
return evmcs_ver; return evmcs_ver;
...@@ -387,10 +387,10 @@ static void nested_create_pte(struct kvm_vm *vm, ...@@ -387,10 +387,10 @@ static void nested_create_pte(struct kvm_vm *vm,
* this level. * this level.
*/ */
TEST_ASSERT(current_level != target_level, TEST_ASSERT(current_level != target_level,
"Cannot create hugepage at level: %u, nested_paddr: 0x%lx\n", "Cannot create hugepage at level: %u, nested_paddr: 0x%lx",
current_level, nested_paddr); current_level, nested_paddr);
TEST_ASSERT(!pte->page_size, TEST_ASSERT(!pte->page_size,
"Cannot create page table at level: %u, nested_paddr: 0x%lx\n", "Cannot create page table at level: %u, nested_paddr: 0x%lx",
current_level, nested_paddr); current_level, nested_paddr);
} }
} }
......
...@@ -296,7 +296,7 @@ int main(int argc, char *argv[]) ...@@ -296,7 +296,7 @@ int main(int argc, char *argv[])
void *tiles_data = (void *)addr_gva2hva(vm, tiledata); void *tiles_data = (void *)addr_gva2hva(vm, tiledata);
/* Only check TMM0 register, 1 tile */ /* Only check TMM0 register, 1 tile */
ret = memcmp(amx_start, tiles_data, TILE_SIZE); ret = memcmp(amx_start, tiles_data, TILE_SIZE);
TEST_ASSERT(ret == 0, "memcmp failed, ret=%d\n", ret); TEST_ASSERT(ret == 0, "memcmp failed, ret=%d", ret);
kvm_x86_state_cleanup(state); kvm_x86_state_cleanup(state);
break; break;
case 9: case 9:
......
...@@ -84,7 +84,7 @@ static void compare_cpuids(const struct kvm_cpuid2 *cpuid1, ...@@ -84,7 +84,7 @@ static void compare_cpuids(const struct kvm_cpuid2 *cpuid1,
TEST_ASSERT(e1->function == e2->function && TEST_ASSERT(e1->function == e2->function &&
e1->index == e2->index && e1->flags == e2->flags, e1->index == e2->index && e1->flags == e2->flags,
"CPUID entries[%d] mismtach: 0x%x.%d.%x vs. 0x%x.%d.%x\n", "CPUID entries[%d] mismtach: 0x%x.%d.%x vs. 0x%x.%d.%x",
i, e1->function, e1->index, e1->flags, i, e1->function, e1->index, e1->flags,
e2->function, e2->index, e2->flags); e2->function, e2->index, e2->flags);
...@@ -170,7 +170,7 @@ static void test_get_cpuid2(struct kvm_vcpu *vcpu) ...@@ -170,7 +170,7 @@ static void test_get_cpuid2(struct kvm_vcpu *vcpu)
vcpu_ioctl(vcpu, KVM_GET_CPUID2, cpuid); vcpu_ioctl(vcpu, KVM_GET_CPUID2, cpuid);
TEST_ASSERT(cpuid->nent == vcpu->cpuid->nent, TEST_ASSERT(cpuid->nent == vcpu->cpuid->nent,
"KVM didn't update nent on success, wanted %u, got %u\n", "KVM didn't update nent on success, wanted %u, got %u",
vcpu->cpuid->nent, cpuid->nent); vcpu->cpuid->nent, cpuid->nent);
for (i = 0; i < vcpu->cpuid->nent; i++) { for (i = 0; i < vcpu->cpuid->nent; i++) {
......
...@@ -41,7 +41,7 @@ static inline void handle_flds_emulation_failure_exit(struct kvm_vcpu *vcpu) ...@@ -41,7 +41,7 @@ static inline void handle_flds_emulation_failure_exit(struct kvm_vcpu *vcpu)
insn_bytes = run->emulation_failure.insn_bytes; insn_bytes = run->emulation_failure.insn_bytes;
TEST_ASSERT(insn_bytes[0] == 0xd9 && insn_bytes[1] == 0, TEST_ASSERT(insn_bytes[0] == 0xd9 && insn_bytes[1] == 0,
"Expected 'flds [eax]', opcode '0xd9 0x00', got opcode 0x%02x 0x%02x\n", "Expected 'flds [eax]', opcode '0xd9 0x00', got opcode 0x%02x 0x%02x",
insn_bytes[0], insn_bytes[1]); insn_bytes[0], insn_bytes[1]);
vcpu_regs_get(vcpu, &regs); vcpu_regs_get(vcpu, &regs);
......
...@@ -220,7 +220,7 @@ int main(void) ...@@ -220,7 +220,7 @@ int main(void)
tsc_page_gva = vm_vaddr_alloc_page(vm); tsc_page_gva = vm_vaddr_alloc_page(vm);
memset(addr_gva2hva(vm, tsc_page_gva), 0x0, getpagesize()); memset(addr_gva2hva(vm, tsc_page_gva), 0x0, getpagesize());
TEST_ASSERT((addr_gva2gpa(vm, tsc_page_gva) & (getpagesize() - 1)) == 0, TEST_ASSERT((addr_gva2gpa(vm, tsc_page_gva) & (getpagesize() - 1)) == 0,
"TSC page has to be page aligned\n"); "TSC page has to be page aligned");
vcpu_args_set(vcpu, 2, tsc_page_gva, addr_gva2gpa(vm, tsc_page_gva)); vcpu_args_set(vcpu, 2, tsc_page_gva, addr_gva2gpa(vm, tsc_page_gva));
host_check_tsc_msr_rdtsc(vcpu); host_check_tsc_msr_rdtsc(vcpu);
...@@ -237,7 +237,7 @@ int main(void) ...@@ -237,7 +237,7 @@ int main(void)
break; break;
case UCALL_DONE: case UCALL_DONE:
/* Keep in sync with guest_main() */ /* Keep in sync with guest_main() */
TEST_ASSERT(stage == 11, "Testing ended prematurely, stage %d\n", TEST_ASSERT(stage == 11, "Testing ended prematurely, stage %d",
stage); stage);
goto out; goto out;
default: default:
......
...@@ -289,7 +289,7 @@ int main(int argc, char *argv[]) ...@@ -289,7 +289,7 @@ int main(int argc, char *argv[])
switch (get_ucall(vcpu[0], &uc)) { switch (get_ucall(vcpu[0], &uc)) {
case UCALL_SYNC: case UCALL_SYNC:
TEST_ASSERT(uc.args[1] == stage, TEST_ASSERT(uc.args[1] == stage,
"Unexpected stage: %ld (%d expected)\n", "Unexpected stage: %ld (%d expected)",
uc.args[1], stage); uc.args[1], stage);
break; break;
case UCALL_DONE: case UCALL_DONE:
......
...@@ -658,7 +658,7 @@ int main(int argc, char *argv[]) ...@@ -658,7 +658,7 @@ int main(int argc, char *argv[])
switch (get_ucall(vcpu[0], &uc)) { switch (get_ucall(vcpu[0], &uc)) {
case UCALL_SYNC: case UCALL_SYNC:
TEST_ASSERT(uc.args[1] == stage, TEST_ASSERT(uc.args[1] == stage,
"Unexpected stage: %ld (%d expected)\n", "Unexpected stage: %ld (%d expected)",
uc.args[1], stage); uc.args[1], stage);
break; break;
case UCALL_ABORT: case UCALL_ABORT:
......
...@@ -92,7 +92,7 @@ static void setup_clock(struct kvm_vm *vm, struct test_case *test_case) ...@@ -92,7 +92,7 @@ static void setup_clock(struct kvm_vm *vm, struct test_case *test_case)
break; break;
} while (errno == EINTR); } while (errno == EINTR);
TEST_ASSERT(!r, "clock_gettime() failed: %d\n", r); TEST_ASSERT(!r, "clock_gettime() failed: %d", r);
data.realtime = ts.tv_sec * NSEC_PER_SEC; data.realtime = ts.tv_sec * NSEC_PER_SEC;
data.realtime += ts.tv_nsec; data.realtime += ts.tv_nsec;
...@@ -127,7 +127,7 @@ static void enter_guest(struct kvm_vcpu *vcpu) ...@@ -127,7 +127,7 @@ static void enter_guest(struct kvm_vcpu *vcpu)
handle_abort(&uc); handle_abort(&uc);
return; return;
default: default:
TEST_ASSERT(0, "unhandled ucall: %ld\n", uc.cmd); TEST_ASSERT(0, "unhandled ucall: %ld", uc.cmd);
} }
} }
} }
...@@ -154,7 +154,7 @@ static void check_clocksource(void) ...@@ -154,7 +154,7 @@ static void check_clocksource(void)
} }
clk_name = malloc(st.st_size); clk_name = malloc(st.st_size);
TEST_ASSERT(clk_name, "failed to allocate buffer to read file\n"); TEST_ASSERT(clk_name, "failed to allocate buffer to read file");
if (!fgets(clk_name, st.st_size, fp)) { if (!fgets(clk_name, st.st_size, fp)) {
pr_info("failed to read clocksource file: %d; assuming TSC.\n", pr_info("failed to read clocksource file: %d; assuming TSC.\n",
......
...@@ -44,7 +44,7 @@ static void test_msr_platform_info_enabled(struct kvm_vcpu *vcpu) ...@@ -44,7 +44,7 @@ static void test_msr_platform_info_enabled(struct kvm_vcpu *vcpu)
get_ucall(vcpu, &uc); get_ucall(vcpu, &uc);
TEST_ASSERT(uc.cmd == UCALL_SYNC, TEST_ASSERT(uc.cmd == UCALL_SYNC,
"Received ucall other than UCALL_SYNC: %lu\n", uc.cmd); "Received ucall other than UCALL_SYNC: %lu", uc.cmd);
TEST_ASSERT((uc.args[1] & MSR_PLATFORM_INFO_MAX_TURBO_RATIO) == TEST_ASSERT((uc.args[1] & MSR_PLATFORM_INFO_MAX_TURBO_RATIO) ==
MSR_PLATFORM_INFO_MAX_TURBO_RATIO, MSR_PLATFORM_INFO_MAX_TURBO_RATIO,
"Expected MSR_PLATFORM_INFO to have max turbo ratio mask: %i.", "Expected MSR_PLATFORM_INFO to have max turbo ratio mask: %i.",
......
...@@ -866,7 +866,7 @@ static void __test_fixed_counter_bitmap(struct kvm_vcpu *vcpu, uint8_t idx, ...@@ -866,7 +866,7 @@ static void __test_fixed_counter_bitmap(struct kvm_vcpu *vcpu, uint8_t idx,
* userspace doesn't set any pmu filter. * userspace doesn't set any pmu filter.
*/ */
count = run_vcpu_to_sync(vcpu); count = run_vcpu_to_sync(vcpu);
TEST_ASSERT(count, "Unexpected count value: %ld\n", count); TEST_ASSERT(count, "Unexpected count value: %ld", count);
for (i = 0; i < BIT(nr_fixed_counters); i++) { for (i = 0; i < BIT(nr_fixed_counters); i++) {
bitmap = BIT(i); bitmap = BIT(i);
......
...@@ -91,7 +91,7 @@ static void sev_migrate_from(struct kvm_vm *dst, struct kvm_vm *src) ...@@ -91,7 +91,7 @@ static void sev_migrate_from(struct kvm_vm *dst, struct kvm_vm *src)
int ret; int ret;
ret = __sev_migrate_from(dst, src); ret = __sev_migrate_from(dst, src);
TEST_ASSERT(!ret, "Migration failed, ret: %d, errno: %d\n", ret, errno); TEST_ASSERT(!ret, "Migration failed, ret: %d, errno: %d", ret, errno);
} }
static void test_sev_migrate_from(bool es) static void test_sev_migrate_from(bool es)
...@@ -113,7 +113,7 @@ static void test_sev_migrate_from(bool es) ...@@ -113,7 +113,7 @@ static void test_sev_migrate_from(bool es)
/* Migrate the guest back to the original VM. */ /* Migrate the guest back to the original VM. */
ret = __sev_migrate_from(src_vm, dst_vms[NR_MIGRATE_TEST_VMS - 1]); ret = __sev_migrate_from(src_vm, dst_vms[NR_MIGRATE_TEST_VMS - 1]);
TEST_ASSERT(ret == -1 && errno == EIO, TEST_ASSERT(ret == -1 && errno == EIO,
"VM that was migrated from should be dead. ret %d, errno: %d\n", ret, "VM that was migrated from should be dead. ret %d, errno: %d", ret,
errno); errno);
kvm_vm_free(src_vm); kvm_vm_free(src_vm);
...@@ -172,7 +172,7 @@ static void test_sev_migrate_parameters(void) ...@@ -172,7 +172,7 @@ static void test_sev_migrate_parameters(void)
vm_no_sev = aux_vm_create(true); vm_no_sev = aux_vm_create(true);
ret = __sev_migrate_from(vm_no_vcpu, vm_no_sev); ret = __sev_migrate_from(vm_no_vcpu, vm_no_sev);
TEST_ASSERT(ret == -1 && errno == EINVAL, TEST_ASSERT(ret == -1 && errno == EINVAL,
"Migrations require SEV enabled. ret %d, errno: %d\n", ret, "Migrations require SEV enabled. ret %d, errno: %d", ret,
errno); errno);
if (!have_sev_es) if (!have_sev_es)
...@@ -187,25 +187,25 @@ static void test_sev_migrate_parameters(void) ...@@ -187,25 +187,25 @@ static void test_sev_migrate_parameters(void)
ret = __sev_migrate_from(sev_vm, sev_es_vm); ret = __sev_migrate_from(sev_vm, sev_es_vm);
TEST_ASSERT( TEST_ASSERT(
ret == -1 && errno == EINVAL, ret == -1 && errno == EINVAL,
"Should not be able migrate to SEV enabled VM. ret: %d, errno: %d\n", "Should not be able migrate to SEV enabled VM. ret: %d, errno: %d",
ret, errno); ret, errno);
ret = __sev_migrate_from(sev_es_vm, sev_vm); ret = __sev_migrate_from(sev_es_vm, sev_vm);
TEST_ASSERT( TEST_ASSERT(
ret == -1 && errno == EINVAL, ret == -1 && errno == EINVAL,
"Should not be able migrate to SEV-ES enabled VM. ret: %d, errno: %d\n", "Should not be able migrate to SEV-ES enabled VM. ret: %d, errno: %d",
ret, errno); ret, errno);
ret = __sev_migrate_from(vm_no_vcpu, sev_es_vm); ret = __sev_migrate_from(vm_no_vcpu, sev_es_vm);
TEST_ASSERT( TEST_ASSERT(
ret == -1 && errno == EINVAL, ret == -1 && errno == EINVAL,
"SEV-ES migrations require same number of vCPUS. ret: %d, errno: %d\n", "SEV-ES migrations require same number of vCPUS. ret: %d, errno: %d",
ret, errno); ret, errno);
ret = __sev_migrate_from(vm_no_vcpu, sev_es_vm_no_vmsa); ret = __sev_migrate_from(vm_no_vcpu, sev_es_vm_no_vmsa);
TEST_ASSERT( TEST_ASSERT(
ret == -1 && errno == EINVAL, ret == -1 && errno == EINVAL,
"SEV-ES migrations require UPDATE_VMSA. ret %d, errno: %d\n", "SEV-ES migrations require UPDATE_VMSA. ret %d, errno: %d",
ret, errno); ret, errno);
kvm_vm_free(sev_vm); kvm_vm_free(sev_vm);
...@@ -227,7 +227,7 @@ static void sev_mirror_create(struct kvm_vm *dst, struct kvm_vm *src) ...@@ -227,7 +227,7 @@ static void sev_mirror_create(struct kvm_vm *dst, struct kvm_vm *src)
int ret; int ret;
ret = __sev_mirror_create(dst, src); ret = __sev_mirror_create(dst, src);
TEST_ASSERT(!ret, "Copying context failed, ret: %d, errno: %d\n", ret, errno); TEST_ASSERT(!ret, "Copying context failed, ret: %d, errno: %d", ret, errno);
} }
static void verify_mirror_allowed_cmds(int vm_fd) static void verify_mirror_allowed_cmds(int vm_fd)
...@@ -259,7 +259,7 @@ static void verify_mirror_allowed_cmds(int vm_fd) ...@@ -259,7 +259,7 @@ static void verify_mirror_allowed_cmds(int vm_fd)
ret = __sev_ioctl(vm_fd, cmd_id, NULL, &fw_error); ret = __sev_ioctl(vm_fd, cmd_id, NULL, &fw_error);
TEST_ASSERT( TEST_ASSERT(
ret == -1 && errno == EINVAL, ret == -1 && errno == EINVAL,
"Should not be able call command: %d. ret: %d, errno: %d\n", "Should not be able call command: %d. ret: %d, errno: %d",
cmd_id, ret, errno); cmd_id, ret, errno);
} }
...@@ -301,18 +301,18 @@ static void test_sev_mirror_parameters(void) ...@@ -301,18 +301,18 @@ static void test_sev_mirror_parameters(void)
ret = __sev_mirror_create(sev_vm, sev_vm); ret = __sev_mirror_create(sev_vm, sev_vm);
TEST_ASSERT( TEST_ASSERT(
ret == -1 && errno == EINVAL, ret == -1 && errno == EINVAL,
"Should not be able copy context to self. ret: %d, errno: %d\n", "Should not be able copy context to self. ret: %d, errno: %d",
ret, errno); ret, errno);
ret = __sev_mirror_create(vm_no_vcpu, vm_with_vcpu); ret = __sev_mirror_create(vm_no_vcpu, vm_with_vcpu);
TEST_ASSERT(ret == -1 && errno == EINVAL, TEST_ASSERT(ret == -1 && errno == EINVAL,
"Copy context requires SEV enabled. ret %d, errno: %d\n", ret, "Copy context requires SEV enabled. ret %d, errno: %d", ret,
errno); errno);
ret = __sev_mirror_create(vm_with_vcpu, sev_vm); ret = __sev_mirror_create(vm_with_vcpu, sev_vm);
TEST_ASSERT( TEST_ASSERT(
ret == -1 && errno == EINVAL, ret == -1 && errno == EINVAL,
"SEV copy context requires no vCPUS on the destination. ret: %d, errno: %d\n", "SEV copy context requires no vCPUS on the destination. ret: %d, errno: %d",
ret, errno); ret, errno);
if (!have_sev_es) if (!have_sev_es)
...@@ -322,13 +322,13 @@ static void test_sev_mirror_parameters(void) ...@@ -322,13 +322,13 @@ static void test_sev_mirror_parameters(void)
ret = __sev_mirror_create(sev_vm, sev_es_vm); ret = __sev_mirror_create(sev_vm, sev_es_vm);
TEST_ASSERT( TEST_ASSERT(
ret == -1 && errno == EINVAL, ret == -1 && errno == EINVAL,
"Should not be able copy context to SEV enabled VM. ret: %d, errno: %d\n", "Should not be able copy context to SEV enabled VM. ret: %d, errno: %d",
ret, errno); ret, errno);
ret = __sev_mirror_create(sev_es_vm, sev_vm); ret = __sev_mirror_create(sev_es_vm, sev_vm);
TEST_ASSERT( TEST_ASSERT(
ret == -1 && errno == EINVAL, ret == -1 && errno == EINVAL,
"Should not be able copy context to SEV-ES enabled VM. ret: %d, errno: %d\n", "Should not be able copy context to SEV-ES enabled VM. ret: %d, errno: %d",
ret, errno); ret, errno);
kvm_vm_free(sev_es_vm); kvm_vm_free(sev_es_vm);
......
...@@ -74,7 +74,7 @@ int main(int argc, char *argv[]) ...@@ -74,7 +74,7 @@ int main(int argc, char *argv[])
MEM_REGION_SIZE / PAGE_SIZE, 0); MEM_REGION_SIZE / PAGE_SIZE, 0);
gpa = vm_phy_pages_alloc(vm, MEM_REGION_SIZE / PAGE_SIZE, gpa = vm_phy_pages_alloc(vm, MEM_REGION_SIZE / PAGE_SIZE,
MEM_REGION_GPA, MEM_REGION_SLOT); MEM_REGION_GPA, MEM_REGION_SLOT);
TEST_ASSERT(gpa == MEM_REGION_GPA, "Failed vm_phy_pages_alloc\n"); TEST_ASSERT(gpa == MEM_REGION_GPA, "Failed vm_phy_pages_alloc");
virt_map(vm, MEM_REGION_GVA, MEM_REGION_GPA, 1); virt_map(vm, MEM_REGION_GVA, MEM_REGION_GPA, 1);
hva = addr_gpa2hva(vm, MEM_REGION_GPA); hva = addr_gpa2hva(vm, MEM_REGION_GPA);
memset(hva, 0, PAGE_SIZE); memset(hva, 0, PAGE_SIZE);
...@@ -102,7 +102,7 @@ int main(int argc, char *argv[]) ...@@ -102,7 +102,7 @@ int main(int argc, char *argv[])
case UCALL_DONE: case UCALL_DONE:
break; break;
default: default:
TEST_FAIL("Unrecognized ucall: %lu\n", uc.cmd); TEST_FAIL("Unrecognized ucall: %lu", uc.cmd);
} }
kvm_vm_free(vm); kvm_vm_free(vm);
......
...@@ -46,7 +46,7 @@ static void compare_regs(struct kvm_regs *left, struct kvm_regs *right) ...@@ -46,7 +46,7 @@ static void compare_regs(struct kvm_regs *left, struct kvm_regs *right)
#define REG_COMPARE(reg) \ #define REG_COMPARE(reg) \
TEST_ASSERT(left->reg == right->reg, \ TEST_ASSERT(left->reg == right->reg, \
"Register " #reg \ "Register " #reg \
" values did not match: 0x%llx, 0x%llx\n", \ " values did not match: 0x%llx, 0x%llx", \
left->reg, right->reg) left->reg, right->reg)
REG_COMPARE(rax); REG_COMPARE(rax);
REG_COMPARE(rbx); REG_COMPARE(rbx);
...@@ -230,14 +230,14 @@ int main(int argc, char *argv[]) ...@@ -230,14 +230,14 @@ int main(int argc, char *argv[])
run->kvm_valid_regs = INVALID_SYNC_FIELD; run->kvm_valid_regs = INVALID_SYNC_FIELD;
rv = _vcpu_run(vcpu); rv = _vcpu_run(vcpu);
TEST_ASSERT(rv < 0 && errno == EINVAL, TEST_ASSERT(rv < 0 && errno == EINVAL,
"Invalid kvm_valid_regs did not cause expected KVM_RUN error: %d\n", "Invalid kvm_valid_regs did not cause expected KVM_RUN error: %d",
rv); rv);
run->kvm_valid_regs = 0; run->kvm_valid_regs = 0;
run->kvm_valid_regs = INVALID_SYNC_FIELD | TEST_SYNC_FIELDS; run->kvm_valid_regs = INVALID_SYNC_FIELD | TEST_SYNC_FIELDS;
rv = _vcpu_run(vcpu); rv = _vcpu_run(vcpu);
TEST_ASSERT(rv < 0 && errno == EINVAL, TEST_ASSERT(rv < 0 && errno == EINVAL,
"Invalid kvm_valid_regs did not cause expected KVM_RUN error: %d\n", "Invalid kvm_valid_regs did not cause expected KVM_RUN error: %d",
rv); rv);
run->kvm_valid_regs = 0; run->kvm_valid_regs = 0;
...@@ -245,14 +245,14 @@ int main(int argc, char *argv[]) ...@@ -245,14 +245,14 @@ int main(int argc, char *argv[])
run->kvm_dirty_regs = INVALID_SYNC_FIELD; run->kvm_dirty_regs = INVALID_SYNC_FIELD;
rv = _vcpu_run(vcpu); rv = _vcpu_run(vcpu);
TEST_ASSERT(rv < 0 && errno == EINVAL, TEST_ASSERT(rv < 0 && errno == EINVAL,
"Invalid kvm_dirty_regs did not cause expected KVM_RUN error: %d\n", "Invalid kvm_dirty_regs did not cause expected KVM_RUN error: %d",
rv); rv);
run->kvm_dirty_regs = 0; run->kvm_dirty_regs = 0;
run->kvm_dirty_regs = INVALID_SYNC_FIELD | TEST_SYNC_FIELDS; run->kvm_dirty_regs = INVALID_SYNC_FIELD | TEST_SYNC_FIELDS;
rv = _vcpu_run(vcpu); rv = _vcpu_run(vcpu);
TEST_ASSERT(rv < 0 && errno == EINVAL, TEST_ASSERT(rv < 0 && errno == EINVAL,
"Invalid kvm_dirty_regs did not cause expected KVM_RUN error: %d\n", "Invalid kvm_dirty_regs did not cause expected KVM_RUN error: %d",
rv); rv);
run->kvm_dirty_regs = 0; run->kvm_dirty_regs = 0;
......
...@@ -143,7 +143,7 @@ static void run_vcpu_expect_gp(struct kvm_vcpu *vcpu) ...@@ -143,7 +143,7 @@ static void run_vcpu_expect_gp(struct kvm_vcpu *vcpu)
TEST_ASSERT_KVM_EXIT_REASON(vcpu, KVM_EXIT_IO); TEST_ASSERT_KVM_EXIT_REASON(vcpu, KVM_EXIT_IO);
TEST_ASSERT(get_ucall(vcpu, &uc) == UCALL_SYNC, TEST_ASSERT(get_ucall(vcpu, &uc) == UCALL_SYNC,
"Expect UCALL_SYNC\n"); "Expect UCALL_SYNC");
TEST_ASSERT(uc.args[1] == SYNC_GP, "#GP is expected."); TEST_ASSERT(uc.args[1] == SYNC_GP, "#GP is expected.");
printf("vCPU received GP in guest.\n"); printf("vCPU received GP in guest.\n");
} }
...@@ -188,7 +188,7 @@ static void *run_ucna_injection(void *arg) ...@@ -188,7 +188,7 @@ static void *run_ucna_injection(void *arg)
TEST_ASSERT_KVM_EXIT_REASON(params->vcpu, KVM_EXIT_IO); TEST_ASSERT_KVM_EXIT_REASON(params->vcpu, KVM_EXIT_IO);
TEST_ASSERT(get_ucall(params->vcpu, &uc) == UCALL_SYNC, TEST_ASSERT(get_ucall(params->vcpu, &uc) == UCALL_SYNC,
"Expect UCALL_SYNC\n"); "Expect UCALL_SYNC");
TEST_ASSERT(uc.args[1] == SYNC_FIRST_UCNA, "Injecting first UCNA."); TEST_ASSERT(uc.args[1] == SYNC_FIRST_UCNA, "Injecting first UCNA.");
printf("Injecting first UCNA at %#x.\n", FIRST_UCNA_ADDR); printf("Injecting first UCNA at %#x.\n", FIRST_UCNA_ADDR);
...@@ -198,7 +198,7 @@ static void *run_ucna_injection(void *arg) ...@@ -198,7 +198,7 @@ static void *run_ucna_injection(void *arg)
TEST_ASSERT_KVM_EXIT_REASON(params->vcpu, KVM_EXIT_IO); TEST_ASSERT_KVM_EXIT_REASON(params->vcpu, KVM_EXIT_IO);
TEST_ASSERT(get_ucall(params->vcpu, &uc) == UCALL_SYNC, TEST_ASSERT(get_ucall(params->vcpu, &uc) == UCALL_SYNC,
"Expect UCALL_SYNC\n"); "Expect UCALL_SYNC");
TEST_ASSERT(uc.args[1] == SYNC_SECOND_UCNA, "Injecting second UCNA."); TEST_ASSERT(uc.args[1] == SYNC_SECOND_UCNA, "Injecting second UCNA.");
printf("Injecting second UCNA at %#x.\n", SECOND_UCNA_ADDR); printf("Injecting second UCNA at %#x.\n", SECOND_UCNA_ADDR);
...@@ -208,7 +208,7 @@ static void *run_ucna_injection(void *arg) ...@@ -208,7 +208,7 @@ static void *run_ucna_injection(void *arg)
TEST_ASSERT_KVM_EXIT_REASON(params->vcpu, KVM_EXIT_IO); TEST_ASSERT_KVM_EXIT_REASON(params->vcpu, KVM_EXIT_IO);
if (get_ucall(params->vcpu, &uc) == UCALL_ABORT) { if (get_ucall(params->vcpu, &uc) == UCALL_ABORT) {
TEST_ASSERT(false, "vCPU assertion failure: %s.\n", TEST_ASSERT(false, "vCPU assertion failure: %s.",
(const char *)uc.args[0]); (const char *)uc.args[0]);
} }
......
...@@ -71,7 +71,7 @@ int main(int argc, char *argv[]) ...@@ -71,7 +71,7 @@ int main(int argc, char *argv[])
break; break;
TEST_ASSERT(run->io.port == 0x80, TEST_ASSERT(run->io.port == 0x80,
"Expected I/O at port 0x80, got port 0x%x\n", run->io.port); "Expected I/O at port 0x80, got port 0x%x", run->io.port);
/* /*
* Modify the rep string count in RCX: 2 => 1 and 3 => 8192. * Modify the rep string count in RCX: 2 => 1 and 3 => 8192.
......
...@@ -99,7 +99,7 @@ int main(int argc, char *argv[]) ...@@ -99,7 +99,7 @@ int main(int argc, char *argv[])
TEST_ASSERT_KVM_EXIT_REASON(vcpu, KVM_EXIT_INTERNAL_ERROR); TEST_ASSERT_KVM_EXIT_REASON(vcpu, KVM_EXIT_INTERNAL_ERROR);
TEST_ASSERT(run->internal.suberror == TEST_ASSERT(run->internal.suberror ==
KVM_INTERNAL_ERROR_EMULATION, KVM_INTERNAL_ERROR_EMULATION,
"Got internal suberror other than KVM_INTERNAL_ERROR_EMULATION: %u\n", "Got internal suberror other than KVM_INTERNAL_ERROR_EMULATION: %u",
run->internal.suberror); run->internal.suberror);
break; break;
} }
......
...@@ -128,17 +128,17 @@ int main(int argc, char *argv[]) ...@@ -128,17 +128,17 @@ int main(int argc, char *argv[])
*/ */
kvm_vm_get_dirty_log(vm, TEST_MEM_SLOT_INDEX, bmap); kvm_vm_get_dirty_log(vm, TEST_MEM_SLOT_INDEX, bmap);
if (uc.args[1]) { if (uc.args[1]) {
TEST_ASSERT(test_bit(0, bmap), "Page 0 incorrectly reported clean\n"); TEST_ASSERT(test_bit(0, bmap), "Page 0 incorrectly reported clean");
TEST_ASSERT(host_test_mem[0] == 1, "Page 0 not written by guest\n"); TEST_ASSERT(host_test_mem[0] == 1, "Page 0 not written by guest");
} else { } else {
TEST_ASSERT(!test_bit(0, bmap), "Page 0 incorrectly reported dirty\n"); TEST_ASSERT(!test_bit(0, bmap), "Page 0 incorrectly reported dirty");
TEST_ASSERT(host_test_mem[0] == 0xaaaaaaaaaaaaaaaaULL, "Page 0 written by guest\n"); TEST_ASSERT(host_test_mem[0] == 0xaaaaaaaaaaaaaaaaULL, "Page 0 written by guest");
} }
TEST_ASSERT(!test_bit(1, bmap), "Page 1 incorrectly reported dirty\n"); TEST_ASSERT(!test_bit(1, bmap), "Page 1 incorrectly reported dirty");
TEST_ASSERT(host_test_mem[4096 / 8] == 0xaaaaaaaaaaaaaaaaULL, "Page 1 written by guest\n"); TEST_ASSERT(host_test_mem[4096 / 8] == 0xaaaaaaaaaaaaaaaaULL, "Page 1 written by guest");
TEST_ASSERT(!test_bit(2, bmap), "Page 2 incorrectly reported dirty\n"); TEST_ASSERT(!test_bit(2, bmap), "Page 2 incorrectly reported dirty");
TEST_ASSERT(host_test_mem[8192 / 8] == 0xaaaaaaaaaaaaaaaaULL, "Page 2 written by guest\n"); TEST_ASSERT(host_test_mem[8192 / 8] == 0xaaaaaaaaaaaaaaaaULL, "Page 2 written by guest");
break; break;
case UCALL_DONE: case UCALL_DONE:
done = true; done = true;
......
...@@ -28,7 +28,7 @@ static void __run_vcpu_with_invalid_state(struct kvm_vcpu *vcpu) ...@@ -28,7 +28,7 @@ static void __run_vcpu_with_invalid_state(struct kvm_vcpu *vcpu)
TEST_ASSERT_KVM_EXIT_REASON(vcpu, KVM_EXIT_INTERNAL_ERROR); TEST_ASSERT_KVM_EXIT_REASON(vcpu, KVM_EXIT_INTERNAL_ERROR);
TEST_ASSERT(run->emulation_failure.suberror == KVM_INTERNAL_ERROR_EMULATION, TEST_ASSERT(run->emulation_failure.suberror == KVM_INTERNAL_ERROR_EMULATION,
"Expected emulation failure, got %d\n", "Expected emulation failure, got %d",
run->emulation_failure.suberror); run->emulation_failure.suberror);
} }
......
...@@ -216,7 +216,7 @@ static void *vcpu_thread(void *arg) ...@@ -216,7 +216,7 @@ static void *vcpu_thread(void *arg)
"Halting vCPU halted %lu times, woke %lu times, received %lu IPIs.\n" "Halting vCPU halted %lu times, woke %lu times, received %lu IPIs.\n"
"Halter TPR=%#x PPR=%#x LVR=%#x\n" "Halter TPR=%#x PPR=%#x LVR=%#x\n"
"Migrations attempted: %lu\n" "Migrations attempted: %lu\n"
"Migrations completed: %lu\n", "Migrations completed: %lu",
vcpu->id, (const char *)uc.args[0], vcpu->id, (const char *)uc.args[0],
params->data->ipis_sent, params->data->hlt_count, params->data->ipis_sent, params->data->hlt_count,
params->data->wake_count, params->data->wake_count,
...@@ -288,7 +288,7 @@ void do_migrations(struct test_data_page *data, int run_secs, int delay_usecs, ...@@ -288,7 +288,7 @@ void do_migrations(struct test_data_page *data, int run_secs, int delay_usecs,
} }
TEST_ASSERT(nodes > 1, TEST_ASSERT(nodes > 1,
"Did not find at least 2 numa nodes. Can't do migration\n"); "Did not find at least 2 numa nodes. Can't do migration");
fprintf(stderr, "Migrating amongst %d nodes found\n", nodes); fprintf(stderr, "Migrating amongst %d nodes found\n", nodes);
...@@ -347,7 +347,7 @@ void do_migrations(struct test_data_page *data, int run_secs, int delay_usecs, ...@@ -347,7 +347,7 @@ void do_migrations(struct test_data_page *data, int run_secs, int delay_usecs,
wake_count != data->wake_count, wake_count != data->wake_count,
"IPI, HLT and wake count have not increased " "IPI, HLT and wake count have not increased "
"in the last %lu seconds. " "in the last %lu seconds. "
"HLTer is likely hung.\n", interval_secs); "HLTer is likely hung.", interval_secs);
ipis_sent = data->ipis_sent; ipis_sent = data->ipis_sent;
hlt_count = data->hlt_count; hlt_count = data->hlt_count;
...@@ -381,7 +381,7 @@ void get_cmdline_args(int argc, char *argv[], int *run_secs, ...@@ -381,7 +381,7 @@ void get_cmdline_args(int argc, char *argv[], int *run_secs,
"-m adds calls to migrate_pages while vCPUs are running." "-m adds calls to migrate_pages while vCPUs are running."
" Default is no migrations.\n" " Default is no migrations.\n"
"-d <delay microseconds> - delay between migrate_pages() calls." "-d <delay microseconds> - delay between migrate_pages() calls."
" Default is %d microseconds.\n", " Default is %d microseconds.",
DEFAULT_RUN_SECS, DEFAULT_DELAY_USECS); DEFAULT_RUN_SECS, DEFAULT_DELAY_USECS);
} }
} }
......
...@@ -116,7 +116,7 @@ int main(int argc, char *argv[]) ...@@ -116,7 +116,7 @@ int main(int argc, char *argv[])
vcpu_run(vcpu); vcpu_run(vcpu);
TEST_ASSERT(run->exit_reason == KVM_EXIT_IO, TEST_ASSERT(run->exit_reason == KVM_EXIT_IO,
"Unexpected exit reason: %u (%s),\n", "Unexpected exit reason: %u (%s),",
run->exit_reason, run->exit_reason,
exit_reason_str(run->exit_reason)); exit_reason_str(run->exit_reason));
......
...@@ -29,7 +29,7 @@ int main(int argc, char *argv[]) ...@@ -29,7 +29,7 @@ int main(int argc, char *argv[])
xss_val = vcpu_get_msr(vcpu, MSR_IA32_XSS); xss_val = vcpu_get_msr(vcpu, MSR_IA32_XSS);
TEST_ASSERT(xss_val == 0, TEST_ASSERT(xss_val == 0,
"MSR_IA32_XSS should be initialized to zero\n"); "MSR_IA32_XSS should be initialized to zero");
vcpu_set_msr(vcpu, MSR_IA32_XSS, xss_val); vcpu_set_msr(vcpu, MSR_IA32_XSS, xss_val);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment