From 8eb09e6c541881a9eff7ebe4358463f4d3b10a83 Mon Sep 17 00:00:00 2001 From: Benedict Wong Date: Wed, 31 Oct 2018 17:52:14 -0700 Subject: Use blocking sockets with timeout for xfrm_tunnel_test Using non-blocking sockets appears to be causing flakiness due to the tests racing against the kernel's crypto/networking infrastructure. This commit allows these sockets to block for up to 500ms to allow time for the crypto and routing to complete before throwing errors. Bug: 118753529 Test: Run 20x locally, via QEMU; passing. Change-Id: I92a39f8890244ebe918f48bcf0971e85795b2a1e Merged-In: I92a39f8890244ebe918f48bcf0971e85795b2a1e --- net/test/xfrm_tunnel_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/test/xfrm_tunnel_test.py b/net/test/xfrm_tunnel_test.py index 5f243cc..20a8584 100755 --- a/net/test/xfrm_tunnel_test.py +++ b/net/test/xfrm_tunnel_test.py @@ -109,7 +109,7 @@ def _CreateReceiveSock(version, port=0): # The second parameter of the tuple is the port number regardless of AF. local_port = read_sock.getsockname()[1] # Guard against the eventuality of the receive failing. - net_test.SetNonBlocking(read_sock.fileno()) + csocket.SetSocketTimeout(read_sock, 500) return read_sock, local_port -- cgit v1.2.3