Skip to content

Commit 1cf6e3b

Browse files
committed
Test
Signed-off-by: Paul Chaignon <[email protected]>
1 parent 3033be1 commit 1cf6e3b

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

tools/testing/selftests/bpf/test_loader.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1147,6 +1147,7 @@ void run_subtest(struct test_loader *tester,
11471147
int retval, err, i;
11481148
int links_cnt = 0;
11491149
bool should_load;
1150+
int linear_sz;
11501151

11511152
if (!test__start_subtest(subspec->name))
11521153
return;
@@ -1292,9 +1293,21 @@ void run_subtest(struct test_loader *tester,
12921293
}
12931294
}
12941295

1296+
switch (bpf_program__type(tprog)) {
1297+
case BPF_PROG_TYPE_SOCKET_FILTER:
1298+
case BPF_PROG_TYPE_CGROUP_SKB:
1299+
case BPF_PROG_TYPE_SCHED_CLS:
1300+
case BPF_PROG_TYPE_SCHED_ACT:
1301+
linear_sz = TEST_DATA_LEN - 1;
1302+
break;
1303+
default:
1304+
linear_sz = spec->linear_sz;
1305+
break;
1306+
}
1307+
12951308
err = do_prog_test_run(bpf_program__fd(tprog), &retval,
12961309
bpf_program__type(tprog) == BPF_PROG_TYPE_SYSCALL ? true : false,
1297-
spec->linear_sz);
1310+
linear_sz);
12981311
if (!err && retval != subspec->retval && subspec->retval != POINTER_VALUE) {
12991312
PRINT_FAIL("Unexpected retval: %d != %d\n", retval, subspec->retval);
13001313
goto tobj_cleanup;

0 commit comments

Comments
 (0)