From 2b209e3ee05ec719f566f1d071a82f4e3c6a9417 Mon Sep 17 00:00:00 2001 From: Florin Coras Date: Wed, 14 Nov 2018 09:32:07 -0800 Subject: [PATCH] session: fix endpt cfg test (VPP-1492) Change-Id: I0f2266c4727a96b6410a3084dc079bae7bc649ab Signed-off-by: Florin Coras --- src/plugins/unittest/session_test.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/plugins/unittest/session_test.c b/src/plugins/unittest/session_test.c index 5c2993e3322..182a8e806ea 100644 --- a/src/plugins/unittest/session_test.c +++ b/src/plugins/unittest/session_test.c @@ -18,6 +18,7 @@ #include #include #include +#include #define SESSION_TEST_I(_cond, _comment, _args...) \ ({ \ @@ -268,10 +269,10 @@ static int session_test_endpoint_cfg (vlib_main_t * vm, unformat_input_t * input) { session_endpoint_cfg_t client_sep = SESSION_ENDPOINT_CFG_NULL; + u32 server_index, client_index, sw_if_index[2], tries = 0; u64 options[APP_OPTIONS_N_OPTIONS], dummy_secret = 1234; u16 dummy_server_port = 1234, dummy_client_port = 5678; session_endpoint_t server_sep = SESSION_ENDPOINT_NULL; - u32 server_index, client_index, sw_if_index[2]; ip4_address_t intf_addr[3]; transport_connection_t *tc; stream_session_t *s; @@ -361,13 +362,20 @@ session_test_endpoint_cfg (vlib_main_t * vm, unformat_input_t * input) .app_index = client_index, }; + connected_session_index = connected_session_thread = ~0; + accepted_session_index = accepted_session_thread = ~0; error = vnet_connect (&connect_args); SESSION_TEST ((error == 0), "connect should work"); /* wait for stuff to happen */ - vlib_process_suspend (vm, 10e-3); - + while ((connected_session_index == ~0 + || vec_len (tcp_main.wrk_ctx[0].pending_acks)) && ++tries < 100) + vlib_process_suspend (vm, 100e-3); + clib_warning ("waited %.1f seconds for connections", tries / 10.0); SESSION_TEST ((connected_session_index != ~0), "session should exist"); + SESSION_TEST ((connected_session_thread != ~0), "thread should exist"); + SESSION_TEST ((accepted_session_index != ~0), "session should exist"); + SESSION_TEST ((accepted_session_thread != ~0), "thread should exist"); s = session_get (connected_session_index, connected_session_thread); tc = session_get_transport (s); SESSION_TEST ((tc != 0), "transport should exist"); -- 2.16.6