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

Configure Feed

Select the types of activity you want to include in your feed.

lib/test_vmalloc.c: introduce xfail for failing tests

The test align_shift_alloc_test is expected to fail. Reporting the test
as fail confuses to be a genuine failure. Introduce widely used xfail
sematics to address the issue.

Note: a warn_alloc dump similar to below is still expected:

Call Trace:
<TASK>
dump_stack_lvl+0x64/0x80
warn_alloc+0x137/0x1b0
? __get_vm_area_node+0x134/0x140

Snippet of dmesg after change:

Summary: random_size_align_alloc_test passed: 1 failed: 0 xfailed: 0 ..
Summary: align_shift_alloc_test passed: 0 failed: 0 xfailed: 1 ..
Summary: pcpu_alloc_test passed: 1 failed: 0 xfailed: 0 ..

Link: https://lkml.kernel.org/r/20250702064319.885-1-raghavendra.kt@amd.com
Signed-off-by: Raghavendra K T <raghavendra.kt@amd.com>
Reviewed-by: "Uladzislau Rezki (Sony)" <urezki@gmail.com>
Cc: Dev Jain <dev.jain@arm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Raghavendra K T and committed by
Andrew Morton
ee58e384 9640b17a

+21 -15
+21 -15
lib/test_vmalloc.c
··· 396 396 struct test_case_desc { 397 397 const char *test_name; 398 398 int (*test_func)(void); 399 + bool xfail; 399 400 }; 400 401 401 402 static struct test_case_desc test_case_array[] = { 402 - { "fix_size_alloc_test", fix_size_alloc_test }, 403 - { "full_fit_alloc_test", full_fit_alloc_test }, 404 - { "long_busy_list_alloc_test", long_busy_list_alloc_test }, 405 - { "random_size_alloc_test", random_size_alloc_test }, 406 - { "fix_align_alloc_test", fix_align_alloc_test }, 407 - { "random_size_align_alloc_test", random_size_align_alloc_test }, 408 - { "align_shift_alloc_test", align_shift_alloc_test }, 409 - { "pcpu_alloc_test", pcpu_alloc_test }, 410 - { "kvfree_rcu_1_arg_vmalloc_test", kvfree_rcu_1_arg_vmalloc_test }, 411 - { "kvfree_rcu_2_arg_vmalloc_test", kvfree_rcu_2_arg_vmalloc_test }, 412 - { "vm_map_ram_test", vm_map_ram_test }, 403 + { "fix_size_alloc_test", fix_size_alloc_test, }, 404 + { "full_fit_alloc_test", full_fit_alloc_test, }, 405 + { "long_busy_list_alloc_test", long_busy_list_alloc_test, }, 406 + { "random_size_alloc_test", random_size_alloc_test, }, 407 + { "fix_align_alloc_test", fix_align_alloc_test, }, 408 + { "random_size_align_alloc_test", random_size_align_alloc_test, }, 409 + { "align_shift_alloc_test", align_shift_alloc_test, true }, 410 + { "pcpu_alloc_test", pcpu_alloc_test, }, 411 + { "kvfree_rcu_1_arg_vmalloc_test", kvfree_rcu_1_arg_vmalloc_test, }, 412 + { "kvfree_rcu_2_arg_vmalloc_test", kvfree_rcu_2_arg_vmalloc_test, }, 413 + { "vm_map_ram_test", vm_map_ram_test, }, 413 414 /* Add a new test case here. */ 414 415 }; 415 416 416 417 struct test_case_data { 417 418 int test_failed; 419 + int test_xfailed; 418 420 int test_passed; 419 421 u64 time; 420 422 }; ··· 446 444 { 447 445 struct test_driver *t = private; 448 446 int random_array[ARRAY_SIZE(test_case_array)]; 449 - int index, i, j; 447 + int index, i, j, ret; 450 448 ktime_t kt; 451 449 u64 delta; 452 450 ··· 470 468 */ 471 469 if (!((run_test_mask & (1 << index)) >> index)) 472 470 continue; 473 - 474 471 kt = ktime_get(); 475 472 for (j = 0; j < test_repeat_count; j++) { 476 - if (!test_case_array[index].test_func()) 473 + ret = test_case_array[index].test_func(); 474 + 475 + if (!ret && !test_case_array[index].xfail) 477 476 t->data[index].test_passed++; 477 + else if (ret && test_case_array[index].xfail) 478 + t->data[index].test_xfailed++; 478 479 else 479 480 t->data[index].test_failed++; 480 481 } ··· 581 576 continue; 582 577 583 578 pr_info( 584 - "Summary: %s passed: %d failed: %d repeat: %d loops: %d avg: %llu usec\n", 579 + "Summary: %s passed: %d failed: %d xfailed: %d repeat: %d loops: %d avg: %llu usec\n", 585 580 test_case_array[j].test_name, 586 581 t->data[j].test_passed, 587 582 t->data[j].test_failed, 583 + t->data[j].test_xfailed, 588 584 test_repeat_count, test_loop_count, 589 585 t->data[j].time); 590 586 }