Skip to content

Commit 65612e9

Browse files
jones-drewsean-jc
authored andcommitted
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: Andrew 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: Sean Christopherson <seanjc@google.com>
1 parent a38125f commit 65612e9

22 files changed

+63
-63
lines changed

tools/testing/selftests/kvm/lib/x86_64/processor.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -170,10 +170,10 @@ static uint64_t *virt_create_upper_pte(struct kvm_vm *vm,
170170
* this level.
171171
*/
172172
TEST_ASSERT(current_level != target_level,
173-
"Cannot create hugepage at level: %u, vaddr: 0x%lx\n",
173+
"Cannot create hugepage at level: %u, vaddr: 0x%lx",
174174
current_level, vaddr);
175175
TEST_ASSERT(!(*pte & PTE_LARGE_MASK),
176-
"Cannot create page table at level: %u, vaddr: 0x%lx\n",
176+
"Cannot create page table at level: %u, vaddr: 0x%lx",
177177
current_level, vaddr);
178178
}
179179
return pte;
@@ -220,7 +220,7 @@ void __virt_pg_map(struct kvm_vm *vm, uint64_t vaddr, uint64_t paddr, int level)
220220
/* Fill in page table entry. */
221221
pte = virt_get_pte(vm, pde, vaddr, PG_LEVEL_4K);
222222
TEST_ASSERT(!(*pte & PTE_PRESENT_MASK),
223-
"PTE already present for 4k page at vaddr: 0x%lx\n", vaddr);
223+
"PTE already present for 4k page at vaddr: 0x%lx", vaddr);
224224
*pte = PTE_PRESENT_MASK | PTE_WRITABLE_MASK | (paddr & PHYSICAL_PAGE_MASK);
225225
}
226226

@@ -253,7 +253,7 @@ static bool vm_is_target_pte(uint64_t *pte, int *level, int current_level)
253253
if (*pte & PTE_LARGE_MASK) {
254254
TEST_ASSERT(*level == PG_LEVEL_NONE ||
255255
*level == current_level,
256-
"Unexpected hugepage at level %d\n", current_level);
256+
"Unexpected hugepage at level %d", current_level);
257257
*level = current_level;
258258
}
259259

@@ -825,7 +825,7 @@ void vcpu_args_set(struct kvm_vcpu *vcpu, unsigned int num, ...)
825825
struct kvm_regs regs;
826826

827827
TEST_ASSERT(num >= 1 && num <= 6, "Unsupported number of args,\n"
828-
" num: %u\n",
828+
" num: %u",
829829
num);
830830

831831
va_start(ap, num);

tools/testing/selftests/kvm/lib/x86_64/vmx.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ int vcpu_enable_evmcs(struct kvm_vcpu *vcpu)
5454
/* KVM should return supported EVMCS version range */
5555
TEST_ASSERT(((evmcs_ver >> 8) >= (evmcs_ver & 0xff)) &&
5656
(evmcs_ver & 0xff) > 0,
57-
"Incorrect EVMCS version range: %x:%x\n",
57+
"Incorrect EVMCS version range: %x:%x",
5858
evmcs_ver & 0xff, evmcs_ver >> 8);
5959

6060
return evmcs_ver;
@@ -387,10 +387,10 @@ static void nested_create_pte(struct kvm_vm *vm,
387387
* this level.
388388
*/
389389
TEST_ASSERT(current_level != target_level,
390-
"Cannot create hugepage at level: %u, nested_paddr: 0x%lx\n",
390+
"Cannot create hugepage at level: %u, nested_paddr: 0x%lx",
391391
current_level, nested_paddr);
392392
TEST_ASSERT(!pte->page_size,
393-
"Cannot create page table at level: %u, nested_paddr: 0x%lx\n",
393+
"Cannot create page table at level: %u, nested_paddr: 0x%lx",
394394
current_level, nested_paddr);
395395
}
396396
}

tools/testing/selftests/kvm/x86_64/amx_test.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ int main(int argc, char *argv[])
296296
void *tiles_data = (void *)addr_gva2hva(vm, tiledata);
297297
/* Only check TMM0 register, 1 tile */
298298
ret = memcmp(amx_start, tiles_data, TILE_SIZE);
299-
TEST_ASSERT(ret == 0, "memcmp failed, ret=%d\n", ret);
299+
TEST_ASSERT(ret == 0, "memcmp failed, ret=%d", ret);
300300
kvm_x86_state_cleanup(state);
301301
break;
302302
case 9:

