Commit b0472ac8 authored by Ben Walker's avatar Ben Walker Committed by Tomasz Zawadzki
Browse files

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: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/475312


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
parent f56f15cc
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -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);