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
0e2e303b
Commit
0e2e303b
authored
Feb 02, 2019
by
Simon Giesecke
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Problem: test_monitor is not run for ipv6
Solution: add test case using ipv6
parent
f22b0b74
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
6 deletions
+28
-6
test_monitor.cpp
tests/test_monitor.cpp
+19
-6
testutil_unity.hpp
tests/testutil_unity.hpp
+9
-0
No files found.
tests/test_monitor.cpp
View file @
0e2e303b
...
@@ -117,7 +117,8 @@ void test_monitor_basic ()
...
@@ -117,7 +117,8 @@ void test_monitor_basic ()
}
}
#ifdef ZMQ_BUILD_DRAFT_API
#ifdef ZMQ_BUILD_DRAFT_API
void
test_monitor_versioned_basic
()
void
test_monitor_versioned_basic
(
bind_function_t
bind_function_
,
const
char
*
expected_prefix_
)
{
{
char
server_endpoint
[
MAX_SOCKET_STRING
];
char
server_endpoint
[
MAX_SOCKET_STRING
];
...
@@ -142,7 +143,7 @@ void test_monitor_versioned_basic ()
...
@@ -142,7 +143,7 @@ void test_monitor_versioned_basic ()
zmq_connect
(
server_mon
,
"inproc://monitor-server"
));
zmq_connect
(
server_mon
,
"inproc://monitor-server"
));
// Now do a basic ping test
// Now do a basic ping test
bind_
loopback_ipv4
(
server
,
server_endpoint
,
sizeof
server_endpoint
);
bind_
function_
(
server
,
server_endpoint
,
sizeof
server_endpoint
);
TEST_ASSERT_SUCCESS_ERRNO
(
zmq_connect
(
client
,
server_endpoint
));
TEST_ASSERT_SUCCESS_ERRNO
(
zmq_connect
(
client
,
server_endpoint
));
bounce
(
server
,
client
);
bounce
(
server
,
client
);
...
@@ -166,9 +167,8 @@ void test_monitor_versioned_basic ()
...
@@ -166,9 +167,8 @@ void test_monitor_versioned_basic ()
}
}
TEST_ASSERT_EQUAL
(
ZMQ_EVENT_CONNECTED
,
event
);
TEST_ASSERT_EQUAL
(
ZMQ_EVENT_CONNECTED
,
event
);
TEST_ASSERT_EQUAL_STRING
(
server_endpoint
,
client_remote_address
);
TEST_ASSERT_EQUAL_STRING
(
server_endpoint
,
client_remote_address
);
static
const
char
prefix
[]
=
"tcp://127.0.0.1:"
;
TEST_ASSERT_EQUAL_STRING_LEN
(
expected_prefix_
,
client_local_address
,
TEST_ASSERT_EQUAL_STRING_LEN
(
prefix
,
client_local_address
,
strlen
(
expected_prefix_
));
strlen
(
prefix
));
TEST_ASSERT_NOT_EQUAL
(
TEST_ASSERT_NOT_EQUAL
(
0
,
strcmp
(
client_local_address
,
client_remote_address
));
0
,
strcmp
(
client_local_address
,
client_remote_address
));
...
@@ -200,6 +200,18 @@ void test_monitor_versioned_basic ()
...
@@ -200,6 +200,18 @@ void test_monitor_versioned_basic ()
test_context_socket_close_zero_linger
(
client_mon
);
test_context_socket_close_zero_linger
(
client_mon
);
test_context_socket_close_zero_linger
(
server_mon
);
test_context_socket_close_zero_linger
(
server_mon
);
}
}
void
test_monitor_versioned_basic_tcp_ipv4
()
{
static
const
char
prefix
[]
=
"tcp://127.0.0.1:"
;
test_monitor_versioned_basic
(
bind_loopback_ipv4
,
prefix
);
}
void
test_monitor_versioned_basic_tcp_ipv6
()
{
static
const
char
prefix
[]
=
"tcp://[::1]:"
;
test_monitor_versioned_basic
(
bind_loopback_ipv6
,
prefix
);
}
#endif
#endif
int
main
()
int
main
()
...
@@ -211,7 +223,8 @@ int main ()
...
@@ -211,7 +223,8 @@ int main ()
RUN_TEST
(
test_monitor_basic
);
RUN_TEST
(
test_monitor_basic
);
#ifdef ZMQ_BUILD_DRAFT_API
#ifdef ZMQ_BUILD_DRAFT_API
RUN_TEST
(
test_monitor_versioned_basic
);
RUN_TEST
(
test_monitor_versioned_basic_tcp_ipv4
);
RUN_TEST
(
test_monitor_versioned_basic_tcp_ipv6
);
#endif
#endif
return
UNITY_END
();
return
UNITY_END
();
...
...
tests/testutil_unity.hpp
View file @
0e2e303b
...
@@ -313,7 +313,16 @@ void bind_loopback (void *socket_, int ipv6_, char *my_endpoint_, size_t len_)
...
@@ -313,7 +313,16 @@ void bind_loopback (void *socket_, int ipv6_, char *my_endpoint_, size_t len_)
my_endpoint_
,
len_
);
my_endpoint_
,
len_
);
}
}
typedef
void
(
*
bind_function_t
)
(
void
*
socket_
,
char
*
my_endpoint_
,
size_t
len_
);
void
bind_loopback_ipv4
(
void
*
socket_
,
char
*
my_endpoint_
,
size_t
len_
)
void
bind_loopback_ipv4
(
void
*
socket_
,
char
*
my_endpoint_
,
size_t
len_
)
{
{
bind_loopback
(
socket_
,
false
,
my_endpoint_
,
len_
);
bind_loopback
(
socket_
,
false
,
my_endpoint_
,
len_
);
}
}
void
bind_loopback_ipv6
(
void
*
socket_
,
char
*
my_endpoint_
,
size_t
len_
)
{
bind_loopback
(
socket_
,
true
,
my_endpoint_
,
len_
);
}
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