Skip to content

Commit a4fc828

Browse files
mykola-lysenkoKernel Patches Daemon
authored andcommitted
selftests/bpf: remove filtered subtests from output
Currently filtered subtests show up in the output as skipped. Before: $ sudo ./test_progs -t log_fixup/missing_map #94 /1 log_fixup/bad_core_relo_trunc_none:SKIP #94 /2 log_fixup/bad_core_relo_trunc_partial:SKIP #94 /3 log_fixup/bad_core_relo_trunc_full:SKIP #94 /4 log_fixup/bad_core_relo_subprog:SKIP #94 /5 log_fixup/missing_map:OK #94 log_fixup:OK Summary: 1/1 PASSED, 0 SKIPPED, 0 FAILED After: $ sudo ./test_progs -t log_fixup/missing_map #94 /5 log_fixup/missing_map:OK #94 log_fixup:OK Summary: 1/1 PASSED, 0 SKIPPED, 0 FAILED Signed-off-by: Mykola Lysenko <[email protected]> Acked-by: Yonghong Song <[email protected]>
1 parent 07d1791 commit a4fc828

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

tools/testing/selftests/bpf/test_progs.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,7 @@ static void dump_test_log(const struct prog_test_def *test,
265265
int i;
266266
struct subtest_state *subtest_state;
267267
bool subtest_failed;
268+
bool subtest_filtered;
268269
bool print_subtest;
269270

270271
/* we do not print anything in the worker thread */
@@ -283,9 +284,10 @@ static void dump_test_log(const struct prog_test_def *test,
283284
for (i = 0; i < test_state->subtest_num; i++) {
284285
subtest_state = &test_state->subtest_states[i];
285286
subtest_failed = subtest_state->error_cnt;
287+
subtest_filtered = subtest_state->filtered;
286288
print_subtest = verbose() || force_log || subtest_failed;
287289

288-
if (skip_ok_subtests && !subtest_failed)
290+
if ((skip_ok_subtests && !subtest_failed) || subtest_filtered)
289291
continue;
290292

291293
if (subtest_state->log_cnt && print_subtest) {
@@ -417,7 +419,7 @@ bool test__start_subtest(const char *subtest_name)
417419
state->subtest_num,
418420
test->test_name,
419421
subtest_name)) {
420-
subtest_state->skipped = true;
422+
subtest_state->filtered = true;
421423
return false;
422424
}
423425

@@ -1123,6 +1125,7 @@ static int dispatch_thread_send_subtests(int sock_fd, struct test_state *state)
11231125
subtest_state->name = strdup(msg.subtest_done.name);
11241126
subtest_state->error_cnt = msg.subtest_done.error_cnt;
11251127
subtest_state->skipped = msg.subtest_done.skipped;
1128+
subtest_state->filtered = msg.subtest_done.filtered;
11261129

11271130
/* collect all logs */
11281131
if (msg.subtest_done.have_log)
@@ -1418,6 +1421,7 @@ static int worker_main_send_subtests(int sock, struct test_state *state)
14181421

14191422
msg.subtest_done.error_cnt = subtest_state->error_cnt;
14201423
msg.subtest_done.skipped = subtest_state->skipped;
1424+
msg.subtest_done.filtered = subtest_state->filtered;
14211425
msg.subtest_done.have_log = false;
14221426

14231427
if (verbose() || state->force_log || subtest_state->error_cnt) {

tools/testing/selftests/bpf/test_progs.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ struct subtest_state {
7070
char *log_buf;
7171
int error_cnt;
7272
bool skipped;
73+
bool filtered;
7374

7475
FILE *stdout;
7576
};
@@ -156,6 +157,7 @@ struct msg {
156157
char name[MAX_SUBTEST_NAME + 1];
157158
int error_cnt;
158159
bool skipped;
160+
bool filtered;
159161
bool have_log;
160162
} subtest_done;
161163
};

0 commit comments

Comments
 (0)