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
a7065519
Commit
a7065519
authored
Jan 23, 2014
by
Martin Hurton
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #852 from hintjens/master
Fixes to test cases
parents
8fea78b1
9c228e93
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
25 deletions
+8
-25
.gitignore
.gitignore
+2
-0
Makefile.am
tests/Makefile.am
+2
-7
test_stream_disconnect.cpp
tests/test_stream_disconnect.cpp
+4
-18
No files found.
.gitignore
View file @
a7065519
...
...
@@ -86,6 +86,8 @@ tests/test_sub_forward_tipc
tests/test_term_endpoint_tipc
tests/test_many_sockets
tests/test_diffserv
tests/test_srcfd
tests/test_stream_disconnect
tests/test*.log
tests/test*.trs
src/platform.hpp*
...
...
tests/Makefile.am
View file @
a7065519
...
...
@@ -25,7 +25,7 @@ noinst_PROGRAMS = test_system \
test_probe_router
\
test_stream
\
test_stream_empty
\
test_stream_disconnect
_notifications
\
test_stream_disconnect
\
test_disconnect_inproc
\
test_ctx_options
\
test_ctx_destroy
\
...
...
@@ -91,7 +91,7 @@ test_router_handover_SOURCES = test_router_handover.cpp
test_probe_router_SOURCES
=
test_probe_router.cpp
test_stream_SOURCES
=
test_stream.cpp
test_stream_empty_SOURCES
=
test_stream_empty.cpp
test_stream_disconnect_
notifications_SOURCES
=
test_stream_disconnect_notifications
.cpp
test_stream_disconnect_
SOURCES
=
test_stream_disconnect
.cpp
test_disconnect_inproc_SOURCES
=
test_disconnect_inproc.cpp
test_ctx_options_SOURCES
=
test_ctx_options.cpp
test_iov_SOURCES
=
test_iov.cpp
...
...
@@ -121,7 +121,6 @@ test_reqrep_ipc_SOURCES = test_reqrep_ipc.cpp testutil.hpp
test_timeo_SOURCES
=
test_timeo.cpp
test_fork_SOURCES
=
test_fork.cpp
test_filter_ipc_SOURCES
=
test_filter_ipc.cpp
test_zap_ipc_creds_SOURCES
=
test_zap_ipc_creds.cpp
endif
if
BUILD_TIPC
test_connect_delay_tipc_SOURCES
=
test_connect_delay_tipc.cpp
...
...
@@ -141,7 +140,3 @@ XFAIL_TESTS = test_resource
if
!ON_LINUX
XFAIL_TESTS
+=
test_abstract_ipc
endif
if
!HAVE_IPC_PEERCRED
XFAIL_TESTS
+=
test_zap_ipc_creds
endif
tests/test_stream_disconnect
_notifications
.cpp
→
tests/test_stream_disconnect.cpp
View file @
a7065519
...
...
@@ -40,9 +40,8 @@ bool has_more (void* socket)
int
more
=
0
;
size_t
more_size
=
sizeof
(
more
);
int
rc
=
zmq_getsockopt
(
socket
,
ZMQ_RCVMORE
,
&
more
,
&
more_size
);
if
(
rc
!=
0
)
{
if
(
rc
!=
0
)
return
false
;
}
return
more
!=
0
;
}
...
...
@@ -136,8 +135,6 @@ int main(int, char**)
int
rc
=
zmq_poll
(
items
,
2
,
100
);
assert
(
rc
>=
0
);
printf
(
"Event received for step %d.
\n
"
,
step
);
// Check for data received by the server.
if
(
items
[
SERVER
].
revents
&
ZMQ_POLLIN
)
{
assert
(
dialog
[
step
].
turn
==
CLIENT
);
...
...
@@ -164,15 +161,12 @@ int main(int, char**)
// 0-length frame is a disconnection notification. The server
// should receive it as the last step in the dialogue.
if
(
size
==
0
)
{
printf
(
"server received disconnection notification!
\n
"
);
++
step
;
assert
(
step
==
steps
);
}
else
{
printf
(
"server received %d bytes.
\n
"
,
size
);
fprintf
(
stderr
,
"size = %d, len = %ld
\n
"
,
size
,
strlen
(
dialog
[
step
].
text
));
assert
((
size_t
)
size
==
strlen
(
dialog
[
step
].
text
));
int
cmp
=
memcmp
(
dialog
[
step
].
text
,
data
,
size
);
assert
((
size_t
)
size
==
strlen
(
dialog
[
step
].
text
));
int
cmp
=
memcmp
(
dialog
[
step
].
text
,
data
,
size
);
assert
(
cmp
==
0
);
++
step
;
...
...
@@ -189,8 +183,6 @@ int main(int, char**)
zmq_msg_size
(
&
data_frame
));
// Send the response.
printf
(
"server sending %d bytes.
\n
"
,
(
int
)
zmq_msg_size
(
&
data_frame
));
rc
=
zmq_msg_send
(
&
peer_frame
,
sockets
[
SERVER
],
ZMQ_SNDMORE
);
assert
(
rc
!=
-
1
);
rc
=
zmq_msg_send
(
&
data_frame
,
sockets
[
SERVER
],
ZMQ_SNDMORE
);
...
...
@@ -228,13 +220,10 @@ int main(int, char**)
// Make sure payload matches what we expect.
const
char
*
const
data
=
(
const
char
*
)
zmq_msg_data
(
&
data_frame
);
const
int
size
=
zmq_msg_size
(
&
data_frame
);
fprintf
(
stderr
,
"size = %d, len = %ld
\n
"
,
size
,
strlen
(
dialog
[
step
].
text
));
assert
((
size_t
)
size
==
strlen
(
dialog
[
step
].
text
));
assert
((
size_t
)
size
==
strlen
(
dialog
[
step
].
text
));
int
cmp
=
memcmp
(
dialog
[
step
].
text
,
data
,
size
);
assert
(
cmp
==
0
);
printf
(
"client received %d bytes.
\n
"
,
size
);
++
step
;
// Prepare the response (next line in the dialog).
...
...
@@ -246,7 +235,6 @@ int main(int, char**)
memcpy
(
zmq_msg_data
(
&
data_frame
),
dialog
[
step
].
text
,
zmq_msg_size
(
&
data_frame
));
// Send the response.
printf
(
"client sending %d bytes.
\n
"
,
(
int
)
zmq_msg_size
(
&
data_frame
));
rc
=
zmq_msg_send
(
&
peer_frame
,
sockets
[
CLIENT
],
ZMQ_SNDMORE
);
assert
(
rc
!=
-
1
);
rc
=
zmq_msg_send
(
&
data_frame
,
sockets
[
CLIENT
],
ZMQ_SNDMORE
);
...
...
@@ -260,8 +248,6 @@ int main(int, char**)
}
}
assert
(
step
==
steps
);
printf
(
"Done, exiting now.
\n
"
);
rc
=
zmq_close
(
sockets
[
CLIENT
]);
assert
(
rc
==
0
);
rc
=
zmq_close
(
sockets
[
SERVER
]);
...
...
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