Commit a7e85406 authored by Hou Tao's avatar Hou Tao Committed by Martin KaFai Lau

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: 73b97bc7 ("selftests/bpf: Test concurrent updates on bpf_task_storage_busy")
Signed-off-by: default avatarHou Tao <houtao1@huawei.com>
Link: https://lore.kernel.org/r/20220919035714.2195144-1-houtao@huaweicloud.comSigned-off-by: default avatarMartin KaFai Lau <martin.lau@kernel.org>
parent 571f9738
...@@ -77,8 +77,11 @@ void test_task_storage_map_stress_lookup(void) ...@@ -77,8 +77,11 @@ void test_task_storage_map_stress_lookup(void)
CHECK(err, "open_and_load", "error %d\n", err); CHECK(err, "open_and_load", "error %d\n", err);
/* Only for a fully preemptible kernel */ /* Only for a fully preemptible kernel */
if (!skel->kconfig->CONFIG_PREEMPT) if (!skel->kconfig->CONFIG_PREEMPT) {
printf("%s SKIP (no CONFIG_PREEMPT)\n", __func__);
skips++;
return; return;
}
/* Save the old affinity setting */ /* Save the old affinity setting */
sched_getaffinity(getpid(), sizeof(old), &old); sched_getaffinity(getpid(), sizeof(old), &old);
...@@ -119,4 +122,5 @@ void test_task_storage_map_stress_lookup(void) ...@@ -119,4 +122,5 @@ void test_task_storage_map_stress_lookup(void)
read_bpf_task_storage_busy__destroy(skel); read_bpf_task_storage_busy__destroy(skel);
/* Restore affinity setting */ /* Restore affinity setting */
sched_setaffinity(getpid(), sizeof(old), &old); sched_setaffinity(getpid(), sizeof(old), &old);
printf("%s:PASS\n", __func__);
} }
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
#define ENOTSUPP 524 #define ENOTSUPP 524
#endif #endif
static int skips; int skips;
static struct bpf_map_create_opts map_opts = { .sz = sizeof(map_opts) }; static struct bpf_map_create_opts map_opts = { .sz = sizeof(map_opts) };
......
...@@ -14,4 +14,6 @@ ...@@ -14,4 +14,6 @@
} \ } \
}) })
extern int skips;
#endif #endif
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