tools/testing/selftests/kvm/x86_64/cpuid_test.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ static void compare_cpuids(const struct kvm_cpuid2 *cpuid1,
8484

8585
TEST_ASSERT(e1->function == e2->function &&
8686
e1->index == e2->index && e1->flags == e2->flags,
87-
"CPUID entries[%d] mismtach: 0x%x.%d.%x vs. 0x%x.%d.%x\n",
87+
"CPUID entries[%d] mismtach: 0x%x.%d.%x vs. 0x%x.%d.%x",
8888
i, e1->function, e1->index, e1->flags,
8989
e2->function, e2->index, e2->flags);
9090

@@ -170,7 +170,7 @@ static void test_get_cpuid2(struct kvm_vcpu *vcpu)
170170

171171
vcpu_ioctl(vcpu, KVM_GET_CPUID2, cpuid);
172172
TEST_ASSERT(cpuid->nent == vcpu->cpuid->nent,
173-
"KVM didn't update nent on success, wanted %u, got %u\n",
173+
"KVM didn't update nent on success, wanted %u, got %u",
174174
vcpu->cpuid->nent, cpuid->nent);
175175

176176
for (i = 0; i < vcpu->cpuid->nent; i++) {

tools/testing/selftests/kvm/x86_64/flds_emulation.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ static inline void handle_flds_emulation_failure_exit(struct kvm_vcpu *vcpu)
4141

4242
insn_bytes = run->emulation_failure.insn_bytes;
4343
TEST_ASSERT(insn_bytes[0] == 0xd9 && insn_bytes[1] == 0,
44-
"Expected 'flds [eax]', opcode '0xd9 0x00', got opcode 0x%02x 0x%02x\n",
44+
"Expected 'flds [eax]', opcode '0xd9 0x00', got opcode 0x%02x 0x%02x",
4545
insn_bytes[0], insn_bytes[1]);
4646

4747
vcpu_regs_get(vcpu, &regs);

tools/testing/selftests/kvm/x86_64/hyperv_clock.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ int main(void)
220220
tsc_page_gva = vm_vaddr_alloc_page(vm);
221221
memset(addr_gva2hva(vm, tsc_page_gva), 0x0, getpagesize());
222222
TEST_ASSERT((addr_gva2gpa(vm, tsc_page_gva) & (getpagesize() - 1)) == 0,
223-
"TSC page has to be page aligned\n");
223+
"TSC page has to be page aligned");
224224
vcpu_args_set(vcpu, 2, tsc_page_gva, addr_gva2gpa(vm, tsc_page_gva));
225225

226226
host_check_tsc_msr_rdtsc(vcpu);
@@ -237,7 +237,7 @@ int main(void)
237237
break;
238238
case UCALL_DONE:
239239
/* Keep in sync with guest_main() */
240-
TEST_ASSERT(stage == 11, "Testing ended prematurely, stage %d\n",
240+
TEST_ASSERT(stage == 11, "Testing ended prematurely, stage %d",
241241
stage);
242242
goto out;
243243
default:

tools/testing/selftests/kvm/x86_64/hyperv_ipi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ int main(int argc, char *argv[])
289289
switch (get_ucall(vcpu[0], &uc)) {
290290
case UCALL_SYNC:
291291
TEST_ASSERT(uc.args[1] == stage,
292-
"Unexpected stage: %ld (%d expected)\n",
292+
"Unexpected stage: %ld (%d expected)",
293293
uc.args[1], stage);
294294
break;
295295
case UCALL_DONE:

tools/testing/selftests/kvm/x86_64/hyperv_tlb_flush.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -658,7 +658,7 @@ int main(int argc, char *argv[])
658658
switch (get_ucall(vcpu[0], &uc)) {
659659
case UCALL_SYNC:
660660
TEST_ASSERT(uc.args[1] == stage,
661-
"Unexpected stage: %ld (%d expected)\n",
661+
"Unexpected stage: %ld (%d expected)",
662662
uc.args[1], stage);
663663
break;
664664
case UCALL_ABORT:

tools/testing/selftests/kvm/x86_64/kvm_clock_test.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ static void setup_clock(struct kvm_vm *vm, struct test_case *test_case)
9292
break;
9393
} while (errno == EINTR);
9494

95-
TEST_ASSERT(!r, "clock_gettime() failed: %d\n", r);
95+
TEST_ASSERT(!r, "clock_gettime() failed: %d", r);
9696

9797
data.realtime = ts.tv_sec * NSEC_PER_SEC;
9898
data.realtime += ts.tv_nsec;
@@ -127,7 +127,7 @@ static void enter_guest(struct kvm_vcpu *vcpu)
127127
handle_abort(&uc);
128128
return;
129129
default:
130-
TEST_ASSERT(0, "unhandled ucall: %ld\n", uc.cmd);
130+
TEST_ASSERT(0, "unhandled ucall: %ld", uc.cmd);
131131
}
132132
}
133133
}
@@ -154,7 +154,7 @@ static void check_clocksource(void)
154154
}
155155

156156
clk_name = malloc(st.st_size);
157-
TEST_ASSERT(clk_name, "failed to allocate buffer to read file\n");
157+
TEST_ASSERT(clk_name, "failed to allocate buffer to read file");
158158

159159
if (!fgets(clk_name, st.st_size, fp)) {
160160
pr_info("failed to read clocksource file: %d; assuming TSC.\n",

tools/testing/selftests/kvm/x86_64/platform_info_test.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ static void test_msr_platform_info_enabled(struct kvm_vcpu *vcpu)
4444

4545
get_ucall(vcpu, &uc);
4646
TEST_ASSERT(uc.cmd == UCALL_SYNC,
47-
"Received ucall other than UCALL_SYNC: %lu\n", uc.cmd);
47+
"Received ucall other than UCALL_SYNC: %lu", uc.cmd);
4848
TEST_ASSERT((uc.args[1] & MSR_PLATFORM_INFO_MAX_TURBO_RATIO) ==
4949
MSR_PLATFORM_INFO_MAX_TURBO_RATIO,
5050
"Expected MSR_PLATFORM_INFO to have max turbo ratio mask: %i.",

0 commit comments

Comments
 (0)