apps/examples/usrsocktest: Fix nxstyle issue
This commit is contained in:
parent
f29c0dabd4
commit
eaeceb516b
@ -77,7 +77,7 @@ static int sd;
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: Setup
|
* Name: setup
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Run before every testcase
|
* Run before every testcase
|
||||||
@ -93,7 +93,7 @@ static int sd;
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static void Setup(FAR struct usrsocktest_daemon_conf_s *dconf)
|
static void setup(FAR struct usrsocktest_daemon_conf_s *dconf)
|
||||||
{
|
{
|
||||||
dconf->endpoint_addr = "127.0.0.1";
|
dconf->endpoint_addr = "127.0.0.1";
|
||||||
dconf->endpoint_port = 255;
|
dconf->endpoint_port = 255;
|
||||||
@ -123,7 +123,7 @@ static void Setup(FAR struct usrsocktest_daemon_conf_s *dconf)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static void Teardown(void)
|
static void teardown(void)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
@ -141,7 +141,7 @@ static void Teardown(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: NotConnected
|
* Name: not_connected
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Opened socket is not connected
|
* Opened socket is not connected
|
||||||
@ -157,13 +157,13 @@ static void Teardown(void)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static void NotConnected(void)
|
static void not_connected(void)
|
||||||
{
|
{
|
||||||
TEST_ASSERT_EQUAL(0, usrsocktest_daemon_get_num_connected_sockets());
|
TEST_ASSERT_EQUAL(0, usrsocktest_daemon_get_num_connected_sockets());
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: Connect
|
* Name: basic_connect_connect
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Open and connect the socket
|
* Open and connect the socket
|
||||||
@ -179,7 +179,7 @@ static void NotConnected(void)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static void Connect(void)
|
static void basic_connect_connect(void)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
struct sockaddr_in addr;
|
struct sockaddr_in addr;
|
||||||
@ -232,7 +232,7 @@ static void Connect(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: WrongAF
|
* Name: wrong_af
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Open and connect the socket with wrong AF
|
* Open and connect the socket with wrong AF
|
||||||
@ -248,7 +248,7 @@ static void Connect(void)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static void WrongAF(void)
|
static void wrong_af(void)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
struct sockaddr_in addr;
|
struct sockaddr_in addr;
|
||||||
@ -282,7 +282,7 @@ static void WrongAF(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: WrongPort
|
* Name: wrong_port
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Open and connect the socket with wrong port
|
* Open and connect the socket with wrong port
|
||||||
@ -298,7 +298,7 @@ static void WrongAF(void)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static void WrongPort(void)
|
static void wrong_port(void)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
struct sockaddr_in addr;
|
struct sockaddr_in addr;
|
||||||
@ -332,7 +332,7 @@ static void WrongPort(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: WrongEndpoint
|
* Name: wrong_endpoint
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Open and connect the socket with wrong endpoint
|
* Open and connect the socket with wrong endpoint
|
||||||
@ -348,7 +348,7 @@ static void WrongPort(void)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static void WrongEndpoint(void)
|
static void wrong_endpoint(void)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
struct sockaddr_in addr;
|
struct sockaddr_in addr;
|
||||||
@ -391,97 +391,97 @@ static void WrongEndpoint(void)
|
|||||||
TEST_ASSERT_EQUAL(0, usrsocktest_dcmd_malloc_cnt);
|
TEST_ASSERT_EQUAL(0, usrsocktest_dcmd_malloc_cnt);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_SETUP(BasicConnect)
|
TEST_SETUP(basic_connect)
|
||||||
{
|
{
|
||||||
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
||||||
Setup(&usrsocktest_daemon_config);
|
setup(&usrsocktest_daemon_config);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_TEAR_DOWN(BasicConnect)
|
TEST_TEAR_DOWN(basic_connect)
|
||||||
{
|
{
|
||||||
Teardown();
|
teardown();
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(BasicConnect, NotConnected)
|
TEST(basic_connect, not_connected)
|
||||||
{
|
{
|
||||||
NotConnected();
|
not_connected();
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(BasicConnect, Connect)
|
TEST(basic_connect, basic_connect_connect)
|
||||||
{
|
{
|
||||||
Connect();
|
basic_connect_connect();
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(BasicConnect, WrongAF)
|
TEST(basic_connect, wrong_af)
|
||||||
{
|
{
|
||||||
WrongAF();
|
wrong_af();
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(BasicConnect, WrongPort)
|
TEST(basic_connect, wrong_port)
|
||||||
{
|
{
|
||||||
WrongPort();
|
wrong_port();
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(BasicConnect, WrongEndpoint)
|
TEST(basic_connect, wrong_endpoint)
|
||||||
{
|
{
|
||||||
WrongEndpoint();
|
wrong_endpoint();
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_SETUP(BasicConnectDelay)
|
TEST_SETUP(basic_connect_delay)
|
||||||
{
|
{
|
||||||
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
||||||
usrsocktest_daemon_config.delay_all_responses = true;
|
usrsocktest_daemon_config.delay_all_responses = true;
|
||||||
Setup(&usrsocktest_daemon_config);
|
setup(&usrsocktest_daemon_config);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_TEAR_DOWN(BasicConnectDelay)
|
TEST_TEAR_DOWN(basic_connect_delay)
|
||||||
{
|
{
|
||||||
Teardown();
|
teardown();
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(BasicConnectDelay, NotConnected)
|
TEST(basic_connect_delay, not_connected)
|
||||||
{
|
{
|
||||||
NotConnected();
|
not_connected();
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(BasicConnectDelay, Connect)
|
TEST(basic_connect_delay, basic_connect_connect)
|
||||||
{
|
{
|
||||||
Connect();
|
basic_connect_connect();
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(BasicConnectDelay, WrongAF)
|
TEST(basic_connect_delay, wrong_af)
|
||||||
{
|
{
|
||||||
WrongAF();
|
wrong_af();
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(BasicConnectDelay, WrongPort)
|
TEST(basic_connect_delay, wrong_port)
|
||||||
{
|
{
|
||||||
WrongPort();
|
wrong_port();
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(BasicConnectDelay, WrongEndpoint)
|
TEST(basic_connect_delay, wrong_endpoint)
|
||||||
{
|
{
|
||||||
WrongEndpoint();
|
wrong_endpoint();
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
TEST_GROUP(BasicConnect)
|
TEST_GROUP(basic_connect)
|
||||||
{
|
{
|
||||||
RUN_TEST_CASE(BasicConnect, NotConnected);
|
RUN_TEST_CASE(basic_connect, not_connected);
|
||||||
RUN_TEST_CASE(BasicConnect, Connect);
|
RUN_TEST_CASE(basic_connect, basic_connect_connect);
|
||||||
RUN_TEST_CASE(BasicConnect, WrongAF);
|
RUN_TEST_CASE(basic_connect, wrong_af);
|
||||||
RUN_TEST_CASE(BasicConnect, WrongPort);
|
RUN_TEST_CASE(basic_connect, wrong_port);
|
||||||
RUN_TEST_CASE(BasicConnect, WrongEndpoint);
|
RUN_TEST_CASE(basic_connect, wrong_endpoint);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_GROUP(BasicConnectDelay)
|
TEST_GROUP(basic_connect_delay)
|
||||||
{
|
{
|
||||||
RUN_TEST_CASE(BasicConnectDelay, NotConnected);
|
RUN_TEST_CASE(basic_connect_delay, not_connected);
|
||||||
RUN_TEST_CASE(BasicConnectDelay, Connect);
|
RUN_TEST_CASE(basic_connect_delay, basic_connect_connect);
|
||||||
RUN_TEST_CASE(BasicConnectDelay, WrongAF);
|
RUN_TEST_CASE(basic_connect_delay, wrong_af);
|
||||||
RUN_TEST_CASE(BasicConnectDelay, WrongPort);
|
RUN_TEST_CASE(basic_connect_delay, wrong_port);
|
||||||
RUN_TEST_CASE(BasicConnectDelay, WrongEndpoint);
|
RUN_TEST_CASE(basic_connect_delay, wrong_endpoint);
|
||||||
}
|
}
|
||||||
|
@ -67,7 +67,9 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static bool started;
|
static bool started;
|
||||||
static int sd, sd2, sd3;
|
static int sd;
|
||||||
|
static int sd2;
|
||||||
|
static int sd3;
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Data
|
* Public Data
|
||||||
@ -78,7 +80,7 @@ static int sd, sd2, sd3;
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: NoActiveSockets
|
* Name: no_active_sockets
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Checks there is no active sockets on daemon startup
|
* Checks there is no active sockets on daemon startup
|
||||||
@ -94,7 +96,7 @@ static int sd, sd2, sd3;
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static void NoActiveSockets(FAR struct usrsocktest_daemon_conf_s *dconf)
|
static void no_active_sockets(FAR struct usrsocktest_daemon_conf_s *dconf)
|
||||||
{
|
{
|
||||||
TEST_ASSERT_EQUAL(OK, usrsocktest_daemon_start(dconf));
|
TEST_ASSERT_EQUAL(OK, usrsocktest_daemon_start(dconf));
|
||||||
started = true;
|
started = true;
|
||||||
@ -103,7 +105,7 @@ static void NoActiveSockets(FAR struct usrsocktest_daemon_conf_s *dconf)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: OpenClose
|
* Name: open_close
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Open and close AF_INET socket, check active socket counter updates
|
* Open and close AF_INET socket, check active socket counter updates
|
||||||
@ -119,7 +121,7 @@ static void NoActiveSockets(FAR struct usrsocktest_daemon_conf_s *dconf)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static void OpenClose(FAR struct usrsocktest_daemon_conf_s *dconf)
|
static void open_close(FAR struct usrsocktest_daemon_conf_s *dconf)
|
||||||
{
|
{
|
||||||
TEST_ASSERT_EQUAL(OK, usrsocktest_daemon_start(dconf));
|
TEST_ASSERT_EQUAL(OK, usrsocktest_daemon_start(dconf));
|
||||||
started = true;
|
started = true;
|
||||||
@ -139,7 +141,7 @@ static void OpenClose(FAR struct usrsocktest_daemon_conf_s *dconf)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: UnsupportedType
|
* Name: unsupported_type
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Try open socket for unsupported type
|
* Try open socket for unsupported type
|
||||||
@ -155,7 +157,7 @@ static void OpenClose(FAR struct usrsocktest_daemon_conf_s *dconf)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static void UnsupportedType(FAR struct usrsocktest_daemon_conf_s *dconf)
|
static void unsupported_type(FAR struct usrsocktest_daemon_conf_s *dconf)
|
||||||
{
|
{
|
||||||
TEST_ASSERT_EQUAL(OK, usrsocktest_daemon_start(dconf));
|
TEST_ASSERT_EQUAL(OK, usrsocktest_daemon_start(dconf));
|
||||||
started = true;
|
started = true;
|
||||||
@ -172,7 +174,7 @@ static void UnsupportedType(FAR struct usrsocktest_daemon_conf_s *dconf)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: UnsupportedProto
|
* Name: unsupported_proto
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Try open socket for unsupported protocol
|
* Try open socket for unsupported protocol
|
||||||
@ -188,7 +190,7 @@ static void UnsupportedType(FAR struct usrsocktest_daemon_conf_s *dconf)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static void UnsupportedProto(FAR struct usrsocktest_daemon_conf_s *dconf)
|
static void unsupported_proto(FAR struct usrsocktest_daemon_conf_s *dconf)
|
||||||
{
|
{
|
||||||
TEST_ASSERT_EQUAL(OK, usrsocktest_daemon_start(dconf));
|
TEST_ASSERT_EQUAL(OK, usrsocktest_daemon_start(dconf));
|
||||||
started = true;
|
started = true;
|
||||||
@ -205,7 +207,7 @@ static void UnsupportedProto(FAR struct usrsocktest_daemon_conf_s *dconf)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: OpenThree
|
* Name: open_three
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Open multiple sockets
|
* Open multiple sockets
|
||||||
@ -221,7 +223,7 @@ static void UnsupportedProto(FAR struct usrsocktest_daemon_conf_s *dconf)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static void OpenThree(FAR struct usrsocktest_daemon_conf_s *dconf)
|
static void open_three(FAR struct usrsocktest_daemon_conf_s *dconf)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
@ -262,10 +264,10 @@ static void OpenThree(FAR struct usrsocktest_daemon_conf_s *dconf)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: Dup
|
* Name: basic_daemon_dup
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Dup opened socket
|
* basic_daemon_dup opened socket
|
||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* None
|
* None
|
||||||
@ -278,7 +280,7 @@ static void OpenThree(FAR struct usrsocktest_daemon_conf_s *dconf)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static void Dup(FAR struct usrsocktest_daemon_conf_s *dconf)
|
static void basic_daemon_dup(FAR struct usrsocktest_daemon_conf_s *dconf)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
@ -317,7 +319,7 @@ static void Dup(FAR struct usrsocktest_daemon_conf_s *dconf)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: Dup2
|
* Name: basic_daemon_dup2
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Clone opened socket with dup2
|
* Clone opened socket with dup2
|
||||||
@ -333,7 +335,7 @@ static void Dup(FAR struct usrsocktest_daemon_conf_s *dconf)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static void Dup2(FAR struct usrsocktest_daemon_conf_s *dconf)
|
static void basic_daemon_dup2(FAR struct usrsocktest_daemon_conf_s *dconf)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
@ -367,7 +369,7 @@ static void Dup2(FAR struct usrsocktest_daemon_conf_s *dconf)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: Stops
|
* Name: stops
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Daemon stops unexpectedly
|
* Daemon stops unexpectedly
|
||||||
@ -383,7 +385,7 @@ static void Dup2(FAR struct usrsocktest_daemon_conf_s *dconf)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static void Stops(FAR struct usrsocktest_daemon_conf_s *dconf)
|
static void stops(FAR struct usrsocktest_daemon_conf_s *dconf)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
@ -404,7 +406,6 @@ static void Stops(FAR struct usrsocktest_daemon_conf_s *dconf)
|
|||||||
TEST_ASSERT_EQUAL(0, usrsocktest_endp_malloc_cnt);
|
TEST_ASSERT_EQUAL(0, usrsocktest_endp_malloc_cnt);
|
||||||
TEST_ASSERT_EQUAL(0, usrsocktest_dcmd_malloc_cnt);
|
TEST_ASSERT_EQUAL(0, usrsocktest_dcmd_malloc_cnt);
|
||||||
|
|
||||||
|
|
||||||
TEST_ASSERT_EQUAL(0, close(sd));
|
TEST_ASSERT_EQUAL(0, close(sd));
|
||||||
sd = -1;
|
sd = -1;
|
||||||
TEST_ASSERT_EQUAL(0, close(sd2));
|
TEST_ASSERT_EQUAL(0, close(sd2));
|
||||||
@ -412,7 +413,7 @@ static void Stops(FAR struct usrsocktest_daemon_conf_s *dconf)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: StopsStarts
|
* Name: stops_starts
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Daemon stops and restarts unexpectedly
|
* Daemon stops and restarts unexpectedly
|
||||||
@ -428,7 +429,7 @@ static void Stops(FAR struct usrsocktest_daemon_conf_s *dconf)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static void StopsStarts(FAR struct usrsocktest_daemon_conf_s *dconf)
|
static void stops_starts(FAR struct usrsocktest_daemon_conf_s *dconf)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
struct sockaddr_in addr;
|
struct sockaddr_in addr;
|
||||||
@ -475,7 +476,7 @@ static void StopsStarts(FAR struct usrsocktest_daemon_conf_s *dconf)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: BasicDaemon test group setup
|
* Name: basic_daemon test group setup
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Setup function executed before each testcase in this test group
|
* Setup function executed before each testcase in this test group
|
||||||
@ -491,7 +492,7 @@ static void StopsStarts(FAR struct usrsocktest_daemon_conf_s *dconf)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
TEST_SETUP(BasicDaemon)
|
TEST_SETUP(basic_daemon)
|
||||||
{
|
{
|
||||||
sd = -1;
|
sd = -1;
|
||||||
sd2 = -1;
|
sd2 = -1;
|
||||||
@ -500,7 +501,7 @@ TEST_SETUP(BasicDaemon)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: BasicDaemon test group teardown
|
* Name: basic_daemon test group teardown
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Setup function executed after each testcase in this test group
|
* Setup function executed after each testcase in this test group
|
||||||
@ -516,7 +517,7 @@ TEST_SETUP(BasicDaemon)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
TEST_TEAR_DOWN(BasicDaemon)
|
TEST_TEAR_DOWN(basic_daemon)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
if (sd >= 0)
|
if (sd >= 0)
|
||||||
@ -524,16 +525,19 @@ TEST_TEAR_DOWN(BasicDaemon)
|
|||||||
ret = close(sd);
|
ret = close(sd);
|
||||||
assert(ret >= 0);
|
assert(ret >= 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sd2 >= 0)
|
if (sd2 >= 0)
|
||||||
{
|
{
|
||||||
ret = close(sd2);
|
ret = close(sd2);
|
||||||
assert(ret >= 0);
|
assert(ret >= 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sd3 >= 0)
|
if (sd3 >= 0)
|
||||||
{
|
{
|
||||||
ret = close(sd3);
|
ret = close(sd3);
|
||||||
assert(ret >= 0);
|
assert(ret >= 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (started)
|
if (started)
|
||||||
{
|
{
|
||||||
ret = usrsocktest_daemon_stop();
|
ret = usrsocktest_daemon_stop();
|
||||||
@ -541,145 +545,145 @@ TEST_TEAR_DOWN(BasicDaemon)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(BasicDaemon, NoActiveSockets)
|
TEST(basic_daemon, no_active_sockets)
|
||||||
{
|
{
|
||||||
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
||||||
NoActiveSockets(&usrsocktest_daemon_config);
|
no_active_sockets(&usrsocktest_daemon_config);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(BasicDaemon, NoActiveSocketsDelay)
|
TEST(basic_daemon, no_active_sockets_delay)
|
||||||
{
|
{
|
||||||
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
||||||
usrsocktest_daemon_config.delay_all_responses = true;
|
usrsocktest_daemon_config.delay_all_responses = true;
|
||||||
NoActiveSockets(&usrsocktest_daemon_config);
|
no_active_sockets(&usrsocktest_daemon_config);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(BasicDaemon, OpenClose)
|
TEST(basic_daemon, open_close)
|
||||||
{
|
{
|
||||||
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
||||||
OpenClose(&usrsocktest_daemon_config);
|
open_close(&usrsocktest_daemon_config);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(BasicDaemon, OpenCloseDelay)
|
TEST(basic_daemon, open_close_delay)
|
||||||
{
|
{
|
||||||
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
||||||
usrsocktest_daemon_config.delay_all_responses = true;
|
usrsocktest_daemon_config.delay_all_responses = true;
|
||||||
OpenClose(&usrsocktest_daemon_config);
|
open_close(&usrsocktest_daemon_config);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(BasicDaemon, UnsupportedType)
|
TEST(basic_daemon, unsupported_type)
|
||||||
{
|
{
|
||||||
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
||||||
UnsupportedType(&usrsocktest_daemon_config);
|
unsupported_type(&usrsocktest_daemon_config);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(BasicDaemon, UnsupportedTypeDelay)
|
TEST(basic_daemon, unsupported_type_delay)
|
||||||
{
|
{
|
||||||
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
||||||
usrsocktest_daemon_config.delay_all_responses = true;
|
usrsocktest_daemon_config.delay_all_responses = true;
|
||||||
UnsupportedType(&usrsocktest_daemon_config);
|
unsupported_type(&usrsocktest_daemon_config);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(BasicDaemon, UnsupportedProto)
|
TEST(basic_daemon, unsupported_proto)
|
||||||
{
|
{
|
||||||
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
||||||
UnsupportedProto(&usrsocktest_daemon_config);
|
unsupported_proto(&usrsocktest_daemon_config);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(BasicDaemon, UnsupportedProtoDelay)
|
TEST(basic_daemon, unsupported_proto_delay)
|
||||||
{
|
{
|
||||||
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
||||||
usrsocktest_daemon_config.delay_all_responses = true;
|
usrsocktest_daemon_config.delay_all_responses = true;
|
||||||
UnsupportedProto(&usrsocktest_daemon_config);
|
unsupported_proto(&usrsocktest_daemon_config);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(BasicDaemon, OpenThree)
|
TEST(basic_daemon, open_three)
|
||||||
{
|
{
|
||||||
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
||||||
OpenThree(&usrsocktest_daemon_config);
|
open_three(&usrsocktest_daemon_config);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(BasicDaemon, OpenThreeDelay)
|
TEST(basic_daemon, open_three_delay)
|
||||||
{
|
{
|
||||||
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
||||||
usrsocktest_daemon_config.delay_all_responses = true;
|
usrsocktest_daemon_config.delay_all_responses = true;
|
||||||
OpenThree(&usrsocktest_daemon_config);
|
open_three(&usrsocktest_daemon_config);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(BasicDaemon, Dup)
|
TEST(basic_daemon, basic_daemon_dup)
|
||||||
{
|
{
|
||||||
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
||||||
Dup(&usrsocktest_daemon_config);
|
basic_daemon_dup(&usrsocktest_daemon_config);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(BasicDaemon, DupDelay)
|
TEST(basic_daemon, basic_daemon_dup_delay)
|
||||||
{
|
{
|
||||||
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
||||||
usrsocktest_daemon_config.delay_all_responses = true;
|
usrsocktest_daemon_config.delay_all_responses = true;
|
||||||
Dup(&usrsocktest_daemon_config);
|
basic_daemon_dup(&usrsocktest_daemon_config);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(BasicDaemon, Dup2)
|
TEST(basic_daemon, basic_daemon_dup2)
|
||||||
{
|
{
|
||||||
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
||||||
Dup2(&usrsocktest_daemon_config);
|
basic_daemon_dup2(&usrsocktest_daemon_config);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(BasicDaemon, Dup2Delay)
|
TEST(basic_daemon, basic_daemon_dup2_delay)
|
||||||
{
|
{
|
||||||
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
||||||
usrsocktest_daemon_config.delay_all_responses = true;
|
usrsocktest_daemon_config.delay_all_responses = true;
|
||||||
Dup2(&usrsocktest_daemon_config);
|
basic_daemon_dup2(&usrsocktest_daemon_config);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(BasicDaemon, Stops)
|
TEST(basic_daemon, stops)
|
||||||
{
|
{
|
||||||
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
||||||
Stops(&usrsocktest_daemon_config);
|
stops(&usrsocktest_daemon_config);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(BasicDaemon, StopsDelay)
|
TEST(basic_daemon, stops_delay)
|
||||||
{
|
{
|
||||||
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
||||||
usrsocktest_daemon_config.delay_all_responses = true;
|
usrsocktest_daemon_config.delay_all_responses = true;
|
||||||
Stops(&usrsocktest_daemon_config);
|
stops(&usrsocktest_daemon_config);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(BasicDaemon, StopsStarts)
|
TEST(basic_daemon, stops_starts)
|
||||||
{
|
{
|
||||||
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
||||||
StopsStarts(&usrsocktest_daemon_config);
|
stops_starts(&usrsocktest_daemon_config);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(BasicDaemon, StopsStartsDelay)
|
TEST(basic_daemon, stops_starts_delay)
|
||||||
{
|
{
|
||||||
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
||||||
usrsocktest_daemon_config.delay_all_responses = true;
|
usrsocktest_daemon_config.delay_all_responses = true;
|
||||||
StopsStarts(&usrsocktest_daemon_config);
|
stops_starts(&usrsocktest_daemon_config);
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
TEST_GROUP(BasicDaemon)
|
TEST_GROUP(basic_daemon)
|
||||||
{
|
{
|
||||||
RUN_TEST_CASE(BasicDaemon, NoActiveSockets);
|
RUN_TEST_CASE(basic_daemon, no_active_sockets);
|
||||||
RUN_TEST_CASE(BasicDaemon, NoActiveSocketsDelay);
|
RUN_TEST_CASE(basic_daemon, no_active_sockets_delay);
|
||||||
RUN_TEST_CASE(BasicDaemon, OpenClose);
|
RUN_TEST_CASE(basic_daemon, open_close);
|
||||||
RUN_TEST_CASE(BasicDaemon, OpenCloseDelay);
|
RUN_TEST_CASE(basic_daemon, open_close_delay);
|
||||||
RUN_TEST_CASE(BasicDaemon, UnsupportedType);
|
RUN_TEST_CASE(basic_daemon, unsupported_type);
|
||||||
RUN_TEST_CASE(BasicDaemon, UnsupportedTypeDelay);
|
RUN_TEST_CASE(basic_daemon, unsupported_type_delay);
|
||||||
RUN_TEST_CASE(BasicDaemon, UnsupportedProto);
|
RUN_TEST_CASE(basic_daemon, unsupported_proto);
|
||||||
RUN_TEST_CASE(BasicDaemon, UnsupportedProtoDelay);
|
RUN_TEST_CASE(basic_daemon, unsupported_proto_delay);
|
||||||
RUN_TEST_CASE(BasicDaemon, OpenThree);
|
RUN_TEST_CASE(basic_daemon, open_three);
|
||||||
RUN_TEST_CASE(BasicDaemon, OpenThreeDelay);
|
RUN_TEST_CASE(basic_daemon, open_three_delay);
|
||||||
RUN_TEST_CASE(BasicDaemon, Dup);
|
RUN_TEST_CASE(basic_daemon, basic_daemon_dup);
|
||||||
RUN_TEST_CASE(BasicDaemon, DupDelay);
|
RUN_TEST_CASE(basic_daemon, basic_daemon_dup_delay);
|
||||||
RUN_TEST_CASE(BasicDaemon, Dup2);
|
RUN_TEST_CASE(basic_daemon, basic_daemon_dup2);
|
||||||
RUN_TEST_CASE(BasicDaemon, Dup2Delay);
|
RUN_TEST_CASE(basic_daemon, basic_daemon_dup2_delay);
|
||||||
RUN_TEST_CASE(BasicDaemon, Stops);
|
RUN_TEST_CASE(basic_daemon, stops);
|
||||||
RUN_TEST_CASE(BasicDaemon, StopsDelay);
|
RUN_TEST_CASE(basic_daemon, stops_delay);
|
||||||
RUN_TEST_CASE(BasicDaemon, StopsStarts);
|
RUN_TEST_CASE(basic_daemon, stops_starts);
|
||||||
RUN_TEST_CASE(BasicDaemon, StopsStartsDelay);
|
RUN_TEST_CASE(basic_daemon, stops_starts_delay);
|
||||||
}
|
}
|
||||||
|
@ -78,7 +78,7 @@ static int sd;
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: Open
|
* Name: basic_getsockname_open
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Open and get socket options
|
* Open and get socket options
|
||||||
@ -94,7 +94,8 @@ static int sd;
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static void Open(FAR struct usrsocktest_daemon_conf_s *dconf)
|
static
|
||||||
|
void basic_getsockname_open(FAR struct usrsocktest_daemon_conf_s *dconf)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
socklen_t addrlen;
|
socklen_t addrlen;
|
||||||
@ -209,7 +210,7 @@ static void Open(FAR struct usrsocktest_daemon_conf_s *dconf)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: BasicGetSockName test group setup
|
* Name: basic_getsockname test group setup
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Setup function executed before each testcase in this test group
|
* Setup function executed before each testcase in this test group
|
||||||
@ -225,14 +226,14 @@ static void Open(FAR struct usrsocktest_daemon_conf_s *dconf)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
TEST_SETUP(BasicGetSockName)
|
TEST_SETUP(basic_getsockname)
|
||||||
{
|
{
|
||||||
sd = -1;
|
sd = -1;
|
||||||
started = false;
|
started = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: BasicGetSockName test group teardown
|
* Name: basic_getsockname test group teardown
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Setup function executed after each testcase in this test group
|
* Setup function executed after each testcase in this test group
|
||||||
@ -248,7 +249,7 @@ TEST_SETUP(BasicGetSockName)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
TEST_TEAR_DOWN(BasicGetSockName)
|
TEST_TEAR_DOWN(basic_getsockname)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
if (sd >= 0)
|
if (sd >= 0)
|
||||||
@ -256,6 +257,7 @@ TEST_TEAR_DOWN(BasicGetSockName)
|
|||||||
ret = close(sd);
|
ret = close(sd);
|
||||||
assert(ret >= 0);
|
assert(ret >= 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (started)
|
if (started)
|
||||||
{
|
{
|
||||||
ret = usrsocktest_daemon_stop();
|
ret = usrsocktest_daemon_stop();
|
||||||
@ -263,25 +265,25 @@ TEST_TEAR_DOWN(BasicGetSockName)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(BasicGetSockName, Open)
|
TEST(basic_getsockname, basic_getsockname_open)
|
||||||
{
|
{
|
||||||
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
||||||
Open(&usrsocktest_daemon_config);
|
basic_getsockname_open(&usrsocktest_daemon_config);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(BasicGetSockName, OpenDelay)
|
TEST(basic_getsockname, basic_getsockname_open_delay)
|
||||||
{
|
{
|
||||||
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
||||||
usrsocktest_daemon_config.delay_all_responses = true;
|
usrsocktest_daemon_config.delay_all_responses = true;
|
||||||
Open(&usrsocktest_daemon_config);
|
basic_getsockname_open(&usrsocktest_daemon_config);
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
TEST_GROUP(BasicGetSockName)
|
TEST_GROUP(basic_getsockname)
|
||||||
{
|
{
|
||||||
RUN_TEST_CASE(BasicGetSockName, Open);
|
RUN_TEST_CASE(basic_getsockname, basic_getsockname_open);
|
||||||
RUN_TEST_CASE(BasicGetSockName, OpenDelay);
|
RUN_TEST_CASE(basic_getsockname, basic_getsockname_open_delay);
|
||||||
}
|
}
|
||||||
|
@ -75,7 +75,7 @@ static int sd;
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: Open
|
* Name: basic_getsockopt_open
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Open and get socket options
|
* Open and get socket options
|
||||||
@ -91,7 +91,8 @@ static int sd;
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static void Open(FAR struct usrsocktest_daemon_conf_s *dconf)
|
static
|
||||||
|
void basic_getsockopt_open(FAR struct usrsocktest_daemon_conf_s *dconf)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
int value;
|
int value;
|
||||||
@ -188,7 +189,7 @@ static void Open(FAR struct usrsocktest_daemon_conf_s *dconf)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: BasicGetSockOpt test group setup
|
* Name: basic_getsockopt test group setup
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Setup function executed before each testcase in this test group
|
* Setup function executed before each testcase in this test group
|
||||||
@ -204,14 +205,14 @@ static void Open(FAR struct usrsocktest_daemon_conf_s *dconf)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
TEST_SETUP(BasicGetSockOpt)
|
TEST_SETUP(basic_getsockopt)
|
||||||
{
|
{
|
||||||
sd = -1;
|
sd = -1;
|
||||||
started = false;
|
started = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: BasicGetSockOpt test group teardown
|
* Name: basic_getsockopt test group teardown
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Setup function executed after each testcase in this test group
|
* Setup function executed after each testcase in this test group
|
||||||
@ -227,7 +228,7 @@ TEST_SETUP(BasicGetSockOpt)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
TEST_TEAR_DOWN(BasicGetSockOpt)
|
TEST_TEAR_DOWN(basic_getsockopt)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
if (sd >= 0)
|
if (sd >= 0)
|
||||||
@ -235,6 +236,7 @@ TEST_TEAR_DOWN(BasicGetSockOpt)
|
|||||||
ret = close(sd);
|
ret = close(sd);
|
||||||
assert(ret >= 0);
|
assert(ret >= 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (started)
|
if (started)
|
||||||
{
|
{
|
||||||
ret = usrsocktest_daemon_stop();
|
ret = usrsocktest_daemon_stop();
|
||||||
@ -242,25 +244,25 @@ TEST_TEAR_DOWN(BasicGetSockOpt)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(BasicGetSockOpt, Open)
|
TEST(basic_getsockopt, basic_getsockopt_open)
|
||||||
{
|
{
|
||||||
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
||||||
Open(&usrsocktest_daemon_config);
|
basic_getsockopt_open(&usrsocktest_daemon_config);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(BasicGetSockOpt, OpenDelay)
|
TEST(basic_getsockopt, basic_getsockopt_open_delay)
|
||||||
{
|
{
|
||||||
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
||||||
usrsocktest_daemon_config.delay_all_responses = true;
|
usrsocktest_daemon_config.delay_all_responses = true;
|
||||||
Open(&usrsocktest_daemon_config);
|
basic_getsockopt_open(&usrsocktest_daemon_config);
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
TEST_GROUP(BasicGetSockOpt)
|
TEST_GROUP(basic_getsockopt)
|
||||||
{
|
{
|
||||||
RUN_TEST_CASE(BasicGetSockOpt, Open);
|
RUN_TEST_CASE(basic_getsockopt, basic_getsockopt_open);
|
||||||
RUN_TEST_CASE(BasicGetSockOpt, OpenDelay);
|
RUN_TEST_CASE(basic_getsockopt, basic_getsockopt_open_delay);
|
||||||
}
|
}
|
||||||
|
@ -78,7 +78,7 @@ static int sd;
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: Send
|
* Name: basic_send_send
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Open socket and send
|
* Open socket and send
|
||||||
@ -94,7 +94,7 @@ static int sd;
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static void Send(FAR struct usrsocktest_daemon_conf_s *dconf)
|
static void basic_send_send(FAR struct usrsocktest_daemon_conf_s *dconf)
|
||||||
{
|
{
|
||||||
struct sockaddr_in addr;
|
struct sockaddr_in addr;
|
||||||
ssize_t ret;
|
ssize_t ret;
|
||||||
@ -183,11 +183,10 @@ static void Send(FAR struct usrsocktest_daemon_conf_s *dconf)
|
|||||||
TEST_ASSERT_EQUAL(-ENODEV, usrsocktest_daemon_get_send_bytes());
|
TEST_ASSERT_EQUAL(-ENODEV, usrsocktest_daemon_get_send_bytes());
|
||||||
TEST_ASSERT_EQUAL(0, usrsocktest_endp_malloc_cnt);
|
TEST_ASSERT_EQUAL(0, usrsocktest_endp_malloc_cnt);
|
||||||
TEST_ASSERT_EQUAL(0, usrsocktest_dcmd_malloc_cnt);
|
TEST_ASSERT_EQUAL(0, usrsocktest_dcmd_malloc_cnt);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: ConnectSend
|
* Name: connect_send
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Send over connected socket
|
* Send over connected socket
|
||||||
@ -202,7 +201,8 @@ static void Send(FAR struct usrsocktest_daemon_conf_s *dconf)
|
|||||||
* None
|
* None
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
static void ConnectSend(FAR struct usrsocktest_daemon_conf_s *dconf)
|
|
||||||
|
static void connect_send(FAR struct usrsocktest_daemon_conf_s *dconf)
|
||||||
{
|
{
|
||||||
struct sockaddr_in addr;
|
struct sockaddr_in addr;
|
||||||
ssize_t ret;
|
ssize_t ret;
|
||||||
@ -266,7 +266,7 @@ static void ConnectSend(FAR struct usrsocktest_daemon_conf_s *dconf)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: BasicSend test group setup
|
* Name: basic_send test group setup
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Setup function executed before each testcase in this test group
|
* Setup function executed before each testcase in this test group
|
||||||
@ -282,14 +282,14 @@ static void ConnectSend(FAR struct usrsocktest_daemon_conf_s *dconf)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
TEST_SETUP(BasicSend)
|
TEST_SETUP(basic_send)
|
||||||
{
|
{
|
||||||
sd = -1;
|
sd = -1;
|
||||||
started = false;
|
started = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: BasicSend test group teardown
|
* Name: basic_send test group teardown
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Setup function executed after each testcase in this test group
|
* Setup function executed after each testcase in this test group
|
||||||
@ -305,7 +305,7 @@ TEST_SETUP(BasicSend)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
TEST_TEAR_DOWN(BasicSend)
|
TEST_TEAR_DOWN(basic_send)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
if (sd >= 0)
|
if (sd >= 0)
|
||||||
@ -313,6 +313,7 @@ TEST_TEAR_DOWN(BasicSend)
|
|||||||
ret = close(sd);
|
ret = close(sd);
|
||||||
assert(ret >= 0);
|
assert(ret >= 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (started)
|
if (started)
|
||||||
{
|
{
|
||||||
ret = usrsocktest_daemon_stop();
|
ret = usrsocktest_daemon_stop();
|
||||||
@ -320,40 +321,40 @@ TEST_TEAR_DOWN(BasicSend)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(BasicSend, Send)
|
TEST(basic_send, basic_send_send)
|
||||||
{
|
{
|
||||||
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
||||||
Send(&usrsocktest_daemon_config);
|
basic_send_send(&usrsocktest_daemon_config);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(BasicSend, SendDelay)
|
TEST(basic_send, basic_send_send_delay)
|
||||||
{
|
{
|
||||||
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
||||||
usrsocktest_daemon_config.delay_all_responses = true;
|
usrsocktest_daemon_config.delay_all_responses = true;
|
||||||
Send(&usrsocktest_daemon_config);
|
basic_send_send(&usrsocktest_daemon_config);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(BasicSend, ConnectSend)
|
TEST(basic_send, connect_send)
|
||||||
{
|
{
|
||||||
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
||||||
ConnectSend(&usrsocktest_daemon_config);
|
connect_send(&usrsocktest_daemon_config);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(BasicSend, ConnectSendDelay)
|
TEST(basic_send, connect_send_delay)
|
||||||
{
|
{
|
||||||
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
||||||
usrsocktest_daemon_config.delay_all_responses = true;
|
usrsocktest_daemon_config.delay_all_responses = true;
|
||||||
ConnectSend(&usrsocktest_daemon_config);
|
connect_send(&usrsocktest_daemon_config);
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
TEST_GROUP(BasicSend)
|
TEST_GROUP(basic_send)
|
||||||
{
|
{
|
||||||
RUN_TEST_CASE(BasicSend, Send);
|
RUN_TEST_CASE(basic_send, basic_send_send);
|
||||||
RUN_TEST_CASE(BasicSend, SendDelay);
|
RUN_TEST_CASE(basic_send, basic_send_send_delay);
|
||||||
RUN_TEST_CASE(BasicSend, ConnectSend);
|
RUN_TEST_CASE(basic_send, connect_send);
|
||||||
RUN_TEST_CASE(BasicSend, ConnectSendDelay);
|
RUN_TEST_CASE(basic_send, connect_send_delay);
|
||||||
}
|
}
|
||||||
|
@ -77,7 +77,7 @@ static int sd;
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: Open
|
* Name: basic_setsockopt_open
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Open and set socket options
|
* Open and set socket options
|
||||||
@ -93,7 +93,8 @@ static int sd;
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static void Open(FAR struct usrsocktest_daemon_conf_s *dconf)
|
static
|
||||||
|
void basic_setsockopt_open(FAR struct usrsocktest_daemon_conf_s *dconf)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
int value;
|
int value;
|
||||||
@ -156,7 +157,7 @@ static void Open(FAR struct usrsocktest_daemon_conf_s *dconf)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: BasicSetSockOpt test group setup
|
* Name: basic_setsockopt test group setup
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Setup function executed before each testcase in this test group
|
* Setup function executed before each testcase in this test group
|
||||||
@ -172,14 +173,14 @@ static void Open(FAR struct usrsocktest_daemon_conf_s *dconf)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
TEST_SETUP(BasicSetSockOpt)
|
TEST_SETUP(basic_setsockopt)
|
||||||
{
|
{
|
||||||
sd = -1;
|
sd = -1;
|
||||||
started = false;
|
started = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: BasicSetSockOpt test group teardown
|
* Name: basic_setsockopt test group teardown
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Setup function executed after each testcase in this test group
|
* Setup function executed after each testcase in this test group
|
||||||
@ -195,7 +196,7 @@ TEST_SETUP(BasicSetSockOpt)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
TEST_TEAR_DOWN(BasicSetSockOpt)
|
TEST_TEAR_DOWN(basic_setsockopt)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
if (sd >= 0)
|
if (sd >= 0)
|
||||||
@ -203,6 +204,7 @@ TEST_TEAR_DOWN(BasicSetSockOpt)
|
|||||||
ret = close(sd);
|
ret = close(sd);
|
||||||
assert(ret >= 0);
|
assert(ret >= 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (started)
|
if (started)
|
||||||
{
|
{
|
||||||
ret = usrsocktest_daemon_stop();
|
ret = usrsocktest_daemon_stop();
|
||||||
@ -210,25 +212,25 @@ TEST_TEAR_DOWN(BasicSetSockOpt)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(BasicSetSockOpt, Open)
|
TEST(basic_setsockopt, basic_setsockopt_open)
|
||||||
{
|
{
|
||||||
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
||||||
Open(&usrsocktest_daemon_config);
|
basic_setsockopt_open(&usrsocktest_daemon_config);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(BasicSetSockOpt, OpenDelay)
|
TEST(basic_setsockopt, basic_setsockopt_open_delay)
|
||||||
{
|
{
|
||||||
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
||||||
usrsocktest_daemon_config.delay_all_responses = true;
|
usrsocktest_daemon_config.delay_all_responses = true;
|
||||||
Open(&usrsocktest_daemon_config);
|
basic_setsockopt_open(&usrsocktest_daemon_config);
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
TEST_GROUP(BasicSetSockOpt)
|
TEST_GROUP(basic_setsockopt)
|
||||||
{
|
{
|
||||||
RUN_TEST_CASE(BasicSetSockOpt, Open);
|
RUN_TEST_CASE(basic_setsockopt, basic_setsockopt_open);
|
||||||
RUN_TEST_CASE(BasicSetSockOpt, OpenDelay);
|
RUN_TEST_CASE(basic_setsockopt, basic_setsockopt_open_delay);
|
||||||
}
|
}
|
||||||
|
@ -79,7 +79,7 @@ static int sd;
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: ConnectReceive
|
* Name: connect_receive
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Blocking connect and receive
|
* Blocking connect and receive
|
||||||
@ -95,7 +95,7 @@ static int sd;
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static void ConnectReceive(FAR struct usrsocktest_daemon_conf_s *dconf)
|
static void connect_receive(FAR struct usrsocktest_daemon_conf_s *dconf)
|
||||||
{
|
{
|
||||||
ssize_t ret;
|
ssize_t ret;
|
||||||
size_t datalen;
|
size_t datalen;
|
||||||
@ -181,7 +181,7 @@ static void ConnectReceive(FAR struct usrsocktest_daemon_conf_s *dconf)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: NoBlockConnect
|
* Name: no_block_connect
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Non-blocking connect and blocking receive
|
* Non-blocking connect and blocking receive
|
||||||
@ -197,7 +197,7 @@ static void ConnectReceive(FAR struct usrsocktest_daemon_conf_s *dconf)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static void NoBlockConnect(FAR struct usrsocktest_daemon_conf_s *dconf)
|
static void no_block_connect(FAR struct usrsocktest_daemon_conf_s *dconf)
|
||||||
{
|
{
|
||||||
ssize_t ret;
|
ssize_t ret;
|
||||||
size_t datalen;
|
size_t datalen;
|
||||||
@ -308,7 +308,7 @@ static void NoBlockConnect(FAR struct usrsocktest_daemon_conf_s *dconf)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: ReceiveTimeout
|
* Name: receive_timeout
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Blocking connect and receive with SO_RCVTIMEO
|
* Blocking connect and receive with SO_RCVTIMEO
|
||||||
@ -324,7 +324,7 @@ static void NoBlockConnect(FAR struct usrsocktest_daemon_conf_s *dconf)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static void ReceiveTimeout(FAR struct usrsocktest_daemon_conf_s *dconf)
|
static void receive_timeout(FAR struct usrsocktest_daemon_conf_s *dconf)
|
||||||
{
|
{
|
||||||
ssize_t ret;
|
ssize_t ret;
|
||||||
size_t datalen;
|
size_t datalen;
|
||||||
@ -404,9 +404,8 @@ static void ReceiveTimeout(FAR struct usrsocktest_daemon_conf_s *dconf)
|
|||||||
TEST_ASSERT_EQUAL(0, usrsocktest_dcmd_malloc_cnt);
|
TEST_ASSERT_EQUAL(0, usrsocktest_dcmd_malloc_cnt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: PeekReceive
|
* Name: peek_receive
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Blocking connect and receive with MSG_PEEK flag
|
* Blocking connect and receive with MSG_PEEK flag
|
||||||
@ -422,7 +421,7 @@ static void ReceiveTimeout(FAR struct usrsocktest_daemon_conf_s *dconf)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static void PeekReceive(FAR struct usrsocktest_daemon_conf_s *dconf)
|
static void peek_receive(FAR struct usrsocktest_daemon_conf_s *dconf)
|
||||||
{
|
{
|
||||||
ssize_t ret;
|
ssize_t ret;
|
||||||
size_t datalen;
|
size_t datalen;
|
||||||
@ -533,7 +532,7 @@ static void PeekReceive(FAR struct usrsocktest_daemon_conf_s *dconf)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: BlockRecv test group setup
|
* Name: block_recv test group setup
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Setup function executed before each testcase in this test group
|
* Setup function executed before each testcase in this test group
|
||||||
@ -549,14 +548,14 @@ static void PeekReceive(FAR struct usrsocktest_daemon_conf_s *dconf)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
TEST_SETUP(BlockRecv)
|
TEST_SETUP(block_recv)
|
||||||
{
|
{
|
||||||
sd = -1;
|
sd = -1;
|
||||||
started = false;
|
started = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: BlockRecv test group teardown
|
* Name: block_recv test group teardown
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Setup function executed after each testcase in this test group
|
* Setup function executed after each testcase in this test group
|
||||||
@ -572,14 +571,16 @@ TEST_SETUP(BlockRecv)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
TEST_TEAR_DOWN(BlockRecv)
|
TEST_TEAR_DOWN(block_recv)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (sd >= 0)
|
if (sd >= 0)
|
||||||
{
|
{
|
||||||
ret = close(sd);
|
ret = close(sd);
|
||||||
assert(ret >= 0);
|
assert(ret >= 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (started)
|
if (started)
|
||||||
{
|
{
|
||||||
ret = usrsocktest_daemon_stop();
|
ret = usrsocktest_daemon_stop();
|
||||||
@ -587,70 +588,70 @@ TEST_TEAR_DOWN(BlockRecv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(BlockRecv, ConnectReceive)
|
TEST(block_recv, connect_receive)
|
||||||
{
|
{
|
||||||
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
||||||
ConnectReceive(&usrsocktest_daemon_config);
|
connect_receive(&usrsocktest_daemon_config);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(BlockRecv, ConnectReceiveDelay)
|
TEST(block_recv, connect_receive_delay)
|
||||||
{
|
{
|
||||||
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
||||||
usrsocktest_daemon_config.delay_all_responses = true;
|
usrsocktest_daemon_config.delay_all_responses = true;
|
||||||
ConnectReceive(&usrsocktest_daemon_config);
|
connect_receive(&usrsocktest_daemon_config);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(BlockRecv, NoBlockConnect)
|
TEST(block_recv, no_block_connect)
|
||||||
{
|
{
|
||||||
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
||||||
NoBlockConnect(&usrsocktest_daemon_config);
|
no_block_connect(&usrsocktest_daemon_config);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(BlockRecv, NoBlockConnectDelay)
|
TEST(block_recv, no_block_connect_delay)
|
||||||
{
|
{
|
||||||
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
||||||
usrsocktest_daemon_config.delay_all_responses = true;
|
usrsocktest_daemon_config.delay_all_responses = true;
|
||||||
NoBlockConnect(&usrsocktest_daemon_config);
|
no_block_connect(&usrsocktest_daemon_config);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(BlockRecv, ReceiveTimeout)
|
TEST(block_recv, receive_timeout)
|
||||||
{
|
{
|
||||||
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
||||||
ReceiveTimeout(&usrsocktest_daemon_config);
|
receive_timeout(&usrsocktest_daemon_config);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(BlockRecv, ReceiveTimeoutDelay)
|
TEST(block_recv, receive_timeout_delay)
|
||||||
{
|
{
|
||||||
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
||||||
usrsocktest_daemon_config.delay_all_responses = true;
|
usrsocktest_daemon_config.delay_all_responses = true;
|
||||||
ReceiveTimeout(&usrsocktest_daemon_config);
|
receive_timeout(&usrsocktest_daemon_config);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(BlockRecv, PeekReceive)
|
TEST(block_recv, peek_receive)
|
||||||
{
|
{
|
||||||
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
||||||
PeekReceive(&usrsocktest_daemon_config);
|
peek_receive(&usrsocktest_daemon_config);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(BlockRecv, PeekReceiveDelay)
|
TEST(block_recv, peek_receive_delay)
|
||||||
{
|
{
|
||||||
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
||||||
usrsocktest_daemon_config.delay_all_responses = true;
|
usrsocktest_daemon_config.delay_all_responses = true;
|
||||||
PeekReceive(&usrsocktest_daemon_config);
|
peek_receive(&usrsocktest_daemon_config);
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
TEST_GROUP(BlockRecv)
|
TEST_GROUP(block_recv)
|
||||||
{
|
{
|
||||||
RUN_TEST_CASE(BlockRecv, ConnectReceive);
|
RUN_TEST_CASE(block_recv, connect_receive);
|
||||||
RUN_TEST_CASE(BlockRecv, ConnectReceiveDelay);
|
RUN_TEST_CASE(block_recv, connect_receive_delay);
|
||||||
RUN_TEST_CASE(BlockRecv, NoBlockConnect);
|
RUN_TEST_CASE(block_recv, no_block_connect);
|
||||||
RUN_TEST_CASE(BlockRecv, NoBlockConnectDelay);
|
RUN_TEST_CASE(block_recv, no_block_connect_delay);
|
||||||
RUN_TEST_CASE(BlockRecv, ReceiveTimeout);
|
RUN_TEST_CASE(block_recv, receive_timeout);
|
||||||
RUN_TEST_CASE(BlockRecv, ReceiveTimeoutDelay);
|
RUN_TEST_CASE(block_recv, receive_timeout_delay);
|
||||||
RUN_TEST_CASE(BlockRecv, PeekReceive);
|
RUN_TEST_CASE(block_recv, peek_receive);
|
||||||
RUN_TEST_CASE(BlockRecv, PeekReceiveDelay);
|
RUN_TEST_CASE(block_recv, peek_receive_delay);
|
||||||
}
|
}
|
||||||
|
@ -80,7 +80,7 @@ static int sd;
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: ConnectSend
|
* Name: connect_send
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Open socket, connect in blocking mode and send
|
* Open socket, connect in blocking mode and send
|
||||||
@ -96,7 +96,7 @@ static int sd;
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static void ConnectSend(FAR struct usrsocktest_daemon_conf_s *dconf)
|
static void connect_send(FAR struct usrsocktest_daemon_conf_s *dconf)
|
||||||
{
|
{
|
||||||
ssize_t ret;
|
ssize_t ret;
|
||||||
size_t datalen;
|
size_t datalen;
|
||||||
@ -162,7 +162,7 @@ static void ConnectSend(FAR struct usrsocktest_daemon_conf_s *dconf)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: NonBlockConnectSend
|
* Name: non_block_connect_send
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Open socket, connect in non-blocking mode and send
|
* Open socket, connect in non-blocking mode and send
|
||||||
@ -178,7 +178,8 @@ static void ConnectSend(FAR struct usrsocktest_daemon_conf_s *dconf)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static void NonBlockConnectSend(FAR struct usrsocktest_daemon_conf_s *dconf)
|
static
|
||||||
|
void non_block_connect_send(FAR struct usrsocktest_daemon_conf_s *dconf)
|
||||||
{
|
{
|
||||||
ssize_t ret;
|
ssize_t ret;
|
||||||
size_t datalen;
|
size_t datalen;
|
||||||
@ -244,7 +245,7 @@ static void NonBlockConnectSend(FAR struct usrsocktest_daemon_conf_s *dconf)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: SendTimeout
|
* Name: send_timeout
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Open socket, connect in blocking mode and send with SO_SNDTIMEO
|
* Open socket, connect in blocking mode and send with SO_SNDTIMEO
|
||||||
@ -260,7 +261,7 @@ static void NonBlockConnectSend(FAR struct usrsocktest_daemon_conf_s *dconf)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static void SendTimeout(FAR struct usrsocktest_daemon_conf_s *dconf)
|
static void send_timeout(FAR struct usrsocktest_daemon_conf_s *dconf)
|
||||||
{
|
{
|
||||||
ssize_t ret;
|
ssize_t ret;
|
||||||
size_t datalen;
|
size_t datalen;
|
||||||
@ -333,7 +334,7 @@ static void SendTimeout(FAR struct usrsocktest_daemon_conf_s *dconf)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: BlockSend test group setup
|
* Name: block_send test group setup
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Setup function executed before each testcase in this test group
|
* Setup function executed before each testcase in this test group
|
||||||
@ -349,14 +350,14 @@ static void SendTimeout(FAR struct usrsocktest_daemon_conf_s *dconf)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
TEST_SETUP(BlockSend)
|
TEST_SETUP(block_send)
|
||||||
{
|
{
|
||||||
sd = -1;
|
sd = -1;
|
||||||
started = false;
|
started = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: BlockSend test group teardown
|
* Name: block_send test group teardown
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Setup function executed after each testcase in this test group
|
* Setup function executed after each testcase in this test group
|
||||||
@ -372,7 +373,7 @@ TEST_SETUP(BlockSend)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
TEST_TEAR_DOWN(BlockSend)
|
TEST_TEAR_DOWN(block_send)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
if (sd >= 0)
|
if (sd >= 0)
|
||||||
@ -380,6 +381,7 @@ TEST_TEAR_DOWN(BlockSend)
|
|||||||
ret = close(sd);
|
ret = close(sd);
|
||||||
assert(ret >= 0);
|
assert(ret >= 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (started)
|
if (started)
|
||||||
{
|
{
|
||||||
ret = usrsocktest_daemon_stop();
|
ret = usrsocktest_daemon_stop();
|
||||||
@ -387,55 +389,55 @@ TEST_TEAR_DOWN(BlockSend)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(BlockSend, ConnectSend)
|
TEST(block_send, connect_send)
|
||||||
{
|
{
|
||||||
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
||||||
ConnectSend(&usrsocktest_daemon_config);
|
connect_send(&usrsocktest_daemon_config);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(BlockSend, ConnectSendDelay)
|
TEST(block_send, connect_send_delay)
|
||||||
{
|
{
|
||||||
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
||||||
usrsocktest_daemon_config.delay_all_responses = true;
|
usrsocktest_daemon_config.delay_all_responses = true;
|
||||||
ConnectSend(&usrsocktest_daemon_config);
|
connect_send(&usrsocktest_daemon_config);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(BlockSend, NonBlockConnectSend)
|
TEST(block_send, non_block_connect_send)
|
||||||
{
|
{
|
||||||
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
||||||
NonBlockConnectSend(&usrsocktest_daemon_config);
|
non_block_connect_send(&usrsocktest_daemon_config);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(BlockSend, NonBlockConnectSendDelay)
|
TEST(block_send, non_block_connect_send_delay)
|
||||||
{
|
{
|
||||||
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
||||||
usrsocktest_daemon_config.delay_all_responses = true;
|
usrsocktest_daemon_config.delay_all_responses = true;
|
||||||
NonBlockConnectSend(&usrsocktest_daemon_config);
|
non_block_connect_send(&usrsocktest_daemon_config);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(BlockSend, SendTimeout)
|
TEST(block_send, send_timeout)
|
||||||
{
|
{
|
||||||
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
||||||
SendTimeout(&usrsocktest_daemon_config);
|
send_timeout(&usrsocktest_daemon_config);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(BlockSend, SendTimeoutDelay)
|
TEST(block_send, send_timeout_delay)
|
||||||
{
|
{
|
||||||
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
||||||
usrsocktest_daemon_config.delay_all_responses = true;
|
usrsocktest_daemon_config.delay_all_responses = true;
|
||||||
SendTimeout(&usrsocktest_daemon_config);
|
send_timeout(&usrsocktest_daemon_config);
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
TEST_GROUP(BlockSend)
|
TEST_GROUP(block_send)
|
||||||
{
|
{
|
||||||
RUN_TEST_CASE(BlockSend, ConnectSend);
|
RUN_TEST_CASE(block_send, connect_send);
|
||||||
RUN_TEST_CASE(BlockSend, ConnectSendDelay);
|
RUN_TEST_CASE(block_send, connect_send_delay);
|
||||||
RUN_TEST_CASE(BlockSend, NonBlockConnectSend);
|
RUN_TEST_CASE(block_send, non_block_connect_send);
|
||||||
RUN_TEST_CASE(BlockSend, NonBlockConnectSendDelay);
|
RUN_TEST_CASE(block_send, non_block_connect_send_delay);
|
||||||
RUN_TEST_CASE(BlockSend, SendTimeout);
|
RUN_TEST_CASE(block_send, send_timeout);
|
||||||
RUN_TEST_CASE(BlockSend, SendTimeoutDelay);
|
RUN_TEST_CASE(block_send, send_timeout_delay);
|
||||||
}
|
}
|
||||||
|
@ -72,7 +72,7 @@ static int us_fd_two;
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: CharDev test group setup
|
* Name: char_dev test group setup
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Setup function executed before each testcase in this test group
|
* Setup function executed before each testcase in this test group
|
||||||
@ -88,14 +88,14 @@ static int us_fd_two;
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
TEST_SETUP(CharDev)
|
TEST_SETUP(char_dev)
|
||||||
{
|
{
|
||||||
us_fd = -1;
|
us_fd = -1;
|
||||||
us_fd_two = -1;
|
us_fd_two = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: CharDev test group teardown
|
* Name: char_dev test group teardown
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Setup function executed after each testcase in this test group
|
* Setup function executed after each testcase in this test group
|
||||||
@ -111,7 +111,7 @@ TEST_SETUP(CharDev)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
TEST_TEAR_DOWN(CharDev)
|
TEST_TEAR_DOWN(char_dev)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
@ -120,6 +120,7 @@ TEST_TEAR_DOWN(CharDev)
|
|||||||
ret = close(us_fd);
|
ret = close(us_fd);
|
||||||
assert(ret >= 0);
|
assert(ret >= 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (us_fd_two >= 0)
|
if (us_fd_two >= 0)
|
||||||
{
|
{
|
||||||
ret = close(us_fd_two);
|
ret = close(us_fd_two);
|
||||||
@ -128,7 +129,7 @@ TEST_TEAR_DOWN(CharDev)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: OpenRw
|
* Name: open_rw
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Simple test for opening and closing usrsock node
|
* Simple test for opening and closing usrsock node
|
||||||
@ -144,7 +145,7 @@ TEST_TEAR_DOWN(CharDev)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
TEST(CharDev, OpenRw)
|
TEST(char_dev, open_rw)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
@ -157,7 +158,7 @@ TEST(CharDev, OpenRw)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: ReopenRw
|
* Name: reopen_rw
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Repeated simple test for opening and closing usrsock node, reopen should
|
* Repeated simple test for opening and closing usrsock node, reopen should
|
||||||
@ -174,7 +175,7 @@ TEST(CharDev, OpenRw)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
TEST(CharDev, ReopenRw)
|
TEST(char_dev, reopen_rw)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
@ -194,7 +195,7 @@ TEST(CharDev, ReopenRw)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: NoMultipleOpen
|
* Name: no_multiple_open
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* No permission for multiple access,
|
* No permission for multiple access,
|
||||||
@ -211,7 +212,7 @@ TEST(CharDev, ReopenRw)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
TEST(CharDev, NoMultipleOpen)
|
TEST(char_dev, no_multiple_open)
|
||||||
{
|
{
|
||||||
us_fd = open(USRSOCK_NODE, O_RDWR);
|
us_fd = open(USRSOCK_NODE, O_RDWR);
|
||||||
TEST_ASSERT_TRUE(us_fd >= 0);
|
TEST_ASSERT_TRUE(us_fd >= 0);
|
||||||
@ -225,9 +226,9 @@ TEST(CharDev, NoMultipleOpen)
|
|||||||
* Public Functions
|
* Public Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
TEST_GROUP(CharDev)
|
TEST_GROUP(char_dev)
|
||||||
{
|
{
|
||||||
RUN_TEST_CASE(CharDev, OpenRw);
|
RUN_TEST_CASE(char_dev, open_rw);
|
||||||
RUN_TEST_CASE(CharDev, ReopenRw);
|
RUN_TEST_CASE(char_dev, reopen_rw);
|
||||||
RUN_TEST_CASE(CharDev, NoMultipleOpen);
|
RUN_TEST_CASE(char_dev, no_multiple_open);
|
||||||
}
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -163,23 +163,23 @@ static void run_tests(FAR const char *name, void (CODE *test_fn)(void))
|
|||||||
|
|
||||||
static void run_all_tests(void)
|
static void run_all_tests(void)
|
||||||
{
|
{
|
||||||
RUN_TEST_GROUP(CharDev);
|
RUN_TEST_GROUP(char_dev);
|
||||||
RUN_TEST_GROUP(NoDaemon);
|
RUN_TEST_GROUP(no_daemon);
|
||||||
RUN_TEST_GROUP(BasicDaemon);
|
RUN_TEST_GROUP(basic_daemon);
|
||||||
RUN_TEST_GROUP(BasicConnect);
|
RUN_TEST_GROUP(basic_connect);
|
||||||
RUN_TEST_GROUP(BasicConnectDelay);
|
RUN_TEST_GROUP(basic_connect_delay);
|
||||||
RUN_TEST_GROUP(NoBlockConnect);
|
RUN_TEST_GROUP(no_block_connect);
|
||||||
RUN_TEST_GROUP(BasicSend);
|
RUN_TEST_GROUP(basic_send);
|
||||||
RUN_TEST_GROUP(NoBlockSend);
|
RUN_TEST_GROUP(no_block_send);
|
||||||
RUN_TEST_GROUP(BlockSend);
|
RUN_TEST_GROUP(block_send);
|
||||||
RUN_TEST_GROUP(NoBlockRecv);
|
RUN_TEST_GROUP(no_block_recv);
|
||||||
RUN_TEST_GROUP(BlockRecv);
|
RUN_TEST_GROUP(block_recv);
|
||||||
RUN_TEST_GROUP(RemoteDisconnect);
|
RUN_TEST_GROUP(remote_disconnect);
|
||||||
RUN_TEST_GROUP(BasicSetSockOpt);
|
RUN_TEST_GROUP(basic_setsockopt);
|
||||||
RUN_TEST_GROUP(BasicGetSockOpt);
|
RUN_TEST_GROUP(basic_getsockopt);
|
||||||
RUN_TEST_GROUP(BasicGetSockName);
|
RUN_TEST_GROUP(basic_getsockname);
|
||||||
RUN_TEST_GROUP(WakeWithSignal);
|
RUN_TEST_GROUP(wake_with_signal);
|
||||||
RUN_TEST_GROUP(MultiThread);
|
RUN_TEST_GROUP(multithread);
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
@ -111,7 +111,7 @@ static FAR void *usrsock_socket_multitask_thread(FAR void *param)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: MultiThread test group setup
|
* Name: multithread test group setup
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Setup function executed before each testcase in this test group
|
* Setup function executed before each testcase in this test group
|
||||||
@ -127,22 +127,25 @@ static FAR void *usrsock_socket_multitask_thread(FAR void *param)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
TEST_SETUP(MultiThread)
|
TEST_SETUP(multithread)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_SIZE(sds); i++)
|
for (i = 0; i < ARRAY_SIZE(sds); i++)
|
||||||
{
|
{
|
||||||
sds[i] = -1;
|
sds[i] = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_SIZE(tids); i++)
|
for (i = 0; i < ARRAY_SIZE(tids); i++)
|
||||||
{
|
{
|
||||||
tids[i] = -1;
|
tids[i] = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
started = false;
|
started = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: MultiThread test group teardown
|
* Name: multithread test group teardown
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Setup function executed after each testcase in this test group
|
* Setup function executed after each testcase in this test group
|
||||||
@ -158,7 +161,7 @@ TEST_SETUP(MultiThread)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
TEST_TEAR_DOWN(MultiThread)
|
TEST_TEAR_DOWN(multithread)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
int i;
|
int i;
|
||||||
@ -173,6 +176,7 @@ TEST_TEAR_DOWN(MultiThread)
|
|||||||
assert(ret == OK);
|
assert(ret == OK);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_SIZE(sds); i++)
|
for (i = 0; i < ARRAY_SIZE(sds); i++)
|
||||||
{
|
{
|
||||||
if (sds[i] != -1)
|
if (sds[i] != -1)
|
||||||
@ -181,6 +185,7 @@ TEST_TEAR_DOWN(MultiThread)
|
|||||||
assert(ret >= 0);
|
assert(ret >= 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (started)
|
if (started)
|
||||||
{
|
{
|
||||||
ret = usrsocktest_daemon_stop();
|
ret = usrsocktest_daemon_stop();
|
||||||
@ -189,7 +194,7 @@ TEST_TEAR_DOWN(MultiThread)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: OpenClose
|
* Name: open_close
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Open and close socket with multiple threads
|
* Open and close socket with multiple threads
|
||||||
@ -205,7 +210,7 @@ TEST_TEAR_DOWN(MultiThread)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
TEST(MultiThread, OpenClose)
|
TEST(multithread, open_close)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
int i;
|
int i;
|
||||||
@ -218,7 +223,8 @@ TEST(MultiThread, OpenClose)
|
|||||||
usrsocktest_daemon_config.endpoint_block_connect = false;
|
usrsocktest_daemon_config.endpoint_block_connect = false;
|
||||||
usrsocktest_daemon_config.endpoint_addr = "127.0.0.1";
|
usrsocktest_daemon_config.endpoint_addr = "127.0.0.1";
|
||||||
usrsocktest_daemon_config.endpoint_port = 255;
|
usrsocktest_daemon_config.endpoint_port = 255;
|
||||||
TEST_ASSERT_EQUAL(OK, usrsocktest_daemon_start(&usrsocktest_daemon_config));
|
TEST_ASSERT_EQUAL(OK,
|
||||||
|
usrsocktest_daemon_start(&usrsocktest_daemon_config));
|
||||||
TEST_ASSERT_EQUAL(0, usrsocktest_daemon_get_num_active_sockets());
|
TEST_ASSERT_EQUAL(0, usrsocktest_daemon_get_num_active_sockets());
|
||||||
|
|
||||||
/* Launch worker threads. */
|
/* Launch worker threads. */
|
||||||
@ -260,7 +266,7 @@ TEST(MultiThread, OpenClose)
|
|||||||
* Public Functions
|
* Public Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
TEST_GROUP(MultiThread)
|
TEST_GROUP(multithread)
|
||||||
{
|
{
|
||||||
RUN_TEST_CASE(MultiThread, OpenClose);
|
RUN_TEST_CASE(multithread, open_close);
|
||||||
}
|
}
|
||||||
|
@ -48,7 +48,6 @@
|
|||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
|
|
||||||
|
|
||||||
#include "defines.h"
|
#include "defines.h"
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@ -68,7 +67,8 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static bool started;
|
static bool started;
|
||||||
static int sd, sd2;
|
static int sd;
|
||||||
|
static int sd2;
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Data
|
* Public Data
|
||||||
@ -78,14 +78,14 @@ static int sd, sd2;
|
|||||||
* Private Functions
|
* Private Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
TEST_SETUP(NoBlockConnect)
|
TEST_SETUP(no_block_connect)
|
||||||
{
|
{
|
||||||
sd = -1;
|
sd = -1;
|
||||||
sd2 = -1;
|
sd2 = -1;
|
||||||
started = false;
|
started = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_TEAR_DOWN(NoBlockConnect)
|
TEST_TEAR_DOWN(no_block_connect)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
@ -94,11 +94,13 @@ TEST_TEAR_DOWN(NoBlockConnect)
|
|||||||
ret = close(sd);
|
ret = close(sd);
|
||||||
assert(ret == 0);
|
assert(ret == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sd2 >= 0)
|
if (sd2 >= 0)
|
||||||
{
|
{
|
||||||
ret = close(sd2);
|
ret = close(sd2);
|
||||||
assert(ret == 0);
|
assert(ret == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (started)
|
if (started)
|
||||||
{
|
{
|
||||||
ret = usrsocktest_daemon_stop();
|
ret = usrsocktest_daemon_stop();
|
||||||
@ -106,7 +108,7 @@ TEST_TEAR_DOWN(NoBlockConnect)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(NoBlockConnect, InstantConnect)
|
TEST(no_block_connect, instant_connect)
|
||||||
{
|
{
|
||||||
int flags;
|
int flags;
|
||||||
int ret;
|
int ret;
|
||||||
@ -115,7 +117,8 @@ TEST(NoBlockConnect, InstantConnect)
|
|||||||
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
||||||
usrsocktest_daemon_config.endpoint_addr = "127.0.0.1";
|
usrsocktest_daemon_config.endpoint_addr = "127.0.0.1";
|
||||||
usrsocktest_daemon_config.endpoint_port = 255;
|
usrsocktest_daemon_config.endpoint_port = 255;
|
||||||
TEST_ASSERT_EQUAL(OK, usrsocktest_daemon_start(&usrsocktest_daemon_config));
|
TEST_ASSERT_EQUAL(OK,
|
||||||
|
usrsocktest_daemon_start(&usrsocktest_daemon_config));
|
||||||
started = true;
|
started = true;
|
||||||
TEST_ASSERT_EQUAL(0, usrsocktest_daemon_get_num_active_sockets());
|
TEST_ASSERT_EQUAL(0, usrsocktest_daemon_get_num_active_sockets());
|
||||||
|
|
||||||
@ -168,9 +171,11 @@ TEST(NoBlockConnect, InstantConnect)
|
|||||||
TEST_ASSERT_EQUAL(0, usrsocktest_dcmd_malloc_cnt);
|
TEST_ASSERT_EQUAL(0, usrsocktest_dcmd_malloc_cnt);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(NoBlockConnect, DelayedConnect)
|
TEST(no_block_connect, delayed_connect)
|
||||||
{
|
{
|
||||||
int flags, ret, count;
|
int flags;
|
||||||
|
int ret;
|
||||||
|
int count;
|
||||||
struct sockaddr_in addr;
|
struct sockaddr_in addr;
|
||||||
|
|
||||||
/* Start test daemon. */
|
/* Start test daemon. */
|
||||||
@ -180,7 +185,8 @@ TEST(NoBlockConnect, DelayedConnect)
|
|||||||
usrsocktest_daemon_config.endpoint_addr = "127.0.0.1";
|
usrsocktest_daemon_config.endpoint_addr = "127.0.0.1";
|
||||||
usrsocktest_daemon_config.endpoint_port = 255;
|
usrsocktest_daemon_config.endpoint_port = 255;
|
||||||
usrsocktest_daemon_config.delay_all_responses = true;
|
usrsocktest_daemon_config.delay_all_responses = true;
|
||||||
TEST_ASSERT_EQUAL(OK, usrsocktest_daemon_start(&usrsocktest_daemon_config));
|
TEST_ASSERT_EQUAL(OK,
|
||||||
|
usrsocktest_daemon_start(&usrsocktest_daemon_config));
|
||||||
started = true;
|
started = true;
|
||||||
TEST_ASSERT_EQUAL(0, usrsocktest_daemon_get_num_active_sockets());
|
TEST_ASSERT_EQUAL(0, usrsocktest_daemon_get_num_active_sockets());
|
||||||
|
|
||||||
@ -205,7 +211,9 @@ TEST(NoBlockConnect, DelayedConnect)
|
|||||||
TEST_ASSERT_EQUAL(O_RDWR, flags & O_RDWR);
|
TEST_ASSERT_EQUAL(O_RDWR, flags & O_RDWR);
|
||||||
TEST_ASSERT_EQUAL(O_NONBLOCK, flags & O_NONBLOCK);
|
TEST_ASSERT_EQUAL(O_NONBLOCK, flags & O_NONBLOCK);
|
||||||
|
|
||||||
/* Launch connect attempt, daemon delays actual connection until triggered. */
|
/* Launch connect attempt, daemon delays actual connection until
|
||||||
|
* triggered.
|
||||||
|
*/
|
||||||
|
|
||||||
inet_pton(AF_INET, "127.0.0.1", &addr.sin_addr.s_addr);
|
inet_pton(AF_INET, "127.0.0.1", &addr.sin_addr.s_addr);
|
||||||
addr.sin_family = AF_INET;
|
addr.sin_family = AF_INET;
|
||||||
@ -229,11 +237,13 @@ TEST(NoBlockConnect, DelayedConnect)
|
|||||||
/* Release delayed connect. */
|
/* Release delayed connect. */
|
||||||
|
|
||||||
TEST_ASSERT_TRUE(usrsocktest_daemon_establish_waiting_connections());
|
TEST_ASSERT_TRUE(usrsocktest_daemon_establish_waiting_connections());
|
||||||
for (count = 0; usrsocktest_daemon_get_num_waiting_connect_sockets() > 0; count++)
|
for (count = 0;
|
||||||
|
usrsocktest_daemon_get_num_waiting_connect_sockets() > 0; count++)
|
||||||
{
|
{
|
||||||
TEST_ASSERT_TRUE(count <= 5);
|
TEST_ASSERT_TRUE(count <= 5);
|
||||||
usleep(10 * 1000);
|
usleep(10 * 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_ASSERT_EQUAL(1, usrsocktest_daemon_get_num_active_sockets());
|
TEST_ASSERT_EQUAL(1, usrsocktest_daemon_get_num_active_sockets());
|
||||||
TEST_ASSERT_EQUAL(1, usrsocktest_daemon_get_num_connected_sockets());
|
TEST_ASSERT_EQUAL(1, usrsocktest_daemon_get_num_connected_sockets());
|
||||||
TEST_ASSERT_EQUAL(0, usrsocktest_daemon_get_num_waiting_connect_sockets());
|
TEST_ASSERT_EQUAL(0, usrsocktest_daemon_get_num_waiting_connect_sockets());
|
||||||
@ -258,14 +268,16 @@ TEST(NoBlockConnect, DelayedConnect)
|
|||||||
started = false;
|
started = false;
|
||||||
TEST_ASSERT_EQUAL(-ENODEV, usrsocktest_daemon_get_num_active_sockets());
|
TEST_ASSERT_EQUAL(-ENODEV, usrsocktest_daemon_get_num_active_sockets());
|
||||||
TEST_ASSERT_EQUAL(-ENODEV, usrsocktest_daemon_get_num_connected_sockets());
|
TEST_ASSERT_EQUAL(-ENODEV, usrsocktest_daemon_get_num_connected_sockets());
|
||||||
TEST_ASSERT_EQUAL(-ENODEV, usrsocktest_daemon_get_num_waiting_connect_sockets());
|
TEST_ASSERT_EQUAL(-ENODEV,
|
||||||
|
usrsocktest_daemon_get_num_waiting_connect_sockets());
|
||||||
TEST_ASSERT_EQUAL(0, usrsocktest_endp_malloc_cnt);
|
TEST_ASSERT_EQUAL(0, usrsocktest_endp_malloc_cnt);
|
||||||
TEST_ASSERT_EQUAL(0, usrsocktest_dcmd_malloc_cnt);
|
TEST_ASSERT_EQUAL(0, usrsocktest_dcmd_malloc_cnt);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(NoBlockConnect, CloseNotConnected)
|
TEST(no_block_connect, close_not_connected)
|
||||||
{
|
{
|
||||||
int flags, ret;
|
int flags;
|
||||||
|
int ret;
|
||||||
struct sockaddr_in addr;
|
struct sockaddr_in addr;
|
||||||
|
|
||||||
/* Start test daemon. */
|
/* Start test daemon. */
|
||||||
@ -275,7 +287,8 @@ TEST(NoBlockConnect, CloseNotConnected)
|
|||||||
usrsocktest_daemon_config.endpoint_addr = "127.0.0.1";
|
usrsocktest_daemon_config.endpoint_addr = "127.0.0.1";
|
||||||
usrsocktest_daemon_config.endpoint_port = 255;
|
usrsocktest_daemon_config.endpoint_port = 255;
|
||||||
usrsocktest_daemon_config.delay_all_responses = true;
|
usrsocktest_daemon_config.delay_all_responses = true;
|
||||||
TEST_ASSERT_EQUAL(OK, usrsocktest_daemon_start(&usrsocktest_daemon_config));
|
TEST_ASSERT_EQUAL(OK,
|
||||||
|
usrsocktest_daemon_start(&usrsocktest_daemon_config));
|
||||||
started = true;
|
started = true;
|
||||||
TEST_ASSERT_EQUAL(0, usrsocktest_daemon_get_num_active_sockets());
|
TEST_ASSERT_EQUAL(0, usrsocktest_daemon_get_num_active_sockets());
|
||||||
|
|
||||||
@ -300,7 +313,9 @@ TEST(NoBlockConnect, CloseNotConnected)
|
|||||||
TEST_ASSERT_EQUAL(O_RDWR, flags & O_RDWR);
|
TEST_ASSERT_EQUAL(O_RDWR, flags & O_RDWR);
|
||||||
TEST_ASSERT_EQUAL(O_NONBLOCK, flags & O_NONBLOCK);
|
TEST_ASSERT_EQUAL(O_NONBLOCK, flags & O_NONBLOCK);
|
||||||
|
|
||||||
/* Launch connect attempt, daemon delays actual connection until triggered. */
|
/* Launch connect attempt, daemon delays actual connection until
|
||||||
|
* triggered.
|
||||||
|
*/
|
||||||
|
|
||||||
inet_pton(AF_INET, "127.0.0.1", &addr.sin_addr.s_addr);
|
inet_pton(AF_INET, "127.0.0.1", &addr.sin_addr.s_addr);
|
||||||
addr.sin_family = AF_INET;
|
addr.sin_family = AF_INET;
|
||||||
@ -326,14 +341,16 @@ TEST(NoBlockConnect, CloseNotConnected)
|
|||||||
started = false;
|
started = false;
|
||||||
TEST_ASSERT_EQUAL(-ENODEV, usrsocktest_daemon_get_num_active_sockets());
|
TEST_ASSERT_EQUAL(-ENODEV, usrsocktest_daemon_get_num_active_sockets());
|
||||||
TEST_ASSERT_EQUAL(-ENODEV, usrsocktest_daemon_get_num_connected_sockets());
|
TEST_ASSERT_EQUAL(-ENODEV, usrsocktest_daemon_get_num_connected_sockets());
|
||||||
TEST_ASSERT_EQUAL(-ENODEV, usrsocktest_daemon_get_num_waiting_connect_sockets());
|
TEST_ASSERT_EQUAL(-ENODEV,
|
||||||
|
usrsocktest_daemon_get_num_waiting_connect_sockets());
|
||||||
TEST_ASSERT_EQUAL(0, usrsocktest_endp_malloc_cnt);
|
TEST_ASSERT_EQUAL(0, usrsocktest_endp_malloc_cnt);
|
||||||
TEST_ASSERT_EQUAL(0, usrsocktest_dcmd_malloc_cnt);
|
TEST_ASSERT_EQUAL(0, usrsocktest_dcmd_malloc_cnt);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(NoBlockConnect, EarlyDrop)
|
TEST(no_block_connect, early_drop)
|
||||||
{
|
{
|
||||||
int flags, ret;
|
int flags;
|
||||||
|
int ret;
|
||||||
struct sockaddr_in addr;
|
struct sockaddr_in addr;
|
||||||
|
|
||||||
/* Start test daemon. */
|
/* Start test daemon. */
|
||||||
@ -343,7 +360,8 @@ TEST(NoBlockConnect, EarlyDrop)
|
|||||||
usrsocktest_daemon_config.endpoint_addr = "127.0.0.1";
|
usrsocktest_daemon_config.endpoint_addr = "127.0.0.1";
|
||||||
usrsocktest_daemon_config.endpoint_port = 255;
|
usrsocktest_daemon_config.endpoint_port = 255;
|
||||||
usrsocktest_daemon_config.delay_all_responses = false;
|
usrsocktest_daemon_config.delay_all_responses = false;
|
||||||
TEST_ASSERT_EQUAL(OK, usrsocktest_daemon_start(&usrsocktest_daemon_config));
|
TEST_ASSERT_EQUAL(OK,
|
||||||
|
usrsocktest_daemon_start(&usrsocktest_daemon_config));
|
||||||
started = true;
|
started = true;
|
||||||
TEST_ASSERT_EQUAL(0, usrsocktest_daemon_get_num_active_sockets());
|
TEST_ASSERT_EQUAL(0, usrsocktest_daemon_get_num_active_sockets());
|
||||||
|
|
||||||
@ -368,7 +386,9 @@ TEST(NoBlockConnect, EarlyDrop)
|
|||||||
TEST_ASSERT_EQUAL(O_RDWR, flags & O_RDWR);
|
TEST_ASSERT_EQUAL(O_RDWR, flags & O_RDWR);
|
||||||
TEST_ASSERT_EQUAL(O_NONBLOCK, flags & O_NONBLOCK);
|
TEST_ASSERT_EQUAL(O_NONBLOCK, flags & O_NONBLOCK);
|
||||||
|
|
||||||
/* Launch connect attempt, daemon delays actual connection until triggered. */
|
/* Launch connect attempt, daemon delays actual connection until
|
||||||
|
* triggered.
|
||||||
|
*/
|
||||||
|
|
||||||
inet_pton(AF_INET, "127.0.0.1", &addr.sin_addr.s_addr);
|
inet_pton(AF_INET, "127.0.0.1", &addr.sin_addr.s_addr);
|
||||||
addr.sin_family = AF_INET;
|
addr.sin_family = AF_INET;
|
||||||
@ -386,7 +406,8 @@ TEST(NoBlockConnect, EarlyDrop)
|
|||||||
started = false;
|
started = false;
|
||||||
TEST_ASSERT_EQUAL(-ENODEV, usrsocktest_daemon_get_num_active_sockets());
|
TEST_ASSERT_EQUAL(-ENODEV, usrsocktest_daemon_get_num_active_sockets());
|
||||||
TEST_ASSERT_EQUAL(-ENODEV, usrsocktest_daemon_get_num_connected_sockets());
|
TEST_ASSERT_EQUAL(-ENODEV, usrsocktest_daemon_get_num_connected_sockets());
|
||||||
TEST_ASSERT_EQUAL(-ENODEV, usrsocktest_daemon_get_num_waiting_connect_sockets());
|
TEST_ASSERT_EQUAL(-ENODEV,
|
||||||
|
usrsocktest_daemon_get_num_waiting_connect_sockets());
|
||||||
TEST_ASSERT_EQUAL(0, usrsocktest_endp_malloc_cnt);
|
TEST_ASSERT_EQUAL(0, usrsocktest_endp_malloc_cnt);
|
||||||
TEST_ASSERT_EQUAL(0, usrsocktest_dcmd_malloc_cnt);
|
TEST_ASSERT_EQUAL(0, usrsocktest_dcmd_malloc_cnt);
|
||||||
|
|
||||||
@ -396,12 +417,15 @@ TEST(NoBlockConnect, EarlyDrop)
|
|||||||
sd = -1;
|
sd = -1;
|
||||||
TEST_ASSERT_EQUAL(-ENODEV, usrsocktest_daemon_get_num_active_sockets());
|
TEST_ASSERT_EQUAL(-ENODEV, usrsocktest_daemon_get_num_active_sockets());
|
||||||
TEST_ASSERT_EQUAL(-ENODEV, usrsocktest_daemon_get_num_connected_sockets());
|
TEST_ASSERT_EQUAL(-ENODEV, usrsocktest_daemon_get_num_connected_sockets());
|
||||||
TEST_ASSERT_EQUAL(-ENODEV, usrsocktest_daemon_get_num_waiting_connect_sockets());
|
TEST_ASSERT_EQUAL(-ENODEV,
|
||||||
|
usrsocktest_daemon_get_num_waiting_connect_sockets());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(NoBlockConnect, Multiple)
|
TEST(no_block_connect, multiple)
|
||||||
{
|
{
|
||||||
int flags, ret, count;
|
int flags;
|
||||||
|
int ret;
|
||||||
|
int count;
|
||||||
struct sockaddr_in addr;
|
struct sockaddr_in addr;
|
||||||
|
|
||||||
/* Start test daemon. */
|
/* Start test daemon. */
|
||||||
@ -411,7 +435,8 @@ TEST(NoBlockConnect, Multiple)
|
|||||||
usrsocktest_daemon_config.endpoint_addr = "127.0.0.1";
|
usrsocktest_daemon_config.endpoint_addr = "127.0.0.1";
|
||||||
usrsocktest_daemon_config.endpoint_port = 255;
|
usrsocktest_daemon_config.endpoint_port = 255;
|
||||||
usrsocktest_daemon_config.delay_all_responses = false;
|
usrsocktest_daemon_config.delay_all_responses = false;
|
||||||
TEST_ASSERT_EQUAL(OK, usrsocktest_daemon_start(&usrsocktest_daemon_config));
|
TEST_ASSERT_EQUAL(OK,
|
||||||
|
usrsocktest_daemon_start(&usrsocktest_daemon_config));
|
||||||
started = true;
|
started = true;
|
||||||
TEST_ASSERT_EQUAL(0, usrsocktest_daemon_get_num_active_sockets());
|
TEST_ASSERT_EQUAL(0, usrsocktest_daemon_get_num_active_sockets());
|
||||||
|
|
||||||
@ -452,7 +477,9 @@ TEST(NoBlockConnect, Multiple)
|
|||||||
TEST_ASSERT_EQUAL(O_RDWR, flags & O_RDWR);
|
TEST_ASSERT_EQUAL(O_RDWR, flags & O_RDWR);
|
||||||
TEST_ASSERT_EQUAL(O_NONBLOCK, flags & O_NONBLOCK);
|
TEST_ASSERT_EQUAL(O_NONBLOCK, flags & O_NONBLOCK);
|
||||||
|
|
||||||
/* Launch connect attempts, daemon delays actual connection until triggered. */
|
/* Launch connect attempts, daemon delays actual connection until
|
||||||
|
* triggered.
|
||||||
|
*/
|
||||||
|
|
||||||
inet_pton(AF_INET, "127.0.0.1", &addr.sin_addr.s_addr);
|
inet_pton(AF_INET, "127.0.0.1", &addr.sin_addr.s_addr);
|
||||||
addr.sin_family = AF_INET;
|
addr.sin_family = AF_INET;
|
||||||
@ -467,11 +494,13 @@ TEST(NoBlockConnect, Multiple)
|
|||||||
/* Release delayed connections. */
|
/* Release delayed connections. */
|
||||||
|
|
||||||
TEST_ASSERT_TRUE(usrsocktest_daemon_establish_waiting_connections());
|
TEST_ASSERT_TRUE(usrsocktest_daemon_establish_waiting_connections());
|
||||||
for (count = 0; usrsocktest_daemon_get_num_waiting_connect_sockets() > 0; count++)
|
for (count = 0;
|
||||||
|
usrsocktest_daemon_get_num_waiting_connect_sockets() > 0; count++)
|
||||||
{
|
{
|
||||||
TEST_ASSERT_TRUE(count <= 5);
|
TEST_ASSERT_TRUE(count <= 5);
|
||||||
usleep(10 * 1000);
|
usleep(10 * 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_ASSERT_EQUAL(2, usrsocktest_daemon_get_num_active_sockets());
|
TEST_ASSERT_EQUAL(2, usrsocktest_daemon_get_num_active_sockets());
|
||||||
TEST_ASSERT_EQUAL(1, usrsocktest_daemon_get_num_connected_sockets());
|
TEST_ASSERT_EQUAL(1, usrsocktest_daemon_get_num_connected_sockets());
|
||||||
TEST_ASSERT_EQUAL(0, usrsocktest_daemon_get_num_waiting_connect_sockets());
|
TEST_ASSERT_EQUAL(0, usrsocktest_daemon_get_num_waiting_connect_sockets());
|
||||||
@ -502,6 +531,7 @@ TEST(NoBlockConnect, Multiple)
|
|||||||
TEST_ASSERT_TRUE(count <= 5);
|
TEST_ASSERT_TRUE(count <= 5);
|
||||||
usleep(10 * 1000);
|
usleep(10 * 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_ASSERT_EQUAL(2, usrsocktest_daemon_get_num_active_sockets());
|
TEST_ASSERT_EQUAL(2, usrsocktest_daemon_get_num_active_sockets());
|
||||||
TEST_ASSERT_EQUAL(2, usrsocktest_daemon_get_num_connected_sockets());
|
TEST_ASSERT_EQUAL(2, usrsocktest_daemon_get_num_connected_sockets());
|
||||||
TEST_ASSERT_EQUAL(0, usrsocktest_daemon_get_num_waiting_connect_sockets());
|
TEST_ASSERT_EQUAL(0, usrsocktest_daemon_get_num_waiting_connect_sockets());
|
||||||
@ -556,7 +586,9 @@ TEST(NoBlockConnect, Multiple)
|
|||||||
TEST_ASSERT_EQUAL(O_RDWR, flags & O_RDWR);
|
TEST_ASSERT_EQUAL(O_RDWR, flags & O_RDWR);
|
||||||
TEST_ASSERT_EQUAL(O_NONBLOCK, flags & O_NONBLOCK);
|
TEST_ASSERT_EQUAL(O_NONBLOCK, flags & O_NONBLOCK);
|
||||||
|
|
||||||
/* Launch connect attempts, daemon delays actual connection until triggered. */
|
/* Launch connect attempts, daemon delays actual connection until
|
||||||
|
* triggered.
|
||||||
|
*/
|
||||||
|
|
||||||
inet_pton(AF_INET, "127.0.0.1", &addr.sin_addr.s_addr);
|
inet_pton(AF_INET, "127.0.0.1", &addr.sin_addr.s_addr);
|
||||||
addr.sin_family = AF_INET;
|
addr.sin_family = AF_INET;
|
||||||
@ -578,11 +610,13 @@ TEST(NoBlockConnect, Multiple)
|
|||||||
/* Release delayed connections. */
|
/* Release delayed connections. */
|
||||||
|
|
||||||
TEST_ASSERT_TRUE(usrsocktest_daemon_establish_waiting_connections());
|
TEST_ASSERT_TRUE(usrsocktest_daemon_establish_waiting_connections());
|
||||||
for (count = 0; usrsocktest_daemon_get_num_waiting_connect_sockets() > 0; count++)
|
for (count = 0;
|
||||||
|
usrsocktest_daemon_get_num_waiting_connect_sockets() > 0; count++)
|
||||||
{
|
{
|
||||||
TEST_ASSERT_TRUE(count <= 5);
|
TEST_ASSERT_TRUE(count <= 5);
|
||||||
usleep(10 * 1000);
|
usleep(10 * 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_ASSERT_EQUAL(2, usrsocktest_daemon_get_num_active_sockets());
|
TEST_ASSERT_EQUAL(2, usrsocktest_daemon_get_num_active_sockets());
|
||||||
TEST_ASSERT_EQUAL(2, usrsocktest_daemon_get_num_connected_sockets());
|
TEST_ASSERT_EQUAL(2, usrsocktest_daemon_get_num_connected_sockets());
|
||||||
TEST_ASSERT_EQUAL(0, usrsocktest_daemon_get_num_waiting_connect_sockets());
|
TEST_ASSERT_EQUAL(0, usrsocktest_daemon_get_num_waiting_connect_sockets());
|
||||||
@ -637,7 +671,9 @@ TEST(NoBlockConnect, Multiple)
|
|||||||
TEST_ASSERT_EQUAL(O_RDWR, flags & O_RDWR);
|
TEST_ASSERT_EQUAL(O_RDWR, flags & O_RDWR);
|
||||||
TEST_ASSERT_EQUAL(O_NONBLOCK, flags & O_NONBLOCK);
|
TEST_ASSERT_EQUAL(O_NONBLOCK, flags & O_NONBLOCK);
|
||||||
|
|
||||||
/* Launch connect attempt, daemon delays actual connection until triggered. */
|
/* Launch connect attempt, daemon delays actual connection until
|
||||||
|
* triggered.
|
||||||
|
*/
|
||||||
|
|
||||||
inet_pton(AF_INET, "127.0.0.1", &addr.sin_addr.s_addr);
|
inet_pton(AF_INET, "127.0.0.1", &addr.sin_addr.s_addr);
|
||||||
addr.sin_family = AF_INET;
|
addr.sin_family = AF_INET;
|
||||||
@ -652,16 +688,20 @@ TEST(NoBlockConnect, Multiple)
|
|||||||
/* Release delayed connections. */
|
/* Release delayed connections. */
|
||||||
|
|
||||||
TEST_ASSERT_TRUE(usrsocktest_daemon_establish_waiting_connections());
|
TEST_ASSERT_TRUE(usrsocktest_daemon_establish_waiting_connections());
|
||||||
for (count = 0; usrsocktest_daemon_get_num_waiting_connect_sockets() > 0; count++)
|
for (count = 0;
|
||||||
|
usrsocktest_daemon_get_num_waiting_connect_sockets() > 0; count++)
|
||||||
{
|
{
|
||||||
TEST_ASSERT_TRUE(count <= 5);
|
TEST_ASSERT_TRUE(count <= 5);
|
||||||
usleep(10 * 1000);
|
usleep(10 * 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_ASSERT_EQUAL(2, usrsocktest_daemon_get_num_active_sockets());
|
TEST_ASSERT_EQUAL(2, usrsocktest_daemon_get_num_active_sockets());
|
||||||
TEST_ASSERT_EQUAL(1, usrsocktest_daemon_get_num_connected_sockets());
|
TEST_ASSERT_EQUAL(1, usrsocktest_daemon_get_num_connected_sockets());
|
||||||
TEST_ASSERT_EQUAL(0, usrsocktest_daemon_get_num_waiting_connect_sockets());
|
TEST_ASSERT_EQUAL(0, usrsocktest_daemon_get_num_waiting_connect_sockets());
|
||||||
|
|
||||||
/* Launch another connect attempt, daemon delays actual connection until triggered. */
|
/* Launch another connect attempt, daemon delays actual connection until
|
||||||
|
* triggered.
|
||||||
|
*/
|
||||||
|
|
||||||
ret = connect(sd2, (FAR const struct sockaddr *)&addr, sizeof(addr));
|
ret = connect(sd2, (FAR const struct sockaddr *)&addr, sizeof(addr));
|
||||||
TEST_ASSERT_EQUAL(-1, ret);
|
TEST_ASSERT_EQUAL(-1, ret);
|
||||||
@ -689,14 +729,17 @@ TEST(NoBlockConnect, Multiple)
|
|||||||
started = false;
|
started = false;
|
||||||
TEST_ASSERT_EQUAL(-ENODEV, usrsocktest_daemon_get_num_active_sockets());
|
TEST_ASSERT_EQUAL(-ENODEV, usrsocktest_daemon_get_num_active_sockets());
|
||||||
TEST_ASSERT_EQUAL(-ENODEV, usrsocktest_daemon_get_num_connected_sockets());
|
TEST_ASSERT_EQUAL(-ENODEV, usrsocktest_daemon_get_num_connected_sockets());
|
||||||
TEST_ASSERT_EQUAL(-ENODEV, usrsocktest_daemon_get_num_waiting_connect_sockets());
|
TEST_ASSERT_EQUAL(-ENODEV,
|
||||||
|
usrsocktest_daemon_get_num_waiting_connect_sockets());
|
||||||
TEST_ASSERT_EQUAL(0, usrsocktest_endp_malloc_cnt);
|
TEST_ASSERT_EQUAL(0, usrsocktest_endp_malloc_cnt);
|
||||||
TEST_ASSERT_EQUAL(0, usrsocktest_dcmd_malloc_cnt);
|
TEST_ASSERT_EQUAL(0, usrsocktest_dcmd_malloc_cnt);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(NoBlockConnect, Dup2)
|
TEST(no_block_connect, basic_daemon_dup2)
|
||||||
{
|
{
|
||||||
int flags, ret, count;
|
int flags;
|
||||||
|
int ret;
|
||||||
|
int count;
|
||||||
struct sockaddr_in addr;
|
struct sockaddr_in addr;
|
||||||
|
|
||||||
/* Start test daemon. */
|
/* Start test daemon. */
|
||||||
@ -706,7 +749,8 @@ TEST(NoBlockConnect, Dup2)
|
|||||||
usrsocktest_daemon_config.endpoint_addr = "127.0.0.1";
|
usrsocktest_daemon_config.endpoint_addr = "127.0.0.1";
|
||||||
usrsocktest_daemon_config.endpoint_port = 255;
|
usrsocktest_daemon_config.endpoint_port = 255;
|
||||||
usrsocktest_daemon_config.delay_all_responses = true;
|
usrsocktest_daemon_config.delay_all_responses = true;
|
||||||
TEST_ASSERT_EQUAL(OK, usrsocktest_daemon_start(&usrsocktest_daemon_config));
|
TEST_ASSERT_EQUAL(OK,
|
||||||
|
usrsocktest_daemon_start(&usrsocktest_daemon_config));
|
||||||
started = true;
|
started = true;
|
||||||
TEST_ASSERT_EQUAL(0, usrsocktest_daemon_get_num_active_sockets());
|
TEST_ASSERT_EQUAL(0, usrsocktest_daemon_get_num_active_sockets());
|
||||||
|
|
||||||
@ -737,7 +781,9 @@ TEST(NoBlockConnect, Dup2)
|
|||||||
TEST_ASSERT_EQUAL(O_RDWR, flags & O_RDWR);
|
TEST_ASSERT_EQUAL(O_RDWR, flags & O_RDWR);
|
||||||
TEST_ASSERT_EQUAL(O_NONBLOCK, flags & O_NONBLOCK);
|
TEST_ASSERT_EQUAL(O_NONBLOCK, flags & O_NONBLOCK);
|
||||||
|
|
||||||
/* Launch connect attempt, daemon delays actual connection until triggered. */
|
/* Launch connect attempt, daemon delays actual connection until
|
||||||
|
* triggered.
|
||||||
|
*/
|
||||||
|
|
||||||
inet_pton(AF_INET, "127.0.0.1", &addr.sin_addr.s_addr);
|
inet_pton(AF_INET, "127.0.0.1", &addr.sin_addr.s_addr);
|
||||||
addr.sin_family = AF_INET;
|
addr.sin_family = AF_INET;
|
||||||
@ -761,11 +807,13 @@ TEST(NoBlockConnect, Dup2)
|
|||||||
/* Release delayed connect. */
|
/* Release delayed connect. */
|
||||||
|
|
||||||
TEST_ASSERT_TRUE(usrsocktest_daemon_establish_waiting_connections());
|
TEST_ASSERT_TRUE(usrsocktest_daemon_establish_waiting_connections());
|
||||||
for (count = 0; usrsocktest_daemon_get_num_waiting_connect_sockets() > 0; count++)
|
for (count = 0;
|
||||||
|
usrsocktest_daemon_get_num_waiting_connect_sockets() > 0; count++)
|
||||||
{
|
{
|
||||||
TEST_ASSERT_TRUE(count <= 5);
|
TEST_ASSERT_TRUE(count <= 5);
|
||||||
usleep(10 * 1000);
|
usleep(10 * 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_ASSERT_EQUAL(1, usrsocktest_daemon_get_num_active_sockets());
|
TEST_ASSERT_EQUAL(1, usrsocktest_daemon_get_num_active_sockets());
|
||||||
TEST_ASSERT_EQUAL(1, usrsocktest_daemon_get_num_connected_sockets());
|
TEST_ASSERT_EQUAL(1, usrsocktest_daemon_get_num_connected_sockets());
|
||||||
TEST_ASSERT_EQUAL(0, usrsocktest_daemon_get_num_waiting_connect_sockets());
|
TEST_ASSERT_EQUAL(0, usrsocktest_daemon_get_num_waiting_connect_sockets());
|
||||||
@ -796,7 +844,8 @@ TEST(NoBlockConnect, Dup2)
|
|||||||
started = false;
|
started = false;
|
||||||
TEST_ASSERT_EQUAL(-ENODEV, usrsocktest_daemon_get_num_active_sockets());
|
TEST_ASSERT_EQUAL(-ENODEV, usrsocktest_daemon_get_num_active_sockets());
|
||||||
TEST_ASSERT_EQUAL(-ENODEV, usrsocktest_daemon_get_num_connected_sockets());
|
TEST_ASSERT_EQUAL(-ENODEV, usrsocktest_daemon_get_num_connected_sockets());
|
||||||
TEST_ASSERT_EQUAL(-ENODEV, usrsocktest_daemon_get_num_waiting_connect_sockets());
|
TEST_ASSERT_EQUAL(-ENODEV,
|
||||||
|
usrsocktest_daemon_get_num_waiting_connect_sockets());
|
||||||
TEST_ASSERT_EQUAL(0, usrsocktest_endp_malloc_cnt);
|
TEST_ASSERT_EQUAL(0, usrsocktest_endp_malloc_cnt);
|
||||||
TEST_ASSERT_EQUAL(0, usrsocktest_dcmd_malloc_cnt);
|
TEST_ASSERT_EQUAL(0, usrsocktest_dcmd_malloc_cnt);
|
||||||
}
|
}
|
||||||
@ -805,12 +854,12 @@ TEST(NoBlockConnect, Dup2)
|
|||||||
* Public Functions
|
* Public Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
TEST_GROUP(NoBlockConnect)
|
TEST_GROUP(no_block_connect)
|
||||||
{
|
{
|
||||||
RUN_TEST_CASE(NoBlockConnect, InstantConnect);
|
RUN_TEST_CASE(no_block_connect, instant_connect);
|
||||||
RUN_TEST_CASE(NoBlockConnect, DelayedConnect);
|
RUN_TEST_CASE(no_block_connect, delayed_connect);
|
||||||
RUN_TEST_CASE(NoBlockConnect, CloseNotConnected);
|
RUN_TEST_CASE(no_block_connect, close_not_connected);
|
||||||
RUN_TEST_CASE(NoBlockConnect, EarlyDrop);
|
RUN_TEST_CASE(no_block_connect, early_drop);
|
||||||
RUN_TEST_CASE(NoBlockConnect, Multiple);
|
RUN_TEST_CASE(no_block_connect, multiple);
|
||||||
RUN_TEST_CASE(NoBlockConnect, Dup2);
|
RUN_TEST_CASE(no_block_connect, basic_daemon_dup2);
|
||||||
}
|
}
|
||||||
|
@ -78,7 +78,7 @@ static int sd;
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: Receive
|
* Name: receive
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Non-blocking & instant connect+recv
|
* Non-blocking & instant connect+recv
|
||||||
@ -94,7 +94,7 @@ static int sd;
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static void Receive(struct usrsocktest_daemon_conf_s *dconf)
|
static void receive(struct usrsocktest_daemon_conf_s *dconf)
|
||||||
{
|
{
|
||||||
int flags;
|
int flags;
|
||||||
int count;
|
int count;
|
||||||
@ -230,11 +230,13 @@ static void Receive(struct usrsocktest_daemon_conf_s *dconf)
|
|||||||
/* Reset recv buffer for open sockets */
|
/* Reset recv buffer for open sockets */
|
||||||
|
|
||||||
TEST_ASSERT_TRUE(usrsocktest_send_delayed_command('r', 0));
|
TEST_ASSERT_TRUE(usrsocktest_send_delayed_command('r', 0));
|
||||||
for (count = 0; usrsocktest_daemon_get_num_recv_empty_sockets() > 0; count++)
|
for (count = 0;
|
||||||
|
usrsocktest_daemon_get_num_recv_empty_sockets() > 0; count++)
|
||||||
{
|
{
|
||||||
TEST_ASSERT_TRUE(count <= 5);
|
TEST_ASSERT_TRUE(count <= 5);
|
||||||
usleep(5 * 1000);
|
usleep(5 * 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_ASSERT_EQUAL(0, usrsocktest_daemon_get_num_recv_empty_sockets());
|
TEST_ASSERT_EQUAL(0, usrsocktest_daemon_get_num_recv_empty_sockets());
|
||||||
|
|
||||||
/* Receive data from remote, daemon returns 4 bytes. */
|
/* Receive data from remote, daemon returns 4 bytes. */
|
||||||
@ -270,7 +272,7 @@ static void Receive(struct usrsocktest_daemon_conf_s *dconf)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: DelayedConnect
|
* Name: delayed_connect
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Non-blocking & delayed connect
|
* Non-blocking & delayed connect
|
||||||
@ -286,7 +288,7 @@ static void Receive(struct usrsocktest_daemon_conf_s *dconf)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static void DelayedConnect(struct usrsocktest_daemon_conf_s *dconf)
|
static void delayed_connect(struct usrsocktest_daemon_conf_s *dconf)
|
||||||
{
|
{
|
||||||
int flags;
|
int flags;
|
||||||
int count;
|
int count;
|
||||||
@ -330,7 +332,9 @@ static void DelayedConnect(struct usrsocktest_daemon_conf_s *dconf)
|
|||||||
TEST_ASSERT_EQUAL(O_RDWR, flags & O_RDWR);
|
TEST_ASSERT_EQUAL(O_RDWR, flags & O_RDWR);
|
||||||
TEST_ASSERT_EQUAL(O_NONBLOCK, flags & O_NONBLOCK);
|
TEST_ASSERT_EQUAL(O_NONBLOCK, flags & O_NONBLOCK);
|
||||||
|
|
||||||
/* Launch connect attempt, daemon delays actual connection until triggered. */
|
/* Launch connect attempt, daemon delays actual connection until
|
||||||
|
* triggered.
|
||||||
|
*/
|
||||||
|
|
||||||
inet_pton(AF_INET, "127.0.0.1", &addr.sin_addr.s_addr);
|
inet_pton(AF_INET, "127.0.0.1", &addr.sin_addr.s_addr);
|
||||||
addr.sin_family = AF_INET;
|
addr.sin_family = AF_INET;
|
||||||
@ -363,6 +367,7 @@ static void DelayedConnect(struct usrsocktest_daemon_conf_s *dconf)
|
|||||||
TEST_ASSERT_TRUE(count <= 5);
|
TEST_ASSERT_TRUE(count <= 5);
|
||||||
usleep(10 * 1000);
|
usleep(10 * 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_ASSERT_EQUAL(1, usrsocktest_daemon_get_num_active_sockets());
|
TEST_ASSERT_EQUAL(1, usrsocktest_daemon_get_num_active_sockets());
|
||||||
TEST_ASSERT_EQUAL(1, usrsocktest_daemon_get_num_connected_sockets());
|
TEST_ASSERT_EQUAL(1, usrsocktest_daemon_get_num_connected_sockets());
|
||||||
TEST_ASSERT_EQUAL(0, usrsocktest_daemon_get_num_waiting_connect_sockets());
|
TEST_ASSERT_EQUAL(0, usrsocktest_daemon_get_num_waiting_connect_sockets());
|
||||||
@ -386,7 +391,8 @@ static void DelayedConnect(struct usrsocktest_daemon_conf_s *dconf)
|
|||||||
/* Reset recv buffer for open sockets */
|
/* Reset recv buffer for open sockets */
|
||||||
|
|
||||||
TEST_ASSERT_TRUE(usrsocktest_send_delayed_command('r', 0));
|
TEST_ASSERT_TRUE(usrsocktest_send_delayed_command('r', 0));
|
||||||
for (count = 0; usrsocktest_daemon_get_num_recv_empty_sockets() > 0; count++)
|
for (count = 0;
|
||||||
|
usrsocktest_daemon_get_num_recv_empty_sockets() > 0; count++)
|
||||||
{
|
{
|
||||||
TEST_ASSERT_TRUE(count <= 5);
|
TEST_ASSERT_TRUE(count <= 5);
|
||||||
usleep(5 * 1000);
|
usleep(5 * 1000);
|
||||||
@ -422,13 +428,14 @@ static void DelayedConnect(struct usrsocktest_daemon_conf_s *dconf)
|
|||||||
TEST_ASSERT_EQUAL(-ENODEV, usrsocktest_daemon_get_num_connected_sockets());
|
TEST_ASSERT_EQUAL(-ENODEV, usrsocktest_daemon_get_num_connected_sockets());
|
||||||
TEST_ASSERT_EQUAL(-ENODEV,
|
TEST_ASSERT_EQUAL(-ENODEV,
|
||||||
usrsocktest_daemon_get_num_waiting_connect_sockets());
|
usrsocktest_daemon_get_num_waiting_connect_sockets());
|
||||||
TEST_ASSERT_EQUAL(-ENODEV, usrsocktest_daemon_get_num_recv_empty_sockets());
|
TEST_ASSERT_EQUAL(-ENODEV,
|
||||||
|
usrsocktest_daemon_get_num_recv_empty_sockets());
|
||||||
TEST_ASSERT_EQUAL(0, usrsocktest_endp_malloc_cnt);
|
TEST_ASSERT_EQUAL(0, usrsocktest_endp_malloc_cnt);
|
||||||
TEST_ASSERT_EQUAL(0, usrsocktest_dcmd_malloc_cnt);
|
TEST_ASSERT_EQUAL(0, usrsocktest_dcmd_malloc_cnt);
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: NoBlockRecv test group setup
|
* Name: no_block_recv test group setup
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Setup function executed before each testcase in this test group
|
* Setup function executed before each testcase in this test group
|
||||||
@ -444,14 +451,14 @@ static void DelayedConnect(struct usrsocktest_daemon_conf_s *dconf)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
TEST_SETUP(NoBlockRecv)
|
TEST_SETUP(no_block_recv)
|
||||||
{
|
{
|
||||||
sd = -1;
|
sd = -1;
|
||||||
started = false;
|
started = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: NoBlockRecv test group teardown
|
* Name: no_block_recv test group teardown
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Setup function executed after each testcase in this test group
|
* Setup function executed after each testcase in this test group
|
||||||
@ -467,7 +474,7 @@ TEST_SETUP(NoBlockRecv)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
TEST_TEAR_DOWN(NoBlockRecv)
|
TEST_TEAR_DOWN(no_block_recv)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
if (sd >= 0)
|
if (sd >= 0)
|
||||||
@ -475,6 +482,7 @@ TEST_TEAR_DOWN(NoBlockRecv)
|
|||||||
ret = close(sd);
|
ret = close(sd);
|
||||||
assert(ret >= 0);
|
assert(ret >= 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (started)
|
if (started)
|
||||||
{
|
{
|
||||||
ret = usrsocktest_daemon_stop();
|
ret = usrsocktest_daemon_stop();
|
||||||
@ -482,40 +490,40 @@ TEST_TEAR_DOWN(NoBlockRecv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(NoBlockRecv, Receive)
|
TEST(no_block_recv, receive)
|
||||||
{
|
{
|
||||||
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
||||||
Receive(&usrsocktest_daemon_config);
|
receive(&usrsocktest_daemon_config);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(NoBlockRecv, ReceiveDelay)
|
TEST(no_block_recv, receive_delay)
|
||||||
{
|
{
|
||||||
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
||||||
usrsocktest_daemon_config.delay_all_responses = true;
|
usrsocktest_daemon_config.delay_all_responses = true;
|
||||||
Receive(&usrsocktest_daemon_config);
|
receive(&usrsocktest_daemon_config);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(NoBlockRecv, DelayedConnect)
|
TEST(no_block_recv, delayed_connect)
|
||||||
{
|
{
|
||||||
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
||||||
DelayedConnect(&usrsocktest_daemon_config);
|
delayed_connect(&usrsocktest_daemon_config);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(NoBlockRecv, DelayedConnectDelay)
|
TEST(no_block_recv, delayed_connect_delay)
|
||||||
{
|
{
|
||||||
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
||||||
usrsocktest_daemon_config.delay_all_responses = true;
|
usrsocktest_daemon_config.delay_all_responses = true;
|
||||||
DelayedConnect(&usrsocktest_daemon_config);
|
delayed_connect(&usrsocktest_daemon_config);
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
TEST_GROUP(NoBlockRecv)
|
TEST_GROUP(no_block_recv)
|
||||||
{
|
{
|
||||||
RUN_TEST_CASE(NoBlockRecv, Receive);
|
RUN_TEST_CASE(no_block_recv, receive);
|
||||||
RUN_TEST_CASE(NoBlockRecv, ReceiveDelay);
|
RUN_TEST_CASE(no_block_recv, receive_delay);
|
||||||
RUN_TEST_CASE(NoBlockRecv, DelayedConnect);
|
RUN_TEST_CASE(no_block_recv, delayed_connect);
|
||||||
RUN_TEST_CASE(NoBlockRecv, DelayedConnectDelay);
|
RUN_TEST_CASE(no_block_recv, delayed_connect_delay);
|
||||||
}
|
}
|
||||||
|
@ -79,7 +79,7 @@ static int sd;
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: Send
|
* Name: _send
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Open socket, connect instantly and send
|
* Open socket, connect instantly and send
|
||||||
@ -95,7 +95,7 @@ static int sd;
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static void Send(struct usrsocktest_daemon_conf_s *dconf)
|
static void _send(struct usrsocktest_daemon_conf_s *dconf)
|
||||||
{
|
{
|
||||||
int flags;
|
int flags;
|
||||||
int count;
|
int count;
|
||||||
@ -144,7 +144,8 @@ static void Send(struct usrsocktest_daemon_conf_s *dconf)
|
|||||||
TEST_ASSERT_EQUAL(0, ret);
|
TEST_ASSERT_EQUAL(0, ret);
|
||||||
TEST_ASSERT_EQUAL(1, usrsocktest_daemon_get_num_active_sockets());
|
TEST_ASSERT_EQUAL(1, usrsocktest_daemon_get_num_active_sockets());
|
||||||
TEST_ASSERT_EQUAL(1, usrsocktest_daemon_get_num_connected_sockets());
|
TEST_ASSERT_EQUAL(1, usrsocktest_daemon_get_num_connected_sockets());
|
||||||
TEST_ASSERT_EQUAL(0, usrsocktest_daemon_get_num_waiting_connect_sockets());
|
TEST_ASSERT_EQUAL(0,
|
||||||
|
usrsocktest_daemon_get_num_waiting_connect_sockets());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -152,7 +153,8 @@ static void Send(struct usrsocktest_daemon_conf_s *dconf)
|
|||||||
TEST_ASSERT_EQUAL(EINPROGRESS, errno);
|
TEST_ASSERT_EQUAL(EINPROGRESS, errno);
|
||||||
TEST_ASSERT_EQUAL(1, usrsocktest_daemon_get_num_active_sockets());
|
TEST_ASSERT_EQUAL(1, usrsocktest_daemon_get_num_active_sockets());
|
||||||
TEST_ASSERT_EQUAL(0, usrsocktest_daemon_get_num_connected_sockets());
|
TEST_ASSERT_EQUAL(0, usrsocktest_daemon_get_num_connected_sockets());
|
||||||
TEST_ASSERT_EQUAL(0, usrsocktest_daemon_get_num_waiting_connect_sockets());
|
TEST_ASSERT_EQUAL(0,
|
||||||
|
usrsocktest_daemon_get_num_waiting_connect_sockets());
|
||||||
|
|
||||||
for (count = 0; usrsocktest_daemon_get_num_connected_sockets() != 1;
|
for (count = 0; usrsocktest_daemon_get_num_connected_sockets() != 1;
|
||||||
count++)
|
count++)
|
||||||
@ -196,7 +198,7 @@ static void Send(struct usrsocktest_daemon_conf_s *dconf)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: ConnectSend
|
* Name: connect_send
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Open socket, connect is delayed and send
|
* Open socket, connect is delayed and send
|
||||||
@ -212,7 +214,7 @@ static void Send(struct usrsocktest_daemon_conf_s *dconf)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static void ConnectSend(struct usrsocktest_daemon_conf_s *dconf)
|
static void connect_send(struct usrsocktest_daemon_conf_s *dconf)
|
||||||
{
|
{
|
||||||
int flags;
|
int flags;
|
||||||
int count;
|
int count;
|
||||||
@ -252,7 +254,9 @@ static void ConnectSend(struct usrsocktest_daemon_conf_s *dconf)
|
|||||||
TEST_ASSERT_EQUAL(O_RDWR, flags & O_RDWR);
|
TEST_ASSERT_EQUAL(O_RDWR, flags & O_RDWR);
|
||||||
TEST_ASSERT_EQUAL(O_NONBLOCK, flags & O_NONBLOCK);
|
TEST_ASSERT_EQUAL(O_NONBLOCK, flags & O_NONBLOCK);
|
||||||
|
|
||||||
/* Launch connect attempt, daemon delays actual connection until triggered. */
|
/* Launch connect attempt, daemon delays actual connection until
|
||||||
|
* triggered.
|
||||||
|
*/
|
||||||
|
|
||||||
inet_pton(AF_INET, "127.0.0.1", &addr.sin_addr.s_addr);
|
inet_pton(AF_INET, "127.0.0.1", &addr.sin_addr.s_addr);
|
||||||
addr.sin_family = AF_INET;
|
addr.sin_family = AF_INET;
|
||||||
@ -285,6 +289,7 @@ static void ConnectSend(struct usrsocktest_daemon_conf_s *dconf)
|
|||||||
TEST_ASSERT_TRUE(count <= 5);
|
TEST_ASSERT_TRUE(count <= 5);
|
||||||
usleep(10 * 1000);
|
usleep(10 * 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_ASSERT_EQUAL(1, usrsocktest_daemon_get_num_active_sockets());
|
TEST_ASSERT_EQUAL(1, usrsocktest_daemon_get_num_active_sockets());
|
||||||
TEST_ASSERT_EQUAL(1, usrsocktest_daemon_get_num_connected_sockets());
|
TEST_ASSERT_EQUAL(1, usrsocktest_daemon_get_num_connected_sockets());
|
||||||
TEST_ASSERT_EQUAL(0, usrsocktest_daemon_get_num_waiting_connect_sockets());
|
TEST_ASSERT_EQUAL(0, usrsocktest_daemon_get_num_waiting_connect_sockets());
|
||||||
@ -321,7 +326,7 @@ static void ConnectSend(struct usrsocktest_daemon_conf_s *dconf)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: NoBlockSend test group setup
|
* Name: no_block_send test group setup
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Setup function executed before each testcase in this test group
|
* Setup function executed before each testcase in this test group
|
||||||
@ -337,14 +342,14 @@ static void ConnectSend(struct usrsocktest_daemon_conf_s *dconf)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
TEST_SETUP(NoBlockSend)
|
TEST_SETUP(no_block_send)
|
||||||
{
|
{
|
||||||
sd = -1;
|
sd = -1;
|
||||||
started = false;
|
started = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: NoBlockSend test group teardown
|
* Name: no_block_send test group teardown
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Setup function executed after each testcase in this test group
|
* Setup function executed after each testcase in this test group
|
||||||
@ -360,7 +365,7 @@ TEST_SETUP(NoBlockSend)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
TEST_TEAR_DOWN(NoBlockSend)
|
TEST_TEAR_DOWN(no_block_send)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
if (sd >= 0)
|
if (sd >= 0)
|
||||||
@ -368,6 +373,7 @@ TEST_TEAR_DOWN(NoBlockSend)
|
|||||||
ret = close(sd);
|
ret = close(sd);
|
||||||
assert(ret >= 0);
|
assert(ret >= 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (started)
|
if (started)
|
||||||
{
|
{
|
||||||
ret = usrsocktest_daemon_stop();
|
ret = usrsocktest_daemon_stop();
|
||||||
@ -375,40 +381,40 @@ TEST_TEAR_DOWN(NoBlockSend)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(NoBlockSend, Send)
|
TEST(no_block_send, _send)
|
||||||
{
|
{
|
||||||
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
||||||
Send(&usrsocktest_daemon_config);
|
_send(&usrsocktest_daemon_config);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(NoBlockSend, SendDelay)
|
TEST(no_block_send, _send_delay)
|
||||||
{
|
{
|
||||||
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
||||||
usrsocktest_daemon_config.delay_all_responses = true;
|
usrsocktest_daemon_config.delay_all_responses = true;
|
||||||
Send(&usrsocktest_daemon_config);
|
_send(&usrsocktest_daemon_config);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(NoBlockSend, ConnectSend)
|
TEST(no_block_send, connect_send)
|
||||||
{
|
{
|
||||||
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
||||||
ConnectSend(&usrsocktest_daemon_config);
|
connect_send(&usrsocktest_daemon_config);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(NoBlockSend, ConnectSendDelay)
|
TEST(no_block_send, connect_send_delay)
|
||||||
{
|
{
|
||||||
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
||||||
usrsocktest_daemon_config.delay_all_responses = true;
|
usrsocktest_daemon_config.delay_all_responses = true;
|
||||||
ConnectSend(&usrsocktest_daemon_config);
|
connect_send(&usrsocktest_daemon_config);
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
TEST_GROUP(NoBlockSend)
|
TEST_GROUP(no_block_send)
|
||||||
{
|
{
|
||||||
RUN_TEST_CASE(NoBlockSend, Send);
|
RUN_TEST_CASE(no_block_send, _send);
|
||||||
RUN_TEST_CASE(NoBlockSend, SendDelay);
|
RUN_TEST_CASE(no_block_send, _send_delay);
|
||||||
RUN_TEST_CASE(NoBlockSend, ConnectSend);
|
RUN_TEST_CASE(no_block_send, connect_send);
|
||||||
RUN_TEST_CASE(NoBlockSend, ConnectSendDelay);
|
RUN_TEST_CASE(no_block_send, connect_send_delay);
|
||||||
}
|
}
|
||||||
|
@ -71,7 +71,7 @@ static int sd;
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: NoDaemon test group setup
|
* Name: no_daemon test group setup
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Setup function executed before each testcase in this test group
|
* Setup function executed before each testcase in this test group
|
||||||
@ -87,13 +87,13 @@ static int sd;
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
TEST_SETUP(NoDaemon)
|
TEST_SETUP(no_daemon)
|
||||||
{
|
{
|
||||||
sd = -1;
|
sd = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: NoDaemon test group teardown
|
* Name: no_daemon test group teardown
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Setup function executed after each testcase in this test group
|
* Setup function executed after each testcase in this test group
|
||||||
@ -109,7 +109,7 @@ TEST_SETUP(NoDaemon)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
TEST_TEAR_DOWN(NoDaemon)
|
TEST_TEAR_DOWN(no_daemon)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
@ -121,7 +121,7 @@ TEST_TEAR_DOWN(NoDaemon)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: NoSocket
|
* Name: no_socket
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Simple test for opening socket without usrsock daemon running
|
* Simple test for opening socket without usrsock daemon running
|
||||||
@ -137,18 +137,19 @@ TEST_TEAR_DOWN(NoDaemon)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
TEST(NoDaemon, NoSocket)
|
TEST(no_daemon, no_socket)
|
||||||
{
|
{
|
||||||
sd = socket(AF_INET, SOCK_STREAM, 0);
|
sd = socket(AF_INET, SOCK_STREAM, 0);
|
||||||
TEST_ASSERT_EQUAL(-1, sd);
|
TEST_ASSERT_EQUAL(-1, sd);
|
||||||
TEST_ASSERT_TRUE(errno == EAFNOSUPPORT || errno == EPROTONOSUPPORT || errno == ENETDOWN);
|
TEST_ASSERT_TRUE(errno == EAFNOSUPPORT || errno == EPROTONOSUPPORT ||
|
||||||
|
errno == ENETDOWN);
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
TEST_GROUP(NoDaemon)
|
TEST_GROUP(no_daemon)
|
||||||
{
|
{
|
||||||
RUN_TEST_CASE(NoDaemon, NoSocket);
|
RUN_TEST_CASE(no_daemon, no_socket);
|
||||||
}
|
}
|
||||||
|
@ -68,7 +68,10 @@
|
|||||||
* Private Data
|
* Private Data
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static const uint8_t tevents[] = { POLLIN, POLLOUT, POLLOUT|POLLIN, 0};
|
static const uint8_t tevents[] =
|
||||||
|
{
|
||||||
|
POLLIN, POLLOUT, POLLOUT | POLLIN, 0
|
||||||
|
};
|
||||||
static bool started;
|
static bool started;
|
||||||
static int sd;
|
static int sd;
|
||||||
|
|
||||||
@ -97,7 +100,7 @@ static int sd;
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static void Unreachable(struct usrsocktest_daemon_conf_s *dconf)
|
static void unreachable(struct usrsocktest_daemon_conf_s *dconf)
|
||||||
{
|
{
|
||||||
ssize_t ret;
|
ssize_t ret;
|
||||||
struct sockaddr_in addr;
|
struct sockaddr_in addr;
|
||||||
@ -215,11 +218,10 @@ static void Unreachable(struct usrsocktest_daemon_conf_s *dconf)
|
|||||||
TEST_ASSERT_EQUAL(-ENODEV, usrsocktest_daemon_get_num_connected_sockets());
|
TEST_ASSERT_EQUAL(-ENODEV, usrsocktest_daemon_get_num_connected_sockets());
|
||||||
TEST_ASSERT_EQUAL(0, usrsocktest_endp_malloc_cnt);
|
TEST_ASSERT_EQUAL(0, usrsocktest_endp_malloc_cnt);
|
||||||
TEST_ASSERT_EQUAL(0, usrsocktest_dcmd_malloc_cnt);
|
TEST_ASSERT_EQUAL(0, usrsocktest_dcmd_malloc_cnt);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: Send
|
* Name: remote_disconnect_send
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Send and disconnect
|
* Send and disconnect
|
||||||
@ -235,7 +237,7 @@ static void Unreachable(struct usrsocktest_daemon_conf_s *dconf)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static void Send(struct usrsocktest_daemon_conf_s *dconf)
|
static void remote_disconnect_send(struct usrsocktest_daemon_conf_s *dconf)
|
||||||
{
|
{
|
||||||
ssize_t ret;
|
ssize_t ret;
|
||||||
size_t datalen;
|
size_t datalen;
|
||||||
@ -276,18 +278,22 @@ static void Send(struct usrsocktest_daemon_conf_s *dconf)
|
|||||||
TEST_ASSERT_EQUAL(1, usrsocktest_daemon_get_num_connected_sockets());
|
TEST_ASSERT_EQUAL(1, usrsocktest_daemon_get_num_connected_sockets());
|
||||||
TEST_ASSERT_EQUAL(0, usrsocktest_daemon_get_num_waiting_connect_sockets());
|
TEST_ASSERT_EQUAL(0, usrsocktest_daemon_get_num_waiting_connect_sockets());
|
||||||
TEST_ASSERT_EQUAL(0, usrsocktest_daemon_get_num_unreachable_sockets());
|
TEST_ASSERT_EQUAL(0, usrsocktest_daemon_get_num_unreachable_sockets());
|
||||||
TEST_ASSERT_EQUAL(0, usrsocktest_daemon_get_num_remote_disconnected_sockets());
|
TEST_ASSERT_EQUAL(0,
|
||||||
|
usrsocktest_daemon_get_num_remote_disconnected_sockets());
|
||||||
|
|
||||||
/* Disconnect connections. */
|
/* Disconnect connections. */
|
||||||
|
|
||||||
TEST_ASSERT_TRUE(usrsocktest_send_delayed_command('D', 0));
|
TEST_ASSERT_TRUE(usrsocktest_send_delayed_command('D', 0));
|
||||||
for (count = 0; usrsocktest_daemon_get_num_connected_sockets() > 0; count++)
|
for (count = 0; usrsocktest_daemon_get_num_connected_sockets() > 0;
|
||||||
|
count++)
|
||||||
{
|
{
|
||||||
TEST_ASSERT_TRUE(count <= 3);
|
TEST_ASSERT_TRUE(count <= 3);
|
||||||
usleep(5 * 1000);
|
usleep(5 * 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_ASSERT_EQUAL(0, usrsocktest_daemon_get_num_connected_sockets());
|
TEST_ASSERT_EQUAL(0, usrsocktest_daemon_get_num_connected_sockets());
|
||||||
TEST_ASSERT_EQUAL(1, usrsocktest_daemon_get_num_remote_disconnected_sockets());
|
TEST_ASSERT_EQUAL(1,
|
||||||
|
usrsocktest_daemon_get_num_remote_disconnected_sockets());
|
||||||
|
|
||||||
for (count = 0; count < 2; count++)
|
for (count = 0; count < 2; count++)
|
||||||
{
|
{
|
||||||
@ -299,7 +305,8 @@ static void Send(struct usrsocktest_daemon_conf_s *dconf)
|
|||||||
TEST_ASSERT_EQUAL(-1, ret);
|
TEST_ASSERT_EQUAL(-1, ret);
|
||||||
TEST_ASSERT_EQUAL(EPIPE, errno);
|
TEST_ASSERT_EQUAL(EPIPE, errno);
|
||||||
TEST_ASSERT_EQUAL(0, usrsocktest_daemon_get_num_connected_sockets());
|
TEST_ASSERT_EQUAL(0, usrsocktest_daemon_get_num_connected_sockets());
|
||||||
TEST_ASSERT_EQUAL(1, usrsocktest_daemon_get_num_remote_disconnected_sockets());
|
TEST_ASSERT_EQUAL(1,
|
||||||
|
usrsocktest_daemon_get_num_remote_disconnected_sockets());
|
||||||
TEST_ASSERT_EQUAL(1, usrsocktest_daemon_get_num_active_sockets());
|
TEST_ASSERT_EQUAL(1, usrsocktest_daemon_get_num_active_sockets());
|
||||||
TEST_ASSERT_EQUAL(0, usrsocktest_daemon_get_send_bytes());
|
TEST_ASSERT_EQUAL(0, usrsocktest_daemon_get_send_bytes());
|
||||||
}
|
}
|
||||||
@ -322,7 +329,7 @@ static void Send(struct usrsocktest_daemon_conf_s *dconf)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: Send2
|
* Name: remote_disconnect_send2
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Send and disconnect
|
* Send and disconnect
|
||||||
@ -338,7 +345,7 @@ static void Send(struct usrsocktest_daemon_conf_s *dconf)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static void Send2(struct usrsocktest_daemon_conf_s *dconf)
|
static void remote_disconnect_send2(struct usrsocktest_daemon_conf_s *dconf)
|
||||||
{
|
{
|
||||||
ssize_t ret;
|
ssize_t ret;
|
||||||
size_t datalen;
|
size_t datalen;
|
||||||
@ -366,7 +373,8 @@ static void Send2(struct usrsocktest_daemon_conf_s *dconf)
|
|||||||
TEST_ASSERT_EQUAL(0, usrsocktest_daemon_get_num_waiting_connect_sockets());
|
TEST_ASSERT_EQUAL(0, usrsocktest_daemon_get_num_waiting_connect_sockets());
|
||||||
TEST_ASSERT_EQUAL(1, usrsocktest_daemon_get_num_recv_empty_sockets());
|
TEST_ASSERT_EQUAL(1, usrsocktest_daemon_get_num_recv_empty_sockets());
|
||||||
TEST_ASSERT_EQUAL(0, usrsocktest_daemon_get_num_unreachable_sockets());
|
TEST_ASSERT_EQUAL(0, usrsocktest_daemon_get_num_unreachable_sockets());
|
||||||
TEST_ASSERT_EQUAL(0, usrsocktest_daemon_get_num_remote_disconnected_sockets());
|
TEST_ASSERT_EQUAL(0,
|
||||||
|
usrsocktest_daemon_get_num_remote_disconnected_sockets());
|
||||||
|
|
||||||
/* Try connect. */
|
/* Try connect. */
|
||||||
|
|
||||||
@ -379,7 +387,8 @@ static void Send2(struct usrsocktest_daemon_conf_s *dconf)
|
|||||||
TEST_ASSERT_EQUAL(1, usrsocktest_daemon_get_num_connected_sockets());
|
TEST_ASSERT_EQUAL(1, usrsocktest_daemon_get_num_connected_sockets());
|
||||||
TEST_ASSERT_EQUAL(0, usrsocktest_daemon_get_num_waiting_connect_sockets());
|
TEST_ASSERT_EQUAL(0, usrsocktest_daemon_get_num_waiting_connect_sockets());
|
||||||
TEST_ASSERT_EQUAL(0, usrsocktest_daemon_get_num_unreachable_sockets());
|
TEST_ASSERT_EQUAL(0, usrsocktest_daemon_get_num_unreachable_sockets());
|
||||||
TEST_ASSERT_EQUAL(0, usrsocktest_daemon_get_num_remote_disconnected_sockets());
|
TEST_ASSERT_EQUAL(0,
|
||||||
|
usrsocktest_daemon_get_num_remote_disconnected_sockets());
|
||||||
|
|
||||||
/* Disconnect connections with delay. */
|
/* Disconnect connections with delay. */
|
||||||
|
|
||||||
@ -396,7 +405,8 @@ static void Send2(struct usrsocktest_daemon_conf_s *dconf)
|
|||||||
TEST_ASSERT_EQUAL(EPIPE, errno);
|
TEST_ASSERT_EQUAL(EPIPE, errno);
|
||||||
TEST_ASSERT_EQUAL(0, usrsocktest_daemon_get_num_connected_sockets());
|
TEST_ASSERT_EQUAL(0, usrsocktest_daemon_get_num_connected_sockets());
|
||||||
TEST_ASSERT_EQUAL(1, usrsocktest_daemon_get_num_active_sockets());
|
TEST_ASSERT_EQUAL(1, usrsocktest_daemon_get_num_active_sockets());
|
||||||
TEST_ASSERT_EQUAL(1, usrsocktest_daemon_get_num_remote_disconnected_sockets());
|
TEST_ASSERT_EQUAL(1,
|
||||||
|
usrsocktest_daemon_get_num_remote_disconnected_sockets());
|
||||||
TEST_ASSERT_EQUAL(0, usrsocktest_daemon_get_send_bytes());
|
TEST_ASSERT_EQUAL(0, usrsocktest_daemon_get_send_bytes());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -418,7 +428,7 @@ static void Send2(struct usrsocktest_daemon_conf_s *dconf)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: Receive
|
* Name: receive
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Receive and disconnect
|
* Receive and disconnect
|
||||||
@ -434,7 +444,7 @@ static void Send2(struct usrsocktest_daemon_conf_s *dconf)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static void Receive(struct usrsocktest_daemon_conf_s *dconf)
|
static void receive(struct usrsocktest_daemon_conf_s *dconf)
|
||||||
{
|
{
|
||||||
ssize_t ret;
|
ssize_t ret;
|
||||||
size_t datalen;
|
size_t datalen;
|
||||||
@ -475,19 +485,23 @@ static void Receive(struct usrsocktest_daemon_conf_s *dconf)
|
|||||||
TEST_ASSERT_EQUAL(1, usrsocktest_daemon_get_num_connected_sockets());
|
TEST_ASSERT_EQUAL(1, usrsocktest_daemon_get_num_connected_sockets());
|
||||||
TEST_ASSERT_EQUAL(0, usrsocktest_daemon_get_num_waiting_connect_sockets());
|
TEST_ASSERT_EQUAL(0, usrsocktest_daemon_get_num_waiting_connect_sockets());
|
||||||
TEST_ASSERT_EQUAL(0, usrsocktest_daemon_get_num_unreachable_sockets());
|
TEST_ASSERT_EQUAL(0, usrsocktest_daemon_get_num_unreachable_sockets());
|
||||||
TEST_ASSERT_EQUAL(0, usrsocktest_daemon_get_num_remote_disconnected_sockets());
|
TEST_ASSERT_EQUAL(0,
|
||||||
|
usrsocktest_daemon_get_num_remote_disconnected_sockets());
|
||||||
TEST_ASSERT_EQUAL(0, usrsocktest_daemon_get_num_recv_empty_sockets());
|
TEST_ASSERT_EQUAL(0, usrsocktest_daemon_get_num_recv_empty_sockets());
|
||||||
|
|
||||||
/* Disconnect connections. */
|
/* Disconnect connections. */
|
||||||
|
|
||||||
TEST_ASSERT_TRUE(usrsocktest_send_delayed_command('D', 0));
|
TEST_ASSERT_TRUE(usrsocktest_send_delayed_command('D', 0));
|
||||||
for (count = 0; usrsocktest_daemon_get_num_connected_sockets() > 0; count++)
|
for (count = 0; usrsocktest_daemon_get_num_connected_sockets() > 0;
|
||||||
|
count++)
|
||||||
{
|
{
|
||||||
TEST_ASSERT_TRUE(count <= 3);
|
TEST_ASSERT_TRUE(count <= 3);
|
||||||
usleep(5 * 1000);
|
usleep(5 * 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_ASSERT_EQUAL(0, usrsocktest_daemon_get_num_connected_sockets());
|
TEST_ASSERT_EQUAL(0, usrsocktest_daemon_get_num_connected_sockets());
|
||||||
TEST_ASSERT_EQUAL(1, usrsocktest_daemon_get_num_remote_disconnected_sockets());
|
TEST_ASSERT_EQUAL(1,
|
||||||
|
usrsocktest_daemon_get_num_remote_disconnected_sockets());
|
||||||
TEST_ASSERT_EQUAL(0, usrsocktest_daemon_get_num_recv_empty_sockets());
|
TEST_ASSERT_EQUAL(0, usrsocktest_daemon_get_num_recv_empty_sockets());
|
||||||
|
|
||||||
for (count = 0; count < 2; count++)
|
for (count = 0; count < 2; count++)
|
||||||
@ -499,7 +513,8 @@ static void Receive(struct usrsocktest_daemon_conf_s *dconf)
|
|||||||
ret = read(sd, data, datalen);
|
ret = read(sd, data, datalen);
|
||||||
TEST_ASSERT_EQUAL(0, ret);
|
TEST_ASSERT_EQUAL(0, ret);
|
||||||
TEST_ASSERT_EQUAL(0, usrsocktest_daemon_get_num_connected_sockets());
|
TEST_ASSERT_EQUAL(0, usrsocktest_daemon_get_num_connected_sockets());
|
||||||
TEST_ASSERT_EQUAL(1, usrsocktest_daemon_get_num_remote_disconnected_sockets());
|
TEST_ASSERT_EQUAL(1,
|
||||||
|
usrsocktest_daemon_get_num_remote_disconnected_sockets());
|
||||||
TEST_ASSERT_EQUAL(1, usrsocktest_daemon_get_num_active_sockets());
|
TEST_ASSERT_EQUAL(1, usrsocktest_daemon_get_num_active_sockets());
|
||||||
TEST_ASSERT_EQUAL(0, usrsocktest_daemon_get_recv_bytes());
|
TEST_ASSERT_EQUAL(0, usrsocktest_daemon_get_recv_bytes());
|
||||||
}
|
}
|
||||||
@ -522,7 +537,7 @@ static void Receive(struct usrsocktest_daemon_conf_s *dconf)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: Receive2
|
* Name: receive2
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Receive and disconnect
|
* Receive and disconnect
|
||||||
@ -538,7 +553,7 @@ static void Receive(struct usrsocktest_daemon_conf_s *dconf)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static void Receive2(struct usrsocktest_daemon_conf_s *dconf)
|
static void receive2(struct usrsocktest_daemon_conf_s *dconf)
|
||||||
{
|
{
|
||||||
ssize_t ret;
|
ssize_t ret;
|
||||||
size_t datalen;
|
size_t datalen;
|
||||||
@ -568,7 +583,8 @@ static void Receive2(struct usrsocktest_daemon_conf_s *dconf)
|
|||||||
TEST_ASSERT_EQUAL(0, usrsocktest_daemon_get_num_waiting_connect_sockets());
|
TEST_ASSERT_EQUAL(0, usrsocktest_daemon_get_num_waiting_connect_sockets());
|
||||||
TEST_ASSERT_EQUAL(1, usrsocktest_daemon_get_num_recv_empty_sockets());
|
TEST_ASSERT_EQUAL(1, usrsocktest_daemon_get_num_recv_empty_sockets());
|
||||||
TEST_ASSERT_EQUAL(0, usrsocktest_daemon_get_num_unreachable_sockets());
|
TEST_ASSERT_EQUAL(0, usrsocktest_daemon_get_num_unreachable_sockets());
|
||||||
TEST_ASSERT_EQUAL(0, usrsocktest_daemon_get_num_remote_disconnected_sockets());
|
TEST_ASSERT_EQUAL(0,
|
||||||
|
usrsocktest_daemon_get_num_remote_disconnected_sockets());
|
||||||
|
|
||||||
/* Try connect. */
|
/* Try connect. */
|
||||||
|
|
||||||
@ -581,7 +597,8 @@ static void Receive2(struct usrsocktest_daemon_conf_s *dconf)
|
|||||||
TEST_ASSERT_EQUAL(1, usrsocktest_daemon_get_num_connected_sockets());
|
TEST_ASSERT_EQUAL(1, usrsocktest_daemon_get_num_connected_sockets());
|
||||||
TEST_ASSERT_EQUAL(0, usrsocktest_daemon_get_num_waiting_connect_sockets());
|
TEST_ASSERT_EQUAL(0, usrsocktest_daemon_get_num_waiting_connect_sockets());
|
||||||
TEST_ASSERT_EQUAL(0, usrsocktest_daemon_get_num_unreachable_sockets());
|
TEST_ASSERT_EQUAL(0, usrsocktest_daemon_get_num_unreachable_sockets());
|
||||||
TEST_ASSERT_EQUAL(0, usrsocktest_daemon_get_num_remote_disconnected_sockets());
|
TEST_ASSERT_EQUAL(0,
|
||||||
|
usrsocktest_daemon_get_num_remote_disconnected_sockets());
|
||||||
|
|
||||||
/* Disconnect connections with delay. */
|
/* Disconnect connections with delay. */
|
||||||
|
|
||||||
@ -596,7 +613,8 @@ static void Receive2(struct usrsocktest_daemon_conf_s *dconf)
|
|||||||
ret = read(sd, data, datalen);
|
ret = read(sd, data, datalen);
|
||||||
TEST_ASSERT_EQUAL(0, ret);
|
TEST_ASSERT_EQUAL(0, ret);
|
||||||
TEST_ASSERT_EQUAL(0, usrsocktest_daemon_get_num_connected_sockets());
|
TEST_ASSERT_EQUAL(0, usrsocktest_daemon_get_num_connected_sockets());
|
||||||
TEST_ASSERT_EQUAL(1, usrsocktest_daemon_get_num_remote_disconnected_sockets());
|
TEST_ASSERT_EQUAL(1,
|
||||||
|
usrsocktest_daemon_get_num_remote_disconnected_sockets());
|
||||||
TEST_ASSERT_EQUAL(1, usrsocktest_daemon_get_num_active_sockets());
|
TEST_ASSERT_EQUAL(1, usrsocktest_daemon_get_num_active_sockets());
|
||||||
TEST_ASSERT_EQUAL(0, usrsocktest_daemon_get_recv_bytes());
|
TEST_ASSERT_EQUAL(0, usrsocktest_daemon_get_recv_bytes());
|
||||||
}
|
}
|
||||||
@ -619,7 +637,7 @@ static void Receive2(struct usrsocktest_daemon_conf_s *dconf)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: Poll
|
* Name: remote_disconnect_poll
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Poll and disconnect
|
* Poll and disconnect
|
||||||
@ -635,7 +653,7 @@ static void Receive2(struct usrsocktest_daemon_conf_s *dconf)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static void Poll(struct usrsocktest_daemon_conf_s *dconf)
|
static void remote_disconnect_poll(struct usrsocktest_daemon_conf_s *dconf)
|
||||||
{
|
{
|
||||||
ssize_t ret;
|
ssize_t ret;
|
||||||
struct sockaddr_in addr;
|
struct sockaddr_in addr;
|
||||||
@ -713,7 +731,8 @@ static void Poll(struct usrsocktest_daemon_conf_s *dconf)
|
|||||||
TEST_ASSERT_EQUAL(0, pfd.revents & POLLOUT);
|
TEST_ASSERT_EQUAL(0, pfd.revents & POLLOUT);
|
||||||
TEST_ASSERT_EQUAL(1, usrsocktest_daemon_get_num_active_sockets());
|
TEST_ASSERT_EQUAL(1, usrsocktest_daemon_get_num_active_sockets());
|
||||||
TEST_ASSERT_EQUAL(0, usrsocktest_daemon_get_num_connected_sockets());
|
TEST_ASSERT_EQUAL(0, usrsocktest_daemon_get_num_connected_sockets());
|
||||||
TEST_ASSERT_EQUAL(0, usrsocktest_daemon_get_num_remote_disconnected_sockets());
|
TEST_ASSERT_EQUAL(0,
|
||||||
|
usrsocktest_daemon_get_num_remote_disconnected_sockets());
|
||||||
TEST_ASSERT_EQUAL(1, usrsocktest_daemon_get_num_unreachable_sockets());
|
TEST_ASSERT_EQUAL(1, usrsocktest_daemon_get_num_unreachable_sockets());
|
||||||
|
|
||||||
/* Close socket */
|
/* Close socket */
|
||||||
@ -734,7 +753,7 @@ static void Poll(struct usrsocktest_daemon_conf_s *dconf)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: Poll2
|
* Name: remote_disconnect_poll2
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Poll and disconnect
|
* Poll and disconnect
|
||||||
@ -750,7 +769,7 @@ static void Poll(struct usrsocktest_daemon_conf_s *dconf)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static void Poll2(struct usrsocktest_daemon_conf_s *dconf)
|
static void remote_disconnect_poll2(struct usrsocktest_daemon_conf_s *dconf)
|
||||||
{
|
{
|
||||||
ssize_t ret;
|
ssize_t ret;
|
||||||
size_t datalen;
|
size_t datalen;
|
||||||
@ -776,7 +795,8 @@ static void Poll2(struct usrsocktest_daemon_conf_s *dconf)
|
|||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
TEST_ASSERT_TRUE(*events == POLLIN || *events == POLLOUT || *events == (POLLOUT|POLLIN));
|
TEST_ASSERT_TRUE(*events == POLLIN || *events == POLLOUT ||
|
||||||
|
*events == (POLLOUT | POLLIN));
|
||||||
|
|
||||||
/* Open socket */
|
/* Open socket */
|
||||||
|
|
||||||
@ -784,7 +804,8 @@ static void Poll2(struct usrsocktest_daemon_conf_s *dconf)
|
|||||||
TEST_ASSERT_TRUE(sd >= 0);
|
TEST_ASSERT_TRUE(sd >= 0);
|
||||||
TEST_ASSERT_EQUAL(1, usrsocktest_daemon_get_num_active_sockets());
|
TEST_ASSERT_EQUAL(1, usrsocktest_daemon_get_num_active_sockets());
|
||||||
TEST_ASSERT_EQUAL(0, usrsocktest_daemon_get_num_connected_sockets());
|
TEST_ASSERT_EQUAL(0, usrsocktest_daemon_get_num_connected_sockets());
|
||||||
TEST_ASSERT_EQUAL(0, usrsocktest_daemon_get_num_waiting_connect_sockets());
|
TEST_ASSERT_EQUAL(0,
|
||||||
|
usrsocktest_daemon_get_num_waiting_connect_sockets());
|
||||||
|
|
||||||
/* Make socket non-blocking */
|
/* Make socket non-blocking */
|
||||||
|
|
||||||
@ -821,29 +842,37 @@ static void Poll2(struct usrsocktest_daemon_conf_s *dconf)
|
|||||||
{
|
{
|
||||||
TEST_ASSERT_EQUAL(0, ret);
|
TEST_ASSERT_EQUAL(0, ret);
|
||||||
TEST_ASSERT_EQUAL(1, usrsocktest_daemon_get_num_active_sockets());
|
TEST_ASSERT_EQUAL(1, usrsocktest_daemon_get_num_active_sockets());
|
||||||
TEST_ASSERT_EQUAL(1, usrsocktest_daemon_get_num_connected_sockets());
|
TEST_ASSERT_EQUAL(1,
|
||||||
TEST_ASSERT_EQUAL(0, usrsocktest_daemon_get_num_waiting_connect_sockets());
|
usrsocktest_daemon_get_num_connected_sockets());
|
||||||
TEST_ASSERT_EQUAL(1, usrsocktest_daemon_get_num_recv_empty_sockets());
|
TEST_ASSERT_EQUAL(0,
|
||||||
|
usrsocktest_daemon_get_num_waiting_connect_sockets());
|
||||||
|
TEST_ASSERT_EQUAL(1,
|
||||||
|
usrsocktest_daemon_get_num_recv_empty_sockets());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
TEST_ASSERT_EQUAL(-1, ret);
|
TEST_ASSERT_EQUAL(-1, ret);
|
||||||
TEST_ASSERT_EQUAL(EINPROGRESS, errno);
|
TEST_ASSERT_EQUAL(EINPROGRESS, errno);
|
||||||
TEST_ASSERT_EQUAL(1, usrsocktest_daemon_get_num_active_sockets());
|
TEST_ASSERT_EQUAL(1, usrsocktest_daemon_get_num_active_sockets());
|
||||||
TEST_ASSERT_EQUAL(0, usrsocktest_daemon_get_num_connected_sockets());
|
TEST_ASSERT_EQUAL(0,
|
||||||
|
usrsocktest_daemon_get_num_connected_sockets());
|
||||||
|
|
||||||
for (count = 0; usrsocktest_daemon_get_num_connected_sockets() != 1; count++)
|
for (count = 0;
|
||||||
|
usrsocktest_daemon_get_num_connected_sockets() != 1; count++)
|
||||||
{
|
{
|
||||||
TEST_ASSERT_TRUE(count <= 3);
|
TEST_ASSERT_TRUE(count <= 3);
|
||||||
usleep(25 * 1000);
|
usleep(25 * 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = connect(sd, (FAR const struct sockaddr *)&addr, sizeof(addr));
|
ret = connect(sd, (FAR const struct sockaddr *)&addr,
|
||||||
|
sizeof(addr));
|
||||||
TEST_ASSERT_EQUAL(-1, ret);
|
TEST_ASSERT_EQUAL(-1, ret);
|
||||||
TEST_ASSERT_EQUAL(EISCONN, errno);
|
TEST_ASSERT_EQUAL(EISCONN, errno);
|
||||||
TEST_ASSERT_EQUAL(1, usrsocktest_daemon_get_num_active_sockets());
|
TEST_ASSERT_EQUAL(1, usrsocktest_daemon_get_num_active_sockets());
|
||||||
TEST_ASSERT_EQUAL(1, usrsocktest_daemon_get_num_connected_sockets());
|
TEST_ASSERT_EQUAL(1,
|
||||||
TEST_ASSERT_EQUAL(1, usrsocktest_daemon_get_num_recv_empty_sockets());
|
usrsocktest_daemon_get_num_connected_sockets());
|
||||||
|
TEST_ASSERT_EQUAL(1,
|
||||||
|
usrsocktest_daemon_get_num_recv_empty_sockets());
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Poll for output (no timeout). Close connection. */
|
/* Poll for output (no timeout). Close connection. */
|
||||||
@ -860,7 +889,8 @@ static void Poll2(struct usrsocktest_daemon_conf_s *dconf)
|
|||||||
TEST_ASSERT_EQUAL(0, pfd.revents & POLLOUT);
|
TEST_ASSERT_EQUAL(0, pfd.revents & POLLOUT);
|
||||||
TEST_ASSERT_EQUAL(1, usrsocktest_daemon_get_num_active_sockets());
|
TEST_ASSERT_EQUAL(1, usrsocktest_daemon_get_num_active_sockets());
|
||||||
TEST_ASSERT_EQUAL(0, usrsocktest_daemon_get_num_connected_sockets());
|
TEST_ASSERT_EQUAL(0, usrsocktest_daemon_get_num_connected_sockets());
|
||||||
TEST_ASSERT_EQUAL(1, usrsocktest_daemon_get_num_remote_disconnected_sockets());
|
TEST_ASSERT_EQUAL(1,
|
||||||
|
usrsocktest_daemon_get_num_remote_disconnected_sockets());
|
||||||
|
|
||||||
for (count = 0; count < 2; count++)
|
for (count = 0; count < 2; count++)
|
||||||
{
|
{
|
||||||
@ -870,8 +900,10 @@ static void Poll2(struct usrsocktest_daemon_conf_s *dconf)
|
|||||||
datalen = sizeof(databuf);
|
datalen = sizeof(databuf);
|
||||||
ret = read(sd, data, datalen);
|
ret = read(sd, data, datalen);
|
||||||
TEST_ASSERT_EQUAL(0, ret);
|
TEST_ASSERT_EQUAL(0, ret);
|
||||||
TEST_ASSERT_EQUAL(0, usrsocktest_daemon_get_num_connected_sockets());
|
TEST_ASSERT_EQUAL(0,
|
||||||
TEST_ASSERT_EQUAL(1, usrsocktest_daemon_get_num_remote_disconnected_sockets());
|
usrsocktest_daemon_get_num_connected_sockets());
|
||||||
|
TEST_ASSERT_EQUAL(1,
|
||||||
|
usrsocktest_daemon_get_num_remote_disconnected_sockets());
|
||||||
TEST_ASSERT_EQUAL(1, usrsocktest_daemon_get_num_active_sockets());
|
TEST_ASSERT_EQUAL(1, usrsocktest_daemon_get_num_active_sockets());
|
||||||
TEST_ASSERT_EQUAL(0, usrsocktest_daemon_get_recv_bytes());
|
TEST_ASSERT_EQUAL(0, usrsocktest_daemon_get_recv_bytes());
|
||||||
}
|
}
|
||||||
@ -885,9 +917,11 @@ static void Poll2(struct usrsocktest_daemon_conf_s *dconf)
|
|||||||
ret = write(sd, data, datalen);
|
ret = write(sd, data, datalen);
|
||||||
TEST_ASSERT_EQUAL(-1, ret);
|
TEST_ASSERT_EQUAL(-1, ret);
|
||||||
TEST_ASSERT_EQUAL(EPIPE, errno);
|
TEST_ASSERT_EQUAL(EPIPE, errno);
|
||||||
TEST_ASSERT_EQUAL(0, usrsocktest_daemon_get_num_connected_sockets());
|
TEST_ASSERT_EQUAL(0,
|
||||||
|
usrsocktest_daemon_get_num_connected_sockets());
|
||||||
TEST_ASSERT_EQUAL(1, usrsocktest_daemon_get_num_active_sockets());
|
TEST_ASSERT_EQUAL(1, usrsocktest_daemon_get_num_active_sockets());
|
||||||
TEST_ASSERT_EQUAL(1, usrsocktest_daemon_get_num_remote_disconnected_sockets());
|
TEST_ASSERT_EQUAL(1,
|
||||||
|
usrsocktest_daemon_get_num_remote_disconnected_sockets());
|
||||||
TEST_ASSERT_EQUAL(0, usrsocktest_daemon_get_send_bytes());
|
TEST_ASSERT_EQUAL(0, usrsocktest_daemon_get_send_bytes());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -913,7 +947,7 @@ static void Poll2(struct usrsocktest_daemon_conf_s *dconf)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: RemoteDisconnect test group setup
|
* Name: remote_disconnect test group setup
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Setup function executed before each testcase in this test group
|
* Setup function executed before each testcase in this test group
|
||||||
@ -929,14 +963,14 @@ static void Poll2(struct usrsocktest_daemon_conf_s *dconf)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
TEST_SETUP(RemoteDisconnect)
|
TEST_SETUP(remote_disconnect)
|
||||||
{
|
{
|
||||||
sd = -1;
|
sd = -1;
|
||||||
started = false;
|
started = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: RemoteDisconnect test group teardown
|
* Name: remote_disconnect test group teardown
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Setup function executed after each testcase in this test group
|
* Setup function executed after each testcase in this test group
|
||||||
@ -952,14 +986,16 @@ TEST_SETUP(RemoteDisconnect)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
TEST_TEAR_DOWN(RemoteDisconnect)
|
TEST_TEAR_DOWN(remote_disconnect)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (sd >= 0)
|
if (sd >= 0)
|
||||||
{
|
{
|
||||||
ret = close(sd);
|
ret = close(sd);
|
||||||
assert(ret >= 0);
|
assert(ret >= 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (started)
|
if (started)
|
||||||
{
|
{
|
||||||
ret = usrsocktest_daemon_stop();
|
ret = usrsocktest_daemon_stop();
|
||||||
@ -967,115 +1003,115 @@ TEST_TEAR_DOWN(RemoteDisconnect)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(RemoteDisconnect, Unreachable)
|
TEST(remote_disconnect, unreachable)
|
||||||
{
|
{
|
||||||
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
||||||
Unreachable(&usrsocktest_daemon_config);
|
unreachable(&usrsocktest_daemon_config);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(RemoteDisconnect, UnreachableDelay)
|
TEST(remote_disconnect, unreachable_delay)
|
||||||
{
|
{
|
||||||
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
||||||
usrsocktest_daemon_config.delay_all_responses = true;
|
usrsocktest_daemon_config.delay_all_responses = true;
|
||||||
Unreachable(&usrsocktest_daemon_config);
|
unreachable(&usrsocktest_daemon_config);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(RemoteDisconnect, Send)
|
TEST(remote_disconnect, remote_disconnect_send)
|
||||||
{
|
{
|
||||||
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
||||||
Send(&usrsocktest_daemon_config);
|
remote_disconnect_send(&usrsocktest_daemon_config);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(RemoteDisconnect, SendDelay)
|
TEST(remote_disconnect, remote_disconnect_send_delay)
|
||||||
{
|
{
|
||||||
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
||||||
usrsocktest_daemon_config.delay_all_responses = true;
|
usrsocktest_daemon_config.delay_all_responses = true;
|
||||||
Send(&usrsocktest_daemon_config);
|
remote_disconnect_send(&usrsocktest_daemon_config);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(RemoteDisconnect, Send2)
|
TEST(remote_disconnect, remote_disconnect_send2)
|
||||||
{
|
{
|
||||||
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
||||||
Send2(&usrsocktest_daemon_config);
|
remote_disconnect_send2(&usrsocktest_daemon_config);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(RemoteDisconnect, Send2Delay)
|
TEST(remote_disconnect, remote_disconnect_send2_delay)
|
||||||
{
|
{
|
||||||
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
||||||
usrsocktest_daemon_config.delay_all_responses = true;
|
usrsocktest_daemon_config.delay_all_responses = true;
|
||||||
Send2(&usrsocktest_daemon_config);
|
remote_disconnect_send2(&usrsocktest_daemon_config);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(RemoteDisconnect, Receive)
|
TEST(remote_disconnect, receive)
|
||||||
{
|
{
|
||||||
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
||||||
Receive(&usrsocktest_daemon_config);
|
receive(&usrsocktest_daemon_config);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(RemoteDisconnect, ReceiveDelay)
|
TEST(remote_disconnect, receive_delay)
|
||||||
{
|
{
|
||||||
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
||||||
usrsocktest_daemon_config.delay_all_responses = true;
|
usrsocktest_daemon_config.delay_all_responses = true;
|
||||||
Receive(&usrsocktest_daemon_config);
|
receive(&usrsocktest_daemon_config);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(RemoteDisconnect, Receive2)
|
TEST(remote_disconnect, receive2)
|
||||||
{
|
{
|
||||||
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
||||||
Receive2(&usrsocktest_daemon_config);
|
receive2(&usrsocktest_daemon_config);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(RemoteDisconnect, Receive2Delay)
|
TEST(remote_disconnect, receive2_delay)
|
||||||
{
|
{
|
||||||
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
||||||
usrsocktest_daemon_config.delay_all_responses = true;
|
usrsocktest_daemon_config.delay_all_responses = true;
|
||||||
Receive2(&usrsocktest_daemon_config);
|
receive2(&usrsocktest_daemon_config);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(RemoteDisconnect, Poll)
|
TEST(remote_disconnect, remote_disconnect_poll)
|
||||||
{
|
{
|
||||||
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
||||||
Poll(&usrsocktest_daemon_config);
|
remote_disconnect_poll(&usrsocktest_daemon_config);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(RemoteDisconnect, PollDelay)
|
TEST(remote_disconnect, remote_disconnect_poll_delay)
|
||||||
{
|
{
|
||||||
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
||||||
usrsocktest_daemon_config.delay_all_responses = true;
|
usrsocktest_daemon_config.delay_all_responses = true;
|
||||||
Poll(&usrsocktest_daemon_config);
|
remote_disconnect_poll(&usrsocktest_daemon_config);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(RemoteDisconnect, Poll2)
|
TEST(remote_disconnect, remote_disconnect_poll2)
|
||||||
{
|
{
|
||||||
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
||||||
Poll2(&usrsocktest_daemon_config);
|
remote_disconnect_poll2(&usrsocktest_daemon_config);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(RemoteDisconnect, Poll2Delay)
|
TEST(remote_disconnect, remote_disconnect_poll2_delay)
|
||||||
{
|
{
|
||||||
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
usrsocktest_daemon_config = usrsocktest_daemon_defconf;
|
||||||
usrsocktest_daemon_config.delay_all_responses = true;
|
usrsocktest_daemon_config.delay_all_responses = true;
|
||||||
Poll2(&usrsocktest_daemon_config);
|
remote_disconnect_poll2(&usrsocktest_daemon_config);
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
TEST_GROUP(RemoteDisconnect)
|
TEST_GROUP(remote_disconnect)
|
||||||
{
|
{
|
||||||
RUN_TEST_CASE(RemoteDisconnect, Unreachable);
|
RUN_TEST_CASE(remote_disconnect, unreachable);
|
||||||
RUN_TEST_CASE(RemoteDisconnect, UnreachableDelay);
|
RUN_TEST_CASE(remote_disconnect, unreachable_delay);
|
||||||
RUN_TEST_CASE(RemoteDisconnect, Send);
|
RUN_TEST_CASE(remote_disconnect, remote_disconnect_send);
|
||||||
RUN_TEST_CASE(RemoteDisconnect, SendDelay);
|
RUN_TEST_CASE(remote_disconnect, remote_disconnect_send_delay);
|
||||||
RUN_TEST_CASE(RemoteDisconnect, Send2);
|
RUN_TEST_CASE(remote_disconnect, remote_disconnect_send2);
|
||||||
RUN_TEST_CASE(RemoteDisconnect, Send2Delay);
|
RUN_TEST_CASE(remote_disconnect, remote_disconnect_send2_delay);
|
||||||
RUN_TEST_CASE(RemoteDisconnect, Receive);
|
RUN_TEST_CASE(remote_disconnect, receive);
|
||||||
RUN_TEST_CASE(RemoteDisconnect, ReceiveDelay);
|
RUN_TEST_CASE(remote_disconnect, receive_delay);
|
||||||
RUN_TEST_CASE(RemoteDisconnect, Receive2);
|
RUN_TEST_CASE(remote_disconnect, receive2);
|
||||||
RUN_TEST_CASE(RemoteDisconnect, Receive2Delay);
|
RUN_TEST_CASE(remote_disconnect, receive2_delay);
|
||||||
RUN_TEST_CASE(RemoteDisconnect, Poll);
|
RUN_TEST_CASE(remote_disconnect, remote_disconnect_poll);
|
||||||
RUN_TEST_CASE(RemoteDisconnect, PollDelay);
|
RUN_TEST_CASE(remote_disconnect, remote_disconnect_poll_delay);
|
||||||
RUN_TEST_CASE(RemoteDisconnect, Poll2);
|
RUN_TEST_CASE(remote_disconnect, remote_disconnect_poll2);
|
||||||
RUN_TEST_CASE(RemoteDisconnect, Poll2Delay);
|
RUN_TEST_CASE(remote_disconnect, remote_disconnect_poll2_delay);
|
||||||
}
|
}
|
||||||
|
@ -78,13 +78,29 @@ enum e_test_type
|
|||||||
__TEST_TYPE_MAX,
|
__TEST_TYPE_MAX,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct thread_func
|
||||||
|
{
|
||||||
|
pthread_startroutine_t fn;
|
||||||
|
bool stop_only_on_hang;
|
||||||
|
};
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Function Prototypes
|
* Private Function Prototypes
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
static FAR void *usrsock_blocking_socket_thread(FAR void *param);
|
||||||
|
static FAR void *usrsock_blocking_close_thread(FAR void *param);
|
||||||
|
static FAR void *usrsock_blocking_connect_thread(FAR void *param);
|
||||||
|
static FAR void *usrsock_blocking_setsockopt_thread(FAR void *param);
|
||||||
|
static FAR void *usrsock_blocking_getsockopt_thread(FAR void *param);
|
||||||
|
static FAR void *usrsock_blocking_recv_thread(FAR void *param);
|
||||||
|
static FAR void *usrsock_blocking_send_thread(FAR void *param);
|
||||||
|
static FAR void *usrsock_blocking_poll_thread(FAR void *param);
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Data
|
* Private Data
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static pthread_t tid[MAX_THREADS];
|
static pthread_t tid[MAX_THREADS];
|
||||||
static sem_t tid_startsem;
|
static sem_t tid_startsem;
|
||||||
static sem_t tid_releasesem;
|
static sem_t tid_releasesem;
|
||||||
@ -92,6 +108,42 @@ static int test_sd[MAX_THREADS];
|
|||||||
static enum e_test_type test_type;
|
static enum e_test_type test_type;
|
||||||
static int test_flags;
|
static int test_flags;
|
||||||
|
|
||||||
|
static struct thread_func thread_funcs[__TEST_TYPE_MAX] =
|
||||||
|
{
|
||||||
|
[TEST_TYPE_SOCKET] =
|
||||||
|
{
|
||||||
|
usrsock_blocking_socket_thread, false
|
||||||
|
},
|
||||||
|
[TEST_TYPE_CLOSE] =
|
||||||
|
{
|
||||||
|
usrsock_blocking_close_thread, false
|
||||||
|
},
|
||||||
|
[TEST_TYPE_CONNECT] =
|
||||||
|
{
|
||||||
|
usrsock_blocking_connect_thread, true
|
||||||
|
},
|
||||||
|
[TEST_TYPE_SETSOCKOPT] =
|
||||||
|
{
|
||||||
|
usrsock_blocking_setsockopt_thread, false
|
||||||
|
},
|
||||||
|
[TEST_TYPE_GETSOCKOPT] =
|
||||||
|
{
|
||||||
|
usrsock_blocking_getsockopt_thread, false
|
||||||
|
},
|
||||||
|
[TEST_TYPE_RECV] =
|
||||||
|
{
|
||||||
|
usrsock_blocking_recv_thread, true
|
||||||
|
},
|
||||||
|
[TEST_TYPE_SEND] =
|
||||||
|
{
|
||||||
|
usrsock_blocking_send_thread, true
|
||||||
|
},
|
||||||
|
[TEST_TYPE_POLL] =
|
||||||
|
{
|
||||||
|
usrsock_blocking_poll_thread, true
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Data
|
* Public Data
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@ -289,7 +341,8 @@ static void do_usrsock_blocking_getsockopt_thread(FAR void *param)
|
|||||||
sem_post(&tid_startsem);
|
sem_post(&tid_startsem);
|
||||||
value = -1;
|
value = -1;
|
||||||
valuelen = sizeof(value);
|
valuelen = sizeof(value);
|
||||||
ret = getsockopt(test_sd[tidx], SOL_SOCKET, SO_REUSEADDR, &value, &valuelen);
|
ret = getsockopt(test_sd[tidx], SOL_SOCKET, SO_REUSEADDR, &value,
|
||||||
|
&valuelen);
|
||||||
TEST_ASSERT_EQUAL(-1, ret);
|
TEST_ASSERT_EQUAL(-1, ret);
|
||||||
|
|
||||||
/* Close socket */
|
/* Close socket */
|
||||||
@ -325,7 +378,8 @@ static void do_usrsock_blocking_send_thread(FAR void *param)
|
|||||||
|
|
||||||
/* Connect socket. */
|
/* Connect socket. */
|
||||||
|
|
||||||
ret = connect(test_sd[tidx], (FAR const struct sockaddr *)&addr, sizeof(addr));
|
ret = connect(test_sd[tidx], (FAR const struct sockaddr *)&addr,
|
||||||
|
sizeof(addr));
|
||||||
TEST_ASSERT_EQUAL(0, ret);
|
TEST_ASSERT_EQUAL(0, ret);
|
||||||
|
|
||||||
/* Allow main thread to hang usrsock daemon at this point. */
|
/* Allow main thread to hang usrsock daemon at this point. */
|
||||||
@ -373,7 +427,8 @@ static void do_usrsock_blocking_recv_thread(FAR void *param)
|
|||||||
|
|
||||||
/* Connect socket. */
|
/* Connect socket. */
|
||||||
|
|
||||||
ret = connect(test_sd[tidx], (FAR const struct sockaddr *)&addr, sizeof(addr));
|
ret = connect(test_sd[tidx], (FAR const struct sockaddr *)&addr,
|
||||||
|
sizeof(addr));
|
||||||
TEST_ASSERT_EQUAL(0, ret);
|
TEST_ASSERT_EQUAL(0, ret);
|
||||||
|
|
||||||
/* Allow main thread to hang usrsock daemon at this point. */
|
/* Allow main thread to hang usrsock daemon at this point. */
|
||||||
@ -405,7 +460,9 @@ static void do_usrsock_blocking_poll_thread(FAR void *param)
|
|||||||
intptr_t tidx = (intptr_t)param;
|
intptr_t tidx = (intptr_t)param;
|
||||||
struct sockaddr_in addr;
|
struct sockaddr_in addr;
|
||||||
int ret;
|
int ret;
|
||||||
struct pollfd pfd = {};
|
struct pollfd pfd = {
|
||||||
|
};
|
||||||
|
|
||||||
bool test_abort = !!(test_flags & TEST_FLAG_DAEMON_ABORT);
|
bool test_abort = !!(test_flags & TEST_FLAG_DAEMON_ABORT);
|
||||||
bool test_hang = !!(test_flags & TEST_FLAG_PAUSE_USRSOCK_HANDLING);
|
bool test_hang = !!(test_flags & TEST_FLAG_PAUSE_USRSOCK_HANDLING);
|
||||||
|
|
||||||
@ -423,7 +480,8 @@ static void do_usrsock_blocking_poll_thread(FAR void *param)
|
|||||||
|
|
||||||
/* Connect socket. */
|
/* Connect socket. */
|
||||||
|
|
||||||
ret = connect(test_sd[tidx], (FAR const struct sockaddr *)&addr, sizeof(addr));
|
ret = connect(test_sd[tidx], (FAR const struct sockaddr *)&addr,
|
||||||
|
sizeof(addr));
|
||||||
TEST_ASSERT_EQUAL(0, ret);
|
TEST_ASSERT_EQUAL(0, ret);
|
||||||
|
|
||||||
/* Allow main thread to hang usrsock daemon at this point. */
|
/* Allow main thread to hang usrsock daemon at this point. */
|
||||||
@ -461,21 +519,6 @@ static FAR void * usrsock_blocking_poll_thread(FAR void *param)
|
|||||||
|
|
||||||
static void do_wake_test(enum e_test_type type, int flags)
|
static void do_wake_test(enum e_test_type type, int flags)
|
||||||
{
|
{
|
||||||
static const struct
|
|
||||||
{
|
|
||||||
pthread_startroutine_t fn;
|
|
||||||
bool stop_only_on_hang;
|
|
||||||
} thread_funcs[__TEST_TYPE_MAX] =
|
|
||||||
{
|
|
||||||
[TEST_TYPE_SOCKET] = { usrsock_blocking_socket_thread, false },
|
|
||||||
[TEST_TYPE_CLOSE] = { usrsock_blocking_close_thread, false },
|
|
||||||
[TEST_TYPE_CONNECT] = { usrsock_blocking_connect_thread, true },
|
|
||||||
[TEST_TYPE_SETSOCKOPT] = { usrsock_blocking_setsockopt_thread, false },
|
|
||||||
[TEST_TYPE_GETSOCKOPT] = { usrsock_blocking_getsockopt_thread, false },
|
|
||||||
[TEST_TYPE_RECV] = { usrsock_blocking_recv_thread, true },
|
|
||||||
[TEST_TYPE_SEND] = { usrsock_blocking_send_thread, true },
|
|
||||||
[TEST_TYPE_POLL] = { usrsock_blocking_poll_thread, true },
|
|
||||||
};
|
|
||||||
int ret;
|
int ret;
|
||||||
int nthreads = (flags & TEST_FLAG_MULTI_THREAD) ? MAX_THREADS : 1;
|
int nthreads = (flags & TEST_FLAG_MULTI_THREAD) ? MAX_THREADS : 1;
|
||||||
int tidx;
|
int tidx;
|
||||||
@ -484,7 +527,8 @@ static void do_wake_test(enum e_test_type type, int flags)
|
|||||||
|
|
||||||
/* Start test daemon. */
|
/* Start test daemon. */
|
||||||
|
|
||||||
TEST_ASSERT_EQUAL(OK, usrsocktest_daemon_start(&usrsocktest_daemon_config));
|
TEST_ASSERT_EQUAL(OK,
|
||||||
|
usrsocktest_daemon_start(&usrsocktest_daemon_config));
|
||||||
TEST_ASSERT_EQUAL(0, usrsocktest_daemon_get_num_active_sockets());
|
TEST_ASSERT_EQUAL(0, usrsocktest_daemon_get_num_active_sockets());
|
||||||
|
|
||||||
/* Launch worker threads. */
|
/* Launch worker threads. */
|
||||||
@ -514,6 +558,7 @@ static void do_wake_test(enum e_test_type type, int flags)
|
|||||||
{
|
{
|
||||||
sem_post(&tid_releasesem);
|
sem_post(&tid_releasesem);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (tidx = 0; tidx < nthreads; tidx++)
|
for (tidx = 0; tidx < nthreads; tidx++)
|
||||||
{
|
{
|
||||||
sem_wait(&tid_startsem);
|
sem_wait(&tid_startsem);
|
||||||
@ -538,6 +583,7 @@ static void do_wake_test(enum e_test_type type, int flags)
|
|||||||
TEST_ASSERT_EQUAL(OK, ret);
|
TEST_ASSERT_EQUAL(OK, ret);
|
||||||
tid[tidx] = -1;
|
tid[tidx] = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_ASSERT_FALSE(usrsocktest_test_failed);
|
TEST_ASSERT_FALSE(usrsocktest_test_failed);
|
||||||
|
|
||||||
/* Stopping daemon should succeed. */
|
/* Stopping daemon should succeed. */
|
||||||
@ -564,12 +610,13 @@ static void do_wake_test(enum e_test_type type, int flags)
|
|||||||
TEST_ASSERT_EQUAL(OK, ret);
|
TEST_ASSERT_EQUAL(OK, ret);
|
||||||
tid[tidx] = -1;
|
tid[tidx] = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_ASSERT_FALSE(usrsocktest_test_failed);
|
TEST_ASSERT_FALSE(usrsocktest_test_failed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: WakeWithSignal test group setup
|
* Name: wake_with_signal test group setup
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Setup function executed before each testcase in this test group
|
* Setup function executed before each testcase in this test group
|
||||||
@ -585,7 +632,7 @@ static void do_wake_test(enum e_test_type type, int flags)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
TEST_SETUP(WakeWithSignal)
|
TEST_SETUP(wake_with_signal)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@ -594,12 +641,13 @@ TEST_SETUP(WakeWithSignal)
|
|||||||
tid[i] = -1;
|
tid[i] = -1;
|
||||||
test_sd[i] = -1;
|
test_sd[i] = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
sem_init(&tid_startsem, 0, 0);
|
sem_init(&tid_startsem, 0, 0);
|
||||||
sem_init(&tid_releasesem, 0, 0);
|
sem_init(&tid_releasesem, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: WakeWithSignal test group teardown
|
* Name: wake_with_signal test group teardown
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Setup function executed after each testcase in this test group
|
* Setup function executed after each testcase in this test group
|
||||||
@ -615,7 +663,7 @@ TEST_SETUP(WakeWithSignal)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
TEST_TEAR_DOWN(WakeWithSignal)
|
TEST_TEAR_DOWN(wake_with_signal)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
int i;
|
int i;
|
||||||
@ -629,18 +677,20 @@ TEST_TEAR_DOWN(WakeWithSignal)
|
|||||||
ret = pthread_join(tid[i], NULL);
|
ret = pthread_join(tid[i], NULL);
|
||||||
assert(ret == OK);
|
assert(ret == OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (test_sd[i] != -1)
|
if (test_sd[i] != -1)
|
||||||
{
|
{
|
||||||
close(test_sd[i]);
|
close(test_sd[i]);
|
||||||
test_sd[i] = -1;
|
test_sd[i] = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sem_destroy(&tid_startsem);
|
sem_destroy(&tid_startsem);
|
||||||
sem_destroy(&tid_releasesem);
|
sem_destroy(&tid_releasesem);
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: WakeBlockingConnect
|
* Name: wake_blocking_connect
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Wake blocking connect with signal
|
* Wake blocking connect with signal
|
||||||
@ -656,7 +706,7 @@ TEST_TEAR_DOWN(WakeWithSignal)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
TEST(WakeWithSignal, WakeBlockingConnect)
|
TEST(wake_with_signal, wake_blocking_connect)
|
||||||
{
|
{
|
||||||
/* Configure test daemon. */
|
/* Configure test daemon. */
|
||||||
|
|
||||||
@ -673,7 +723,7 @@ TEST(WakeWithSignal, WakeBlockingConnect)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: WakeBlockingConnectMultiThread
|
* Name: wake_blocking_connect_multithread
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Wake multiple blocking connect with signal
|
* Wake multiple blocking connect with signal
|
||||||
@ -689,7 +739,7 @@ TEST(WakeWithSignal, WakeBlockingConnect)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
TEST(WakeWithSignal, WakeBlockingConnectMultiThread)
|
TEST(wake_with_signal, wake_blocking_connect_multithread)
|
||||||
{
|
{
|
||||||
/* Configure test daemon. */
|
/* Configure test daemon. */
|
||||||
|
|
||||||
@ -706,7 +756,7 @@ TEST(WakeWithSignal, WakeBlockingConnectMultiThread)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: WakeBlockingSend
|
* Name: wake_blocking_send
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Wake blocking send with signal
|
* Wake blocking send with signal
|
||||||
@ -722,7 +772,7 @@ TEST(WakeWithSignal, WakeBlockingConnectMultiThread)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
TEST(WakeWithSignal, WakeBlockingSend)
|
TEST(wake_with_signal, wake_blocking_send)
|
||||||
{
|
{
|
||||||
/* Configure test daemon. */
|
/* Configure test daemon. */
|
||||||
|
|
||||||
@ -739,7 +789,7 @@ TEST(WakeWithSignal, WakeBlockingSend)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: WakeBlockingSendMultiThread
|
* Name: wake_blocking_send_multithread
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Wake multiple blocking send with signal
|
* Wake multiple blocking send with signal
|
||||||
@ -755,7 +805,7 @@ TEST(WakeWithSignal, WakeBlockingSend)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
TEST(WakeWithSignal, WakeBlockingSendMultiThread)
|
TEST(wake_with_signal, wake_blocking_send_multithread)
|
||||||
{
|
{
|
||||||
/* Configure test daemon. */
|
/* Configure test daemon. */
|
||||||
|
|
||||||
@ -770,8 +820,9 @@ TEST(WakeWithSignal, WakeBlockingSendMultiThread)
|
|||||||
|
|
||||||
do_wake_test(TEST_TYPE_SEND, TEST_FLAG_MULTI_THREAD);
|
do_wake_test(TEST_TYPE_SEND, TEST_FLAG_MULTI_THREAD);
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: WakeBlockingRecv
|
* Name: wake_blocking_recv
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Wake blocking recv with signal
|
* Wake blocking recv with signal
|
||||||
@ -787,7 +838,7 @@ TEST(WakeWithSignal, WakeBlockingSendMultiThread)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
TEST(WakeWithSignal, WakeBlockingRecv)
|
TEST(wake_with_signal, wake_blocking_recv)
|
||||||
{
|
{
|
||||||
/* Configure test daemon. */
|
/* Configure test daemon. */
|
||||||
|
|
||||||
@ -805,7 +856,7 @@ TEST(WakeWithSignal, WakeBlockingRecv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: WakeBlockingRecvMultiThread
|
* Name: wake_blocking_recv_multithread
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Wake multiple blocking recv with signal
|
* Wake multiple blocking recv with signal
|
||||||
@ -821,7 +872,7 @@ TEST(WakeWithSignal, WakeBlockingRecv)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
TEST(WakeWithSignal, WakeBlockingRecvMultiThread)
|
TEST(wake_with_signal, wake_blocking_recv_multithread)
|
||||||
{
|
{
|
||||||
/* Configure test daemon. */
|
/* Configure test daemon. */
|
||||||
|
|
||||||
@ -839,7 +890,7 @@ TEST(WakeWithSignal, WakeBlockingRecvMultiThread)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: AbortBlockingConnect
|
* Name: abort_blocking_connect
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Wake blocking connect with daemon abort
|
* Wake blocking connect with daemon abort
|
||||||
@ -855,7 +906,7 @@ TEST(WakeWithSignal, WakeBlockingRecvMultiThread)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
TEST(WakeWithSignal, AbortBlockingConnect)
|
TEST(wake_with_signal, abort_blocking_connect)
|
||||||
{
|
{
|
||||||
/* Configure test daemon. */
|
/* Configure test daemon. */
|
||||||
|
|
||||||
@ -872,7 +923,7 @@ TEST(WakeWithSignal, AbortBlockingConnect)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: AbortBlockingConnectMultiThread
|
* Name: abort_blocking_connect_multithread
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Wake multiple blocking connect with daemon abort
|
* Wake multiple blocking connect with daemon abort
|
||||||
@ -888,7 +939,7 @@ TEST(WakeWithSignal, AbortBlockingConnect)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
TEST(WakeWithSignal, AbortBlockingConnectMultiThread)
|
TEST(wake_with_signal, abort_blocking_connect_multithread)
|
||||||
{
|
{
|
||||||
/* Configure test daemon. */
|
/* Configure test daemon. */
|
||||||
|
|
||||||
@ -906,7 +957,7 @@ TEST(WakeWithSignal, AbortBlockingConnectMultiThread)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: AbortBlockingSend
|
* Name: abort_blocking_send
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Wake blocking send with daemon abort
|
* Wake blocking send with daemon abort
|
||||||
@ -922,7 +973,7 @@ TEST(WakeWithSignal, AbortBlockingConnectMultiThread)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
TEST(WakeWithSignal, AbortBlockingSend)
|
TEST(wake_with_signal, abort_blocking_send)
|
||||||
{
|
{
|
||||||
/* Configure test daemon. */
|
/* Configure test daemon. */
|
||||||
|
|
||||||
@ -939,7 +990,7 @@ TEST(WakeWithSignal, AbortBlockingSend)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: AbortBlockingSendMultiThread
|
* Name: abort_blocking_send_multithread
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Wake multiple blocking send with daemon abort
|
* Wake multiple blocking send with daemon abort
|
||||||
@ -955,7 +1006,7 @@ TEST(WakeWithSignal, AbortBlockingSend)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
TEST(WakeWithSignal, AbortBlockingSendMultiThread)
|
TEST(wake_with_signal, abort_blocking_send_multithread)
|
||||||
{
|
{
|
||||||
/* Configure test daemon. */
|
/* Configure test daemon. */
|
||||||
|
|
||||||
@ -973,7 +1024,7 @@ TEST(WakeWithSignal, AbortBlockingSendMultiThread)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: AbortBlockingRecv
|
* Name: abort_blocking_recv
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Wake blocking recv with daemon abort
|
* Wake blocking recv with daemon abort
|
||||||
@ -989,7 +1040,7 @@ TEST(WakeWithSignal, AbortBlockingSendMultiThread)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
TEST(WakeWithSignal, AbortBlockingRecv)
|
TEST(wake_with_signal, abort_blocking_recv)
|
||||||
{
|
{
|
||||||
/* Configure test daemon. */
|
/* Configure test daemon. */
|
||||||
|
|
||||||
@ -1007,7 +1058,7 @@ TEST(WakeWithSignal, AbortBlockingRecv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: AbortBlockingRecvMultiThread
|
* Name: abort_blocking_recv_multithread
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Wake multiple blocking recv with daemon abort
|
* Wake multiple blocking recv with daemon abort
|
||||||
@ -1023,7 +1074,7 @@ TEST(WakeWithSignal, AbortBlockingRecv)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
TEST(WakeWithSignal, AbortBlockingRecvMultiThread)
|
TEST(wake_with_signal, abort_blocking_recv_multithread)
|
||||||
{
|
{
|
||||||
/* Configure test daemon. */
|
/* Configure test daemon. */
|
||||||
|
|
||||||
@ -1042,7 +1093,7 @@ TEST(WakeWithSignal, AbortBlockingRecvMultiThread)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: PendingRequestBlockingConnect
|
* Name: pending_request_blocking_connect
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Wake blocking connect with daemon abort (and daemon not handling pending
|
* Wake blocking connect with daemon abort (and daemon not handling pending
|
||||||
@ -1059,7 +1110,7 @@ TEST(WakeWithSignal, AbortBlockingRecvMultiThread)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
TEST(WakeWithSignal, PendingRequestBlockingConnect)
|
TEST(wake_with_signal, pending_request_blocking_connect)
|
||||||
{
|
{
|
||||||
/* Configure test daemon. */
|
/* Configure test daemon. */
|
||||||
|
|
||||||
@ -1077,11 +1128,11 @@ TEST(WakeWithSignal, PendingRequestBlockingConnect)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: PendingRequestBlockingConnectMultiThread
|
* Name: pending_request_blocking_connect_multithread
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Wake multiple blocking connect with daemon abort (and daemon not handling
|
* Wake multiple blocking connect with daemon abort (and daemon not
|
||||||
* pending requests before abort)
|
* handling pending requests before abort)
|
||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* None
|
* None
|
||||||
@ -1094,7 +1145,7 @@ TEST(WakeWithSignal, PendingRequestBlockingConnect)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
TEST(WakeWithSignal, PendingRequestBlockingConnectMultiThread)
|
TEST(wake_with_signal, pending_request_blocking_connect_multithread)
|
||||||
{
|
{
|
||||||
/* Configure test daemon. */
|
/* Configure test daemon. */
|
||||||
|
|
||||||
@ -1113,7 +1164,7 @@ TEST(WakeWithSignal, PendingRequestBlockingConnectMultiThread)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: PendingRequestBlockingSend
|
* Name: pending_request_blocking_send
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Wake blocking send with daemon abort (and daemon not handling pending
|
* Wake blocking send with daemon abort (and daemon not handling pending
|
||||||
@ -1130,7 +1181,7 @@ TEST(WakeWithSignal, PendingRequestBlockingConnectMultiThread)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
TEST(WakeWithSignal, PendingRequestBlockingSend)
|
TEST(wake_with_signal, pending_request_blocking_send)
|
||||||
{
|
{
|
||||||
/* Configure test daemon. */
|
/* Configure test daemon. */
|
||||||
|
|
||||||
@ -1148,7 +1199,7 @@ TEST(WakeWithSignal, PendingRequestBlockingSend)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: PendingRequestBlockingSendMultiThread
|
* Name: pending_request_blocking_send_multithread
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Wake multiple blocking send with daemon abort (and daemon not handling
|
* Wake multiple blocking send with daemon abort (and daemon not handling
|
||||||
@ -1165,7 +1216,7 @@ TEST(WakeWithSignal, PendingRequestBlockingSend)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
TEST(WakeWithSignal, PendingRequestBlockingSendMultiThread)
|
TEST(wake_with_signal, pending_request_blocking_send_multithread)
|
||||||
{
|
{
|
||||||
/* Configure test daemon. */
|
/* Configure test daemon. */
|
||||||
|
|
||||||
@ -1184,7 +1235,7 @@ TEST(WakeWithSignal, PendingRequestBlockingSendMultiThread)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: PendingRequestBlockingRecv
|
* Name: pending_request_blocking_recv
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Wake blocking recv with daemon abort (and daemon not handling pending
|
* Wake blocking recv with daemon abort (and daemon not handling pending
|
||||||
@ -1201,7 +1252,7 @@ TEST(WakeWithSignal, PendingRequestBlockingSendMultiThread)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
TEST(WakeWithSignal, PendingRequestBlockingRecv)
|
TEST(wake_with_signal, pending_request_blocking_recv)
|
||||||
{
|
{
|
||||||
/* Configure test daemon. */
|
/* Configure test daemon. */
|
||||||
|
|
||||||
@ -1220,7 +1271,7 @@ TEST(WakeWithSignal, PendingRequestBlockingRecv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: PendingRequestBlockingRecvMultiThread
|
* Name: pending_request_blocking_recv_multithread
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Wake multiple blocking recv with daemon abort (and daemon not handling
|
* Wake multiple blocking recv with daemon abort (and daemon not handling
|
||||||
@ -1237,7 +1288,7 @@ TEST(WakeWithSignal, PendingRequestBlockingRecv)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
TEST(WakeWithSignal, PendingRequestBlockingRecvMultiThread)
|
TEST(wake_with_signal, pending_request_blocking_recv_multithread)
|
||||||
{
|
{
|
||||||
/* Configure test daemon. */
|
/* Configure test daemon. */
|
||||||
|
|
||||||
@ -1257,7 +1308,7 @@ TEST(WakeWithSignal, PendingRequestBlockingRecvMultiThread)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: PendingRequestBlockingOpen
|
* Name: pending_request_blocking_open
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Wake blocking open with daemon abort (and daemon not handling pending
|
* Wake blocking open with daemon abort (and daemon not handling pending
|
||||||
@ -1274,7 +1325,7 @@ TEST(WakeWithSignal, PendingRequestBlockingRecvMultiThread)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
TEST(WakeWithSignal, PendingRequestBlockingOpen)
|
TEST(wake_with_signal, pending_request_blocking_open)
|
||||||
{
|
{
|
||||||
/* Configure test daemon. */
|
/* Configure test daemon. */
|
||||||
|
|
||||||
@ -1293,7 +1344,7 @@ TEST(WakeWithSignal, PendingRequestBlockingOpen)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: PendingRequestBlockingOpenMultiThread
|
* Name: pending_request_blocking_open_multithread
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Wake multiple blocking open with daemon abort (and daemon not handling
|
* Wake multiple blocking open with daemon abort (and daemon not handling
|
||||||
@ -1310,7 +1361,7 @@ TEST(WakeWithSignal, PendingRequestBlockingOpen)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
TEST(WakeWithSignal, PendingRequestBlockingOpenMultiThread)
|
TEST(wake_with_signal, pending_request_blocking_open_multithread)
|
||||||
{
|
{
|
||||||
/* Configure test daemon. */
|
/* Configure test daemon. */
|
||||||
|
|
||||||
@ -1330,7 +1381,7 @@ TEST(WakeWithSignal, PendingRequestBlockingOpenMultiThread)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: PendingRequestBlockingClose
|
* Name: pending_request_blocking_close
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Wake blocking close with daemon abort (and daemon not handling pending
|
* Wake blocking close with daemon abort (and daemon not handling pending
|
||||||
@ -1346,7 +1397,8 @@ TEST(WakeWithSignal, PendingRequestBlockingOpenMultiThread)
|
|||||||
* None
|
* None
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
TEST(WakeWithSignal, PendingRequestBlockingClose)
|
|
||||||
|
TEST(wake_with_signal, pending_request_blocking_close)
|
||||||
{
|
{
|
||||||
/* Configure test daemon. */
|
/* Configure test daemon. */
|
||||||
|
|
||||||
@ -1365,7 +1417,7 @@ TEST(WakeWithSignal, PendingRequestBlockingClose)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: PendingRequestBlockingCloseMultiThread
|
* Name: pending_request_blocking_close_multithread
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Wake multiple blocking close with daemon abort (and daemon not handling
|
* Wake multiple blocking close with daemon abort (and daemon not handling
|
||||||
@ -1382,7 +1434,7 @@ TEST(WakeWithSignal, PendingRequestBlockingClose)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
TEST(WakeWithSignal, PendingRequestBlockingCloseMultiThread)
|
TEST(wake_with_signal, pending_request_blocking_close_multithread)
|
||||||
{
|
{
|
||||||
/* Configure test daemon. */
|
/* Configure test daemon. */
|
||||||
|
|
||||||
@ -1402,7 +1454,7 @@ TEST(WakeWithSignal, PendingRequestBlockingCloseMultiThread)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: PendingRequestBlockingPoll
|
* Name: pending_request_blocking_poll
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Wake blocking poll with daemon abort (and daemon not handling pending
|
* Wake blocking poll with daemon abort (and daemon not handling pending
|
||||||
@ -1419,7 +1471,7 @@ TEST(WakeWithSignal, PendingRequestBlockingCloseMultiThread)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
TEST(WakeWithSignal, PendingRequestBlockingPoll)
|
TEST(wake_with_signal, pending_request_blocking_poll)
|
||||||
{
|
{
|
||||||
/* Configure test daemon. */
|
/* Configure test daemon. */
|
||||||
|
|
||||||
@ -1438,7 +1490,7 @@ TEST(WakeWithSignal, PendingRequestBlockingPoll)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: PendingRequestBlockingPollMultiThread
|
* Name: pending_request_blocking_poll_multithread
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Wake multiple blocking poll with daemon abort (and daemon not handling
|
* Wake multiple blocking poll with daemon abort (and daemon not handling
|
||||||
@ -1455,7 +1507,7 @@ TEST(WakeWithSignal, PendingRequestBlockingPoll)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
TEST(WakeWithSignal, PendingRequestBlockingPollMultiThread)
|
TEST(wake_with_signal, pending_request_blocking_poll_multithread)
|
||||||
{
|
{
|
||||||
/* Configure test daemon. */
|
/* Configure test daemon. */
|
||||||
|
|
||||||
@ -1475,11 +1527,11 @@ TEST(WakeWithSignal, PendingRequestBlockingPollMultiThread)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: PendingRequestBlockingSetSockOpt
|
* Name: pending_request_blocking_setsockopt
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Wake blocking setsockopt with daemon abort (and daemon not handling pending
|
* Wake blocking setsockopt with daemon abort (and daemon not handling
|
||||||
* request before abort)
|
* pending request before abort)
|
||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* None
|
* None
|
||||||
@ -1492,7 +1544,7 @@ TEST(WakeWithSignal, PendingRequestBlockingPollMultiThread)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
TEST(WakeWithSignal, PendingRequestBlockingSetSockOpt)
|
TEST(wake_with_signal, pending_request_blocking_setsockopt)
|
||||||
{
|
{
|
||||||
/* Configure test daemon. */
|
/* Configure test daemon. */
|
||||||
|
|
||||||
@ -1511,7 +1563,7 @@ TEST(WakeWithSignal, PendingRequestBlockingSetSockOpt)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: PendingRequestBlockingSetSockOptMultiThread
|
* Name: pending_request_blocking_setsockopt_multithread
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Wake multiple blocking setsockopt with daemon abort (and daemon not
|
* Wake multiple blocking setsockopt with daemon abort (and daemon not
|
||||||
@ -1528,7 +1580,7 @@ TEST(WakeWithSignal, PendingRequestBlockingSetSockOpt)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
TEST(WakeWithSignal, PendingRequestBlockingSetSockOptMultiThread)
|
TEST(wake_with_signal, pending_request_blocking_setsockopt_multithread)
|
||||||
{
|
{
|
||||||
/* Configure test daemon. */
|
/* Configure test daemon. */
|
||||||
|
|
||||||
@ -1548,11 +1600,11 @@ TEST(WakeWithSignal, PendingRequestBlockingSetSockOptMultiThread)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: PendingRequestBlockingGetSockOpt
|
* Name: pending_request_blocking_getsockopt
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Wake blocking getsockopt with daemon abort (and daemon not handling pending
|
* Wake blocking getsockopt with daemon abort (and daemon not handling
|
||||||
* request before abort)
|
* pending request before abort)
|
||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* None
|
* None
|
||||||
@ -1565,7 +1617,7 @@ TEST(WakeWithSignal, PendingRequestBlockingSetSockOptMultiThread)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
TEST(WakeWithSignal, PendingRequestBlockingGetSockOpt)
|
TEST(wake_with_signal, pending_request_blocking_getsockopt)
|
||||||
{
|
{
|
||||||
/* Configure test daemon. */
|
/* Configure test daemon. */
|
||||||
|
|
||||||
@ -1584,7 +1636,7 @@ TEST(WakeWithSignal, PendingRequestBlockingGetSockOpt)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: PendingRequestBlockingGetSockOptMultiThread
|
* Name: pending_request_blocking_getsockopt_multithread
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Wake multiple blocking getsockopt with daemon abort (and daemon not
|
* Wake multiple blocking getsockopt with daemon abort (and daemon not
|
||||||
@ -1601,7 +1653,7 @@ TEST(WakeWithSignal, PendingRequestBlockingGetSockOpt)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
TEST(WakeWithSignal, PendingRequestBlockingGetSockOptMultiThread)
|
TEST(wake_with_signal, pending_request_blocking_getsockopt_multithread)
|
||||||
{
|
{
|
||||||
/* Configure test daemon. */
|
/* Configure test daemon. */
|
||||||
|
|
||||||
@ -1624,34 +1676,42 @@ TEST(WakeWithSignal, PendingRequestBlockingGetSockOptMultiThread)
|
|||||||
* Public Functions
|
* Public Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
TEST_GROUP(WakeWithSignal)
|
TEST_GROUP(wake_with_signal)
|
||||||
{
|
{
|
||||||
RUN_TEST_CASE(WakeWithSignal, WakeBlockingConnect);
|
RUN_TEST_CASE(wake_with_signal, wake_blocking_connect);
|
||||||
RUN_TEST_CASE(WakeWithSignal, WakeBlockingConnectMultiThread);
|
RUN_TEST_CASE(wake_with_signal, wake_blocking_connect_multithread);
|
||||||
RUN_TEST_CASE(WakeWithSignal, WakeBlockingSend);
|
RUN_TEST_CASE(wake_with_signal, wake_blocking_send);
|
||||||
RUN_TEST_CASE(WakeWithSignal, WakeBlockingSendMultiThread);
|
RUN_TEST_CASE(wake_with_signal, wake_blocking_send_multithread);
|
||||||
RUN_TEST_CASE(WakeWithSignal, WakeBlockingRecv);
|
RUN_TEST_CASE(wake_with_signal, wake_blocking_recv);
|
||||||
RUN_TEST_CASE(WakeWithSignal, WakeBlockingRecvMultiThread);
|
RUN_TEST_CASE(wake_with_signal, wake_blocking_recv_multithread);
|
||||||
RUN_TEST_CASE(WakeWithSignal, AbortBlockingConnect);
|
RUN_TEST_CASE(wake_with_signal, abort_blocking_connect);
|
||||||
RUN_TEST_CASE(WakeWithSignal, AbortBlockingConnectMultiThread);
|
RUN_TEST_CASE(wake_with_signal, abort_blocking_connect_multithread);
|
||||||
RUN_TEST_CASE(WakeWithSignal, AbortBlockingSend);
|
RUN_TEST_CASE(wake_with_signal, abort_blocking_send);
|
||||||
RUN_TEST_CASE(WakeWithSignal, AbortBlockingSendMultiThread);
|
RUN_TEST_CASE(wake_with_signal, abort_blocking_send_multithread);
|
||||||
RUN_TEST_CASE(WakeWithSignal, AbortBlockingRecv);
|
RUN_TEST_CASE(wake_with_signal, abort_blocking_recv);
|
||||||
RUN_TEST_CASE(WakeWithSignal, AbortBlockingRecvMultiThread);
|
RUN_TEST_CASE(wake_with_signal, abort_blocking_recv_multithread);
|
||||||
RUN_TEST_CASE(WakeWithSignal, PendingRequestBlockingConnect);
|
RUN_TEST_CASE(wake_with_signal, pending_request_blocking_connect);
|
||||||
RUN_TEST_CASE(WakeWithSignal, PendingRequestBlockingConnectMultiThread);
|
RUN_TEST_CASE(wake_with_signal,
|
||||||
RUN_TEST_CASE(WakeWithSignal, PendingRequestBlockingSend);
|
pending_request_blocking_connect_multithread);
|
||||||
RUN_TEST_CASE(WakeWithSignal, PendingRequestBlockingSendMultiThread);
|
RUN_TEST_CASE(wake_with_signal, pending_request_blocking_send);
|
||||||
RUN_TEST_CASE(WakeWithSignal, PendingRequestBlockingRecv);
|
RUN_TEST_CASE(wake_with_signal,
|
||||||
RUN_TEST_CASE(WakeWithSignal, PendingRequestBlockingRecvMultiThread);
|
pending_request_blocking_send_multithread);
|
||||||
RUN_TEST_CASE(WakeWithSignal, PendingRequestBlockingOpen);
|
RUN_TEST_CASE(wake_with_signal, pending_request_blocking_recv);
|
||||||
RUN_TEST_CASE(WakeWithSignal, PendingRequestBlockingOpenMultiThread);
|
RUN_TEST_CASE(wake_with_signal,
|
||||||
RUN_TEST_CASE(WakeWithSignal, PendingRequestBlockingClose);
|
pending_request_blocking_recv_multithread);
|
||||||
RUN_TEST_CASE(WakeWithSignal, PendingRequestBlockingCloseMultiThread);
|
RUN_TEST_CASE(wake_with_signal, pending_request_blocking_open);
|
||||||
RUN_TEST_CASE(WakeWithSignal, PendingRequestBlockingPoll);
|
RUN_TEST_CASE(wake_with_signal,
|
||||||
RUN_TEST_CASE(WakeWithSignal, PendingRequestBlockingPollMultiThread);
|
pending_request_blocking_open_multithread);
|
||||||
RUN_TEST_CASE(WakeWithSignal, PendingRequestBlockingSetSockOpt);
|
RUN_TEST_CASE(wake_with_signal, pending_request_blocking_close);
|
||||||
RUN_TEST_CASE(WakeWithSignal, PendingRequestBlockingSetSockOptMultiThread);
|
RUN_TEST_CASE(wake_with_signal,
|
||||||
RUN_TEST_CASE(WakeWithSignal, PendingRequestBlockingGetSockOpt);
|
pending_request_blocking_close_multithread);
|
||||||
RUN_TEST_CASE(WakeWithSignal, PendingRequestBlockingGetSockOptMultiThread);
|
RUN_TEST_CASE(wake_with_signal, pending_request_blocking_poll);
|
||||||
|
RUN_TEST_CASE(wake_with_signal,
|
||||||
|
pending_request_blocking_poll_multithread);
|
||||||
|
RUN_TEST_CASE(wake_with_signal, pending_request_blocking_setsockopt);
|
||||||
|
RUN_TEST_CASE(wake_with_signal,
|
||||||
|
pending_request_blocking_setsockopt_multithread);
|
||||||
|
RUN_TEST_CASE(wake_with_signal, pending_request_blocking_getsockopt);
|
||||||
|
RUN_TEST_CASE(wake_with_signal,
|
||||||
|
pending_request_blocking_getsockopt_multithread);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user