Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
L
libzmq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
libzmq
Commits
8de7e529
Commit
8de7e529
authored
Feb 07, 2019
by
Simon Giesecke
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Problem: no test case for tcp name resolution no longer working
Solution: add test case
parent
84dc40dd
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
0 deletions
+31
-0
test_pair_tcp.cpp
tests/test_pair_tcp.cpp
+31
-0
No files found.
tests/test_pair_tcp.cpp
View file @
8de7e529
...
...
@@ -80,6 +80,36 @@ void test_pair_tcp_regular ()
test_pair_tcp
();
}
void
test_pair_tcp_connect_by_name
()
{
// all other tcp test cases bind to a loopback wildcard address, then
// retrieve the bound endpoint, which is numerical, and use that to
// connect. this test cases specifically uses "localhost" to connect
// to ensure that names are correctly resolved
void
*
sb
=
test_context_socket
(
ZMQ_PAIR
);
char
bound_endpoint
[
MAX_SOCKET_STRING
];
bind_loopback_ipv4
(
sb
,
bound_endpoint
,
sizeof
bound_endpoint
);
// extract the bound port number
const
char
*
pos
=
strrchr
(
bound_endpoint
,
':'
);
TEST_ASSERT_NOT_NULL
(
pos
);
const
char
connect_endpoint_prefix
[]
=
"tcp://localhost"
;
char
connect_endpoint
[
MAX_SOCKET_STRING
];
strcpy
(
connect_endpoint
,
connect_endpoint_prefix
);
strcat
(
connect_endpoint
,
pos
);
void
*
sc
=
test_context_socket
(
ZMQ_PAIR
);
TEST_ASSERT_SUCCESS_ERRNO
(
zmq_connect
(
sc
,
connect_endpoint
));
bounce
(
sb
,
sc
);
test_context_socket_close
(
sc
);
test_context_socket_close
(
sb
);
}
#ifdef ZMQ_BUILD_DRAFT
void
test_pair_tcp_fastpath
()
{
...
...
@@ -93,6 +123,7 @@ int main ()
UNITY_BEGIN
();
RUN_TEST
(
test_pair_tcp_regular
);
RUN_TEST
(
test_pair_tcp_connect_by_name
);
#ifdef ZMQ_BUILD_DRAFT
RUN_TEST
(
test_pair_tcp_fastpath
);
#endif
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment