Thread (15 messages) 15 messages, 4 authors, 2021-09-15

Re: [PATCH bpf-next] selftests/bpf: reduce more flakyness in sockmap_listen

From: Alexei Starovoitov <hidden>
Date: 2021-08-26 01:04:56

On Wed, Aug 25, 2021 at 2:07 PM Yucong Sun [off-list ref] wrote:
quoted hunk ↗ jump to hunk
This patch adds similar retry logic to more places where read() is used, to
reduce flakyness in slow CI environment.

Signed-off-by: Yucong Sun <redacted>
---
 .../selftests/bpf/prog_tests/sockmap_listen.c | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)
diff --git a/tools/testing/selftests/bpf/prog_tests/sockmap_listen.c b/tools/testing/selftests/bpf/prog_tests/sockmap_listen.c
index 6a5df28f9a3d..5c5979046523 100644
--- a/tools/testing/selftests/bpf/prog_tests/sockmap_listen.c
+++ b/tools/testing/selftests/bpf/prog_tests/sockmap_listen.c
@@ -949,6 +949,7 @@ static void redir_to_connected(int family, int sotype, int sock_mapfd,
        int err, n;
        u32 key;
        char b;
+       int retries = 100;

        zero_verdict_count(verd_mapfd);
@@ -1001,10 +1002,15 @@ static void redir_to_connected(int family, int sotype, int sock_mapfd,
                goto close_peer1;
        if (pass != 1)
                FAIL("%s: want pass count 1, have %d", log_prefix, pass);
-
+again:
        n = read(c0, &b, 1);
-       if (n < 0)
+       if (n < 0) {
+               if (errno == EAGAIN && retries--) {
TCP was fixed differently in
commit 30b4cb36b111 ("selftests/bpf: Fix spurious failures in accept
due to EAGAIN").
Would a similar approach work here?
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help