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
c546045d
Commit
c546045d
authored
Aug 15, 2018
by
Simon Giesecke
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Problem: test_connect_delay_tipc not yet using unity
Solution: started migration to unity (run test cases separately)
parent
06a9d809
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
11 deletions
+48
-11
Makefile.am
Makefile.am
+2
-1
test_connect_delay_tipc.cpp
tests/test_connect_delay_tipc.cpp
+46
-10
No files found.
Makefile.am
View file @
c546045d
...
...
@@ -819,7 +819,8 @@ test_apps += \
tests/test_address_tipc
tests_test_connect_delay_tipc_SOURCES
=
tests/test_connect_delay_tipc.cpp
tests_test_connect_delay_tipc_LDADD
=
src/libzmq.la
tests_test_connect_delay_tipc_LDADD
=
src/libzmq.la
${
UNITY_LIBS
}
tests_test_connect_delay_tipc_CPPFLAGS
=
${
UNITY_CPPFLAGS
}
tests_test_pair_tipc_SOURCES
=
tests/test_pair_tipc.cpp
tests_test_pair_tipc_LDADD
=
src/libzmq.la
...
...
tests/test_connect_delay_tipc.cpp
View file @
c546045d
...
...
@@ -28,14 +28,22 @@
*/
#include "testutil.hpp"
#include "testutil_unity.hpp"
int
main
(
void
)
#include <unity.h>
void
setUp
()
{
if
(
!
is_tipc_available
())
{
printf
(
"TIPC environment unavailable, skipping test
\n
"
);
return
77
;
}
setup_test_context
();
}
void
tearDown
()
{
teardown_test_context
();
}
void
test_send_one_connected_one_unconnected
()
{
int
val
;
int
rc
;
char
buffer
[
16
];
...
...
@@ -101,6 +109,13 @@ int main (void)
rc
=
zmq_ctx_term
(
context
);
assert
(
rc
==
0
);
}
void
test_send_one_connected_one_unconnected_with_delay
()
{
int
val
;
int
rc
;
char
buffer
[
16
];
// TEST 2
// This time we will do the same thing, connect two pipes,
...
...
@@ -109,10 +124,10 @@ int main (void)
// also set the delay attach on connect flag, which should
// cause the pipe attachment to be delayed until the connection
// succeeds.
context
=
zmq_ctx_new
();
void
*
context
=
zmq_ctx_new
();
// Bind the valid socket
to
=
zmq_socket
(
context
,
ZMQ_PULL
);
void
*
to
=
zmq_socket
(
context
,
ZMQ_PULL
);
assert
(
to
);
rc
=
zmq_bind
(
to
,
"tipc://{5560,0,0}"
);
assert
(
rc
==
0
);
...
...
@@ -122,7 +137,7 @@ int main (void)
assert
(
rc
==
0
);
// Create a socket pushing to two endpoints - all messages should arrive.
from
=
zmq_socket
(
context
,
ZMQ_PUSH
);
void
*
from
=
zmq_socket
(
context
,
ZMQ_PUSH
);
assert
(
from
);
val
=
0
;
...
...
@@ -146,10 +161,11 @@ int main (void)
rc
=
zmq_send
(
from
,
"Hello"
,
5
,
0
);
assert
(
rc
==
5
);
}
int
timeout
=
250
;
rc
=
zmq_setsockopt
(
to
,
ZMQ_RCVTIMEO
,
&
timeout
,
sizeof
(
int
));
assert
(
rc
==
0
);
seen
=
0
;
int
seen
=
0
;
while
(
true
)
{
rc
=
zmq_recv
(
to
,
&
buffer
,
sizeof
(
buffer
),
0
);
if
(
rc
==
-
1
)
...
...
@@ -166,13 +182,19 @@ int main (void)
rc
=
zmq_ctx_term
(
context
);
assert
(
rc
==
0
);
}
void
test_send_disconnected_with_delay
()
{
int
rc
;
char
buffer
[
16
];
// TEST 3
// This time we want to validate that the same blocking behaviour
// occurs with an existing connection that is broken. We will send
// messages to a connected pipe, disconnect and verify the messages
// block. Then we reconnect and verify messages flow again.
context
=
zmq_ctx_new
();
void
*
context
=
zmq_ctx_new
();
void
*
backend
=
zmq_socket
(
context
,
ZMQ_DEALER
);
assert
(
backend
);
...
...
@@ -241,3 +263,17 @@ int main (void)
rc
=
zmq_ctx_term
(
context
);
assert
(
rc
==
0
);
}
int
main
(
void
)
{
if
(
!
is_tipc_available
())
{
printf
(
"TIPC environment unavailable, skipping test
\n
"
);
return
77
;
}
UNITY_BEGIN
();
RUN_TEST
(
test_send_one_connected_one_unconnected
);
RUN_TEST
(
test_send_one_connected_one_unconnected_with_delay
);
RUN_TEST
(
test_send_disconnected_with_delay
);
return
UNITY_END
();
}
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