[PATCH 1/2] tests/sctp: fix a race condition in the new ASCONF test

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The new ASCONF test introduced recently (see Fixes: tag) is unstable and
can randomly fail on slow machines. The problem seems to be triggered
when the server does the sctp_bindx() calls before the client starts
listening for a new message, so add a 1 second sleep before the bindx
calls.

It is possible that this delay will not be enough on some very slow
machines, but let's start with a small value and see how it goes. The
one second seems to be enough for the Travis CI at least.

Fixes: 841ccaabb366 ("selinux-testsuite: Update SCTP asconf client/server")
Signed-off-by: Ondrej Mosnacek <omosnace@xxxxxxxxxx>
---
 tests/sctp/sctp_asconf_params_server.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/tests/sctp/sctp_asconf_params_server.c b/tests/sctp/sctp_asconf_params_server.c
index 18e2cb2..ded782e 100644
--- a/tests/sctp/sctp_asconf_params_server.c
+++ b/tests/sctp/sctp_asconf_params_server.c
@@ -225,6 +225,13 @@ int main(int argc, char **argv)
 		       ((struct sockaddr_in6 *)
 			new_pri_addr_res->ai_addr)->sin6_scope_id);
 
+	/*
+	 * We can't do the sctp_bindx() calls too fast, otherwise the test
+	 * that checks if these are denied would fail. Therefore, sleep for
+	 * a bit to allow the client to catch up.
+	 */
+	sleep(1);
+
 	/*
 	 * Now call sctp_bindx(3) to add 'new_pri_addr'. This uses Dynamic
 	 * Address Reconfiguration by sending an asconf chunk with
-- 
2.26.2




[Index of Archives]     [Selinux Refpolicy]     [Linux SGX]     [Fedora Users]     [Fedora Desktop]     [Yosemite Photos]     [Yosemite Camping]     [Yosemite Campsites]     [KDE Users]     [Gnome Users]

  Powered by Linux