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
ac958397
Unverified
Commit
ac958397
authored
Jan 13, 2019
by
Constantin Rack
Committed by
GitHub
Jan 13, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3358 from bluca/tests_race_conditions
Problems: test failing on SPARC64 and hard-coded socket binds
parents
6a3c8b46
f64b6970
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
42 additions
and
16 deletions
+42
-16
test_pair_ipc.cpp
tests/test_pair_ipc.cpp
+7
-2
test_rebind_ipc.cpp
tests/test_rebind_ipc.cpp
+8
-5
test_reconnect_ivl.cpp
tests/test_reconnect_ivl.cpp
+7
-3
test_use_fd.cpp
tests/test_use_fd.cpp
+19
-5
testutil_security.hpp
tests/testutil_security.hpp
+1
-1
No files found.
tests/test_pair_ipc.cpp
View file @
ac958397
...
...
@@ -44,11 +44,16 @@ void tearDown ()
void
test_roundtrip
()
{
char
my_endpoint
[
256
];
size_t
len
=
sizeof
(
my_endpoint
);
void
*
sb
=
test_context_socket
(
ZMQ_PAIR
);
TEST_ASSERT_SUCCESS_ERRNO
(
zmq_bind
(
sb
,
"ipc:///tmp/test_pair_ipc"
));
TEST_ASSERT_SUCCESS_ERRNO
(
zmq_bind
(
sb
,
"ipc://*"
));
TEST_ASSERT_SUCCESS_ERRNO
(
zmq_getsockopt
(
sb
,
ZMQ_LAST_ENDPOINT
,
my_endpoint
,
&
len
));
void
*
sc
=
test_context_socket
(
ZMQ_PAIR
);
TEST_ASSERT_SUCCESS_ERRNO
(
zmq_connect
(
sc
,
"ipc:///tmp/test_pair_ipc"
));
TEST_ASSERT_SUCCESS_ERRNO
(
zmq_connect
(
sc
,
my_endpoint
));
bounce
(
sb
,
sc
);
...
...
tests/test_rebind_ipc.cpp
View file @
ac958397
...
...
@@ -42,24 +42,27 @@ void tearDown ()
teardown_test_context
();
}
static
const
char
*
SOCKET_ADDR
=
"ipc:///tmp/test_rebind_ipc"
;
void
test_rebind_ipc
()
{
char
my_endpoint
[
256
];
size_t
len
=
sizeof
(
my_endpoint
);
void
*
sb0
=
test_context_socket
(
ZMQ_PUSH
);
void
*
sb1
=
test_context_socket
(
ZMQ_PUSH
);
TEST_ASSERT_SUCCESS_ERRNO
(
zmq_bind
(
sb0
,
SOCKET_ADDR
));
TEST_ASSERT_SUCCESS_ERRNO
(
zmq_bind
(
sb0
,
"ipc://*"
));
TEST_ASSERT_SUCCESS_ERRNO
(
zmq_getsockopt
(
sb0
,
ZMQ_LAST_ENDPOINT
,
my_endpoint
,
&
len
));
void
*
sc
=
test_context_socket
(
ZMQ_PULL
);
TEST_ASSERT_SUCCESS_ERRNO
(
zmq_connect
(
sc
,
SOCKET_ADDR
));
TEST_ASSERT_SUCCESS_ERRNO
(
zmq_connect
(
sc
,
my_endpoint
));
send_string_expect_success
(
sb0
,
"42"
,
0
);
recv_string_expect_success
(
sc
,
"42"
,
0
);
test_context_socket_close
(
sb0
);
TEST_ASSERT_SUCCESS_ERRNO
(
zmq_bind
(
sb1
,
SOCKET_ADDR
));
TEST_ASSERT_SUCCESS_ERRNO
(
zmq_bind
(
sb1
,
my_endpoint
));
send_string_expect_success
(
sb1
,
"42"
,
0
);
recv_string_expect_success
(
sc
,
"42"
,
0
);
...
...
tests/test_reconnect_ivl.cpp
View file @
ac958397
...
...
@@ -71,11 +71,15 @@ void test_reconnect_ivl_against_pair_socket (const char *my_endpoint_,
#if !defined(ZMQ_HAVE_WINDOWS) && !defined(ZMQ_HAVE_GNU)
void
test_reconnect_ivl_ipc
(
void
)
{
const
char
*
ipc_endpoint
=
"ipc:///tmp/test_reconnect_ivl"
;
char
my_endpoint
[
256
];
size_t
len
=
sizeof
(
my_endpoint
);
void
*
sb
=
test_context_socket
(
ZMQ_PAIR
);
TEST_ASSERT_SUCCESS_ERRNO
(
zmq_bind
(
sb
,
ipc_endpoint
));
TEST_ASSERT_SUCCESS_ERRNO
(
zmq_bind
(
sb
,
"ipc://*"
));
TEST_ASSERT_SUCCESS_ERRNO
(
zmq_getsockopt
(
sb
,
ZMQ_LAST_ENDPOINT
,
my_endpoint
,
&
len
));
test_reconnect_ivl_against_pair_socket
(
ipc
_endpoint
,
sb
);
test_reconnect_ivl_against_pair_socket
(
my
_endpoint
,
sb
);
test_context_socket_close
(
sb
);
}
#endif
...
...
tests/test_use_fd.cpp
View file @
ac958397
...
...
@@ -237,24 +237,38 @@ void pre_allocate_sock_ipc_int (void *zmq_socket_, const char *path_)
sizeof
(
struct
sockaddr_un
));
}
char
ipc_endpoint
[
16
];
void
pre_allocate_sock_ipc
(
void
*
sb_
,
char
*
my_endpoint_
)
{
pre_allocate_sock_ipc_int
(
sb_
,
"/tmp/test_use_fd_ipc"
);
strcpy
(
my_endpoint_
,
"ipc:///tmp/test_use_fd_ipc"
);
strcpy
(
ipc_endpoint
,
"tmpXXXXXX"
);
#ifdef HAVE_MKDTEMP
TEST_ASSERT_TRUE
(
mkdtemp
(
ipc_endpoint
));
strcat
(
ipc_endpoint
,
"/ipc"
);
#else
int
fd
=
mkstemp
(
ipc_endpoint
);
TEST_ASSERT_TRUE
(
fd
!=
-
1
);
close
(
fd
);
#endif
pre_allocate_sock_ipc_int
(
sb_
,
ipc_endpoint
);
strcpy
(
my_endpoint_
,
"ipc://"
);
strcat
(
my_endpoint_
,
ipc_endpoint
);
}
void
test_req_rep_ipc
()
{
test_req_rep
(
pre_allocate_sock_ipc
);
TEST_ASSERT_SUCCESS_ERRNO
(
unlink
(
"/tmp/test_use_fd_ipc"
));
TEST_ASSERT_SUCCESS_ERRNO
(
unlink
(
ipc_endpoint
));
}
void
test_pair_ipc
()
{
test_pair
(
pre_allocate_sock_ipc
);
TEST_ASSERT_SUCCESS_ERRNO
(
unlink
(
"/tmp/test_use_fd_ipc"
));
TEST_ASSERT_SUCCESS_ERRNO
(
unlink
(
ipc_endpoint
));
}
void
test_client_server_ipc
()
...
...
@@ -262,7 +276,7 @@ void test_client_server_ipc ()
#if defined(ZMQ_SERVER) && defined(ZMQ_CLIENT)
test_client_server
(
pre_allocate_sock_ipc
);
TEST_ASSERT_SUCCESS_ERRNO
(
unlink
(
"/tmp/test_use_fd_ipc"
));
TEST_ASSERT_SUCCESS_ERRNO
(
unlink
(
ipc_endpoint
));
#endif
}
...
...
tests/testutil_security.hpp
View file @
ac958397
...
...
@@ -345,7 +345,7 @@ static int get_monitor_event_internal (void *monitor_,
uint8_t
*
data
=
(
uint8_t
*
)
zmq_msg_data
(
&
msg
);
uint16_t
event
=
*
(
uint16_t
*
)
(
data
);
if
(
value_
)
*
value_
=
*
(
uint32_t
*
)
(
data
+
2
);
memcpy
(
value_
,
data
+
2
,
sizeof
(
uint32_t
)
);
// Second frame in message contains event address
zmq_msg_init
(
&
msg
);
...
...
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