Skip to content

Commit aa468a3

Browse files
yonghong-songKernel Patches Daemon
authored and
Kernel Patches Daemon
committed
selftests/bpf: Avoid skipping certain subtests
Commit 704c91e ('selftests/bpf: Test "bpftool gen min_core_btf"') added a test test_core_btfgen to test core relocation with btf generated with 'bpftool gen min_core_btf'. Currently, among 76 subtests, 25 are skipped. ... #46/69 core_reloc_btfgen/enumval:OK #46/70 core_reloc_btfgen/enumval___diff:OK #46/71 core_reloc_btfgen/enumval___val3_missing:OK #46/72 core_reloc_btfgen/enumval___err_missing:SKIP #46/73 core_reloc_btfgen/enum64val:OK #46/74 core_reloc_btfgen/enum64val___diff:OK #46/75 core_reloc_btfgen/enum64val___val3_missing:OK #46/76 core_reloc_btfgen/enum64val___err_missing:SKIP ... #46 core_reloc_btfgen:SKIP Summary: 1/51 PASSED, 25 SKIPPED, 0 FAILED Alexei found that in the above core_reloc_btfgen/enum64val___err_missing should not be skipped. Currently, the core_reloc tests have some negative tests. In Commit 704c91e, for core_reloc_btfgen, all negative tests are skipped with the following condition if (!test_case->btf_src_file || test_case->fails) { test__skip(); continue; } This is too conservative. Negative tests do not fail mkstemp() and run_btfgen() should not be skipped. There are a few negative tests indeed failing run_btfgen() and this patch added 'run_btfgen_fails' to mark these tests so that they can be skipped for btfgen tests. With this, we have ... #46/69 core_reloc_btfgen/enumval:OK #46/70 core_reloc_btfgen/enumval___diff:OK #46/71 core_reloc_btfgen/enumval___val3_missing:OK #46/72 core_reloc_btfgen/enumval___err_missing:OK #46/73 core_reloc_btfgen/enum64val:OK #46/74 core_reloc_btfgen/enum64val___diff:OK #46/75 core_reloc_btfgen/enum64val___val3_missing:OK #46/76 core_reloc_btfgen/enum64val___err_missing:OK ... Summary: 1/62 PASSED, 14 SKIPPED, 0 FAILED Totally 14 subtests are skipped instead of 25. Reported-by: Alexei Starovoitov <[email protected]> Signed-off-by: Yonghong Song <[email protected]>
1 parent 2ae74a8 commit aa468a3

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

tools/testing/selftests/bpf/prog_tests/core_reloc.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ static int duration = 0;
8484
#define NESTING_ERR_CASE(name) { \
8585
NESTING_CASE_COMMON(name), \
8686
.fails = true, \
87+
.run_btfgen_fails = true, \
8788
}
8889

8990
#define ARRAYS_DATA(struct_name) STRUCT_TO_CHAR_PTR(struct_name) { \
@@ -258,12 +259,14 @@ static int duration = 0;
258259
BITFIELDS_CASE_COMMON("test_core_reloc_bitfields_probed.o", \
259260
"probed:", name), \
260261
.fails = true, \
262+
.run_btfgen_fails = true, \
261263
.raw_tp_name = "sys_enter", \
262264
.prog_name = "test_core_bitfields", \
263265
}, { \
264266
BITFIELDS_CASE_COMMON("test_core_reloc_bitfields_direct.o", \
265267
"direct:", name), \
266268
.fails = true, \
269+
.run_btfgen_fails = true, \
267270
.prog_name = "test_core_bitfields_direct", \
268271
}
269272

@@ -304,6 +307,7 @@ static int duration = 0;
304307
#define SIZE_ERR_CASE(name) { \
305308
SIZE_CASE_COMMON(name), \
306309
.fails = true, \
310+
.run_btfgen_fails = true, \
307311
}
308312

309313
#define TYPE_BASED_CASE_COMMON(name) \
@@ -396,6 +400,7 @@ struct core_reloc_test_case {
396400
const char *output;
397401
int output_len;
398402
bool fails;
403+
bool run_btfgen_fails;
399404
bool needs_testmod;
400405
bool relaxed_core_relocs;
401406
const char *prog_name;
@@ -952,7 +957,7 @@ static void run_core_reloc_tests(bool use_btfgen)
952957
/* generate a "minimal" BTF file and use it as source */
953958
if (use_btfgen) {
954959

955-
if (!test_case->btf_src_file || test_case->fails) {
960+
if (!test_case->btf_src_file || test_case->run_btfgen_fails) {
956961
test__skip();
957962
continue;
958963
}

0 commit comments

Comments
 (0)