aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/bpf/progs/test_tcpbpf_kern.c
diff options
context:
space:
mode:
authorStanislav Fomichev <[email protected]>2019-12-04 19:09:55 +0000
committerAlexei Starovoitov <[email protected]>2019-12-05 02:01:05 +0000
commitef8c84effce3c7a0b8196fcda8f430c815ab511c (patch)
tree10cc86cc9c2f54f8bf93c7e8f6da1ccfafa6c719 /tools/testing/selftests/bpf/progs/test_tcpbpf_kern.c
parentselftests/bpf: Bring back c++ include/link test (diff)
downloadkernel-ef8c84effce3c7a0b8196fcda8f430c815ab511c.tar.gz
kernel-ef8c84effce3c7a0b8196fcda8f430c815ab511c.zip
selftests/bpf: De-flake test_tcpbpf
It looks like BPF program that handles BPF_SOCK_OPS_STATE_CB state can race with the bpf_map_lookup_elem("global_map"); I sometimes see the failures in this test and re-running helps. Since we know that we expect the callback to be called 3 times (one time for listener socket, two times for both ends of the connection), let's export this number and add simple retry logic around that. Also, let's make EXPECT_EQ() not return on failure, but continue evaluating all conditions; that should make potential debugging easier. With this fix in place I don't observe the flakiness anymore. Signed-off-by: Stanislav Fomichev <[email protected]> Signed-off-by: Alexei Starovoitov <[email protected]> Cc: Lawrence Brakmo <[email protected]> Link: https://lore.kernel.org/bpf/[email protected]
Diffstat (limited to 'tools/testing/selftests/bpf/progs/test_tcpbpf_kern.c')
-rw-r--r--tools/testing/selftests/bpf/progs/test_tcpbpf_kern.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/tools/testing/selftests/bpf/progs/test_tcpbpf_kern.c b/tools/testing/selftests/bpf/progs/test_tcpbpf_kern.c
index 2e233613d1fc..7fa4595d2b66 100644
--- a/tools/testing/selftests/bpf/progs/test_tcpbpf_kern.c
+++ b/tools/testing/selftests/bpf/progs/test_tcpbpf_kern.c
@@ -131,6 +131,7 @@ int bpf_testcb(struct bpf_sock_ops *skops)
g.bytes_received = skops->bytes_received;
g.bytes_acked = skops->bytes_acked;
}
+ g.num_close_events++;
bpf_map_update_elem(&global_map, &key, &g,
BPF_ANY);
}