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
5ba328d7
Commit
5ba328d7
authored
Nov 13, 2015
by
Constantin Rack
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Problem: there is no test for setsockopt ZMQ_TCP_SEND/RECV_BUFFER
Solution: add test case
parent
f80faeca
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
84 additions
and
0 deletions
+84
-0
.gitignore
.gitignore
+1
-0
Makefile.am
Makefile.am
+4
-0
CMakeLists.txt
tests/CMakeLists.txt
+1
-0
test_setsockopt.cpp
tests/test_setsockopt.cpp
+78
-0
No files found.
.gitignore
View file @
5ba328d7
...
...
@@ -114,6 +114,7 @@ test_server_drop_more
test_thread_safe
test_thread_safe_polling
test_getsockopt_memset
test_setsockopt
test_stream_exceeds_buffer
test_poller
tests/test*.log
...
...
Makefile.am
View file @
5ba328d7
...
...
@@ -351,6 +351,7 @@ test_apps = \
tests/test_proxy_single_socket
\
tests/test_proxy_terminate
\
tests/test_getsockopt_memset
\
tests/test_setsockopt
\
tests/test_many_sockets
\
tests/test_ipc_wildcard
\
tests/test_diffserv
\
...
...
@@ -566,6 +567,9 @@ tests_test_thread_safe_LDADD = src/libzmq.la
tests_test_socketopt_hwm_SOURCES
=
tests/test_sockopt_hwm.cpp
tests_test_socketopt_hwm_LDADD
=
src/libzmq.la
tests_test_setsockopt_SOURCES
=
tests/test_setsockopt.cpp
tests_test_setsockopt_LDADD
=
src/libzmq.la
tests_test_heartbeats_SOURCES
=
tests/test_heartbeats.cpp
tests_test_heartbeats_LDADD
=
src/libzmq.la
...
...
tests/CMakeLists.txt
View file @
5ba328d7
...
...
@@ -50,6 +50,7 @@ set(tests
test_pub_invert_matching
test_thread_safe
test_client_server
test_setsockopt
test_sockopt_hwm
test_heartbeats
test_poller
...
...
tests/test_setsockopt.cpp
0 → 100644
View file @
5ba328d7
#include "testutil.hpp"
void
test_setsockopt_tcp_recv_buffer
()
{
int
rc
;
void
*
ctx
=
zmq_ctx_new
();
void
*
socket
=
zmq_socket
(
ctx
,
ZMQ_PUSH
);
int
val
=
0
;
size_t
placeholder
=
sizeof
(
val
);
rc
=
zmq_getsockopt
(
socket
,
ZMQ_TCP_RECV_BUFFER
,
&
val
,
&
placeholder
);
assert
(
rc
==
0
);
assert
(
val
==
8192
);
rc
=
zmq_setsockopt
(
socket
,
ZMQ_TCP_RECV_BUFFER
,
&
val
,
sizeof
(
val
));
assert
(
rc
==
0
);
assert
(
val
==
8192
);
rc
=
zmq_getsockopt
(
socket
,
ZMQ_TCP_RECV_BUFFER
,
&
val
,
&
placeholder
);
assert
(
rc
==
0
);
assert
(
val
==
8192
);
val
=
16384
;
rc
=
zmq_setsockopt
(
socket
,
ZMQ_TCP_RECV_BUFFER
,
&
val
,
sizeof
(
val
));
assert
(
rc
==
0
);
assert
(
val
==
16384
);
rc
=
zmq_getsockopt
(
socket
,
ZMQ_TCP_RECV_BUFFER
,
&
val
,
&
placeholder
);
assert
(
rc
==
0
);
assert
(
val
==
16384
);
zmq_close
(
socket
);
zmq_ctx_term
(
ctx
);
}
void
test_setsockopt_tcp_send_buffer
()
{
int
rc
;
void
*
ctx
=
zmq_ctx_new
();
void
*
socket
=
zmq_socket
(
ctx
,
ZMQ_PUSH
);
int
val
=
0
;
size_t
placeholder
=
sizeof
(
val
);
rc
=
zmq_getsockopt
(
socket
,
ZMQ_TCP_SEND_BUFFER
,
&
val
,
&
placeholder
);
assert
(
rc
==
0
);
assert
(
val
==
8192
);
rc
=
zmq_setsockopt
(
socket
,
ZMQ_TCP_SEND_BUFFER
,
&
val
,
sizeof
(
val
));
assert
(
rc
==
0
);
assert
(
val
==
8192
);
rc
=
zmq_getsockopt
(
socket
,
ZMQ_TCP_SEND_BUFFER
,
&
val
,
&
placeholder
);
assert
(
rc
==
0
);
assert
(
val
==
8192
);
val
=
16384
;
rc
=
zmq_setsockopt
(
socket
,
ZMQ_TCP_SEND_BUFFER
,
&
val
,
sizeof
(
val
));
assert
(
rc
==
0
);
assert
(
val
==
16384
);
rc
=
zmq_getsockopt
(
socket
,
ZMQ_TCP_SEND_BUFFER
,
&
val
,
&
placeholder
);
assert
(
rc
==
0
);
assert
(
val
==
16384
);
zmq_close
(
socket
);
zmq_ctx_term
(
ctx
);
}
int
main
()
{
test_setsockopt_tcp_recv_buffer
();
test_setsockopt_tcp_send_buffer
();
}
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