Skip to content

Commit 8bdb0d7

Browse files
mykola-lysenkoKernel Patches Daemon
authored and
Kernel Patches Daemon
committed
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 b47d506 commit 8bdb0d7

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
@@ -271,6 +271,7 @@ static void dump_test_log(const struct prog_test_def *test,
271271
int i;
272272
struct subtest_state *subtest_state;
273273
bool subtest_failed;
274+
bool subtest_filtered;
274275
bool print_subtest;
275276

276277
/* we do not print anything in the worker thread */
@@ -289,9 +290,10 @@ static void dump_test_log(const struct prog_test_def *test,
289290
for (i = 0; i < test_state->subtest_num; i++) {
290291
subtest_state = &test_state->subtest_states[i];
291292
subtest_failed = subtest_state->error_cnt;
293+
subtest_filtered = subtest_state->filtered;
292294
print_subtest = verbose() || force_log || subtest_failed;
293295

294-
if (skip_ok_subtests && !subtest_failed)
296+
if ((skip_ok_subtests && !subtest_failed) || subtest_filtered)
295297
continue;
296298

297299
if (subtest_state->log_cnt && print_subtest) {
@@ -423,7 +425,7 @@ bool test__start_subtest(const char *subtest_name)
423425
state->subtest_num,
424426
test->test_name,
425427
subtest_name)) {
426-
subtest_state->skipped = true;
428+
subtest_state->filtered = true;
427429
return false;
428430
}
429431

@@ -1129,6 +1131,7 @@ static int dispatch_thread_send_subtests(int sock_fd, struct test_state *state)
11291131
subtest_state->name = strdup(msg.subtest_done.name);
11301132
subtest_state->error_cnt = msg.subtest_done.error_cnt;
11311133
subtest_state->skipped = msg.subtest_done.skipped;
1134+
subtest_state->filtered = msg.subtest_done.filtered;
11321135

11331136
/* collect all logs */
11341137
if (msg.subtest_done.have_log)
@@ -1424,6 +1427,7 @@ static int worker_main_send_subtests(int sock, struct test_state *state)
14241427

14251428
msg.subtest_done.error_cnt = subtest_state->error_cnt;
14261429
msg.subtest_done.skipped = subtest_state->skipped;
1430+
msg.subtest_done.filtered = subtest_state->filtered;
14271431
msg.subtest_done.have_log = false;
14281432

14291433
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)