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

selftests/bpf: Add test result messages for test_task_storage_map_stress_lookup

Add test result message when test_task_storage_map_stress_lookup()
succeeds or is skipped. The test case can be skipped due to the choose
of preemption model in kernel config, so export skips in test_maps.c and
increase it when needed.

The following is the output of test_maps when the test case succeeds or
is skipped:

test_task_storage_map_stress_lookup:PASS
test_maps: OK, 0 SKIPPED

test_task_storage_map_stress_lookup SKIP (no CONFIG_PREEMPT)
test_maps: OK, 1 SKIPPED

Fixes: 73b97bc78b32 ("selftests/bpf: Test concurrent updates on bpf_task_storage_busy")
Signed-off-by: Hou Tao <houtao1@huawei.com>
Link: https://lore.kernel.org/r/20220919035714.2195144-1-houtao@huaweicloud.com
Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>

authored by

Hou Tao and committed by
Martin KaFai Lau
a7e85406 571f9738

+8 -2
+5 -1
tools/testing/selftests/bpf/map_tests/task_storage_map.c
··· 77 77 CHECK(err, "open_and_load", "error %d\n", err); 78 78 79 79 /* Only for a fully preemptible kernel */ 80 - if (!skel->kconfig->CONFIG_PREEMPT) 80 + if (!skel->kconfig->CONFIG_PREEMPT) { 81 + printf("%s SKIP (no CONFIG_PREEMPT)\n", __func__); 82 + skips++; 81 83 return; 84 + } 82 85 83 86 /* Save the old affinity setting */ 84 87 sched_getaffinity(getpid(), sizeof(old), &old); ··· 122 119 read_bpf_task_storage_busy__destroy(skel); 123 120 /* Restore affinity setting */ 124 121 sched_setaffinity(getpid(), sizeof(old), &old); 122 + printf("%s:PASS\n", __func__); 125 123 }
+1 -1
tools/testing/selftests/bpf/test_maps.c
··· 30 30 #define ENOTSUPP 524 31 31 #endif 32 32 33 - static int skips; 33 + int skips; 34 34 35 35 static struct bpf_map_create_opts map_opts = { .sz = sizeof(map_opts) }; 36 36
+2
tools/testing/selftests/bpf/test_maps.h
··· 14 14 } \ 15 15 }) 16 16 17 + extern int skips; 18 + 17 19 #endif