From b0472ac8538a8f3d922aa91346e3b39b04341ba5 Mon Sep 17 00:00:00 2001 From: Ben Walker Date: Wed, 20 Nov 2019 13:33:37 -0700 Subject: [PATCH] test/sock: Limit sleep to only FreeBSD There is a sleep in a test to allow a socket close to propagate through the kernel stack. This is only required on FreeBSD, so limit it's use to FreeBSD. This results in slightly faster unit test run times on Linux. Change-Id: I495d8b91e7247d0757650c4993d18f707c524a22 Signed-off-by: Ben Walker Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/475312 Tested-by: SPDK CI Jenkins Reviewed-by: Jim Harris Reviewed-by: Shuhei Matsumoto --- test/unit/lib/sock/sock.c/sock_ut.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/unit/lib/sock/sock.c/sock_ut.c b/test/unit/lib/sock/sock.c/sock_ut.c index 366723a867..4309264d97 100644 --- a/test/unit/lib/sock/sock.c/sock_ut.c +++ b/test/unit/lib/sock/sock.c/sock_ut.c @@ -435,9 +435,11 @@ _sock(const char *ip, int port) CU_ASSERT(client_sock == NULL); CU_ASSERT(rc == 0); +#if defined(__FreeBSD__) /* On FreeBSD, it takes a small amount of time for a close to propagate to the * other side, even in loopback. Introduce a small sleep. */ sleep(1); +#endif CU_ASSERT(spdk_sock_is_connected(server_sock) == false); rc = spdk_sock_close(&server_sock);