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
8797af77
Commit
8797af77
authored
Nov 06, 2013
by
Richard Newton
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #737 from hintjens/master
Removed over-long pauses in tests
parents
c2c6ec19
5b60540e
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
29 additions
and
38 deletions
+29
-38
test_conflate.cpp
tests/test_conflate.cpp
+2
-5
test_connect_delay_tipc.cpp
tests/test_connect_delay_tipc.cpp
+1
-3
test_ctx_destroy.cpp
tests/test_ctx_destroy.cpp
+1
-1
test_immediate.cpp
tests/test_immediate.cpp
+1
-2
test_inproc_connect.cpp
tests/test_inproc_connect.cpp
+1
-1
test_iov.cpp
tests/test_iov.cpp
+1
-1
test_monitor.cpp
tests/test_monitor.cpp
+3
-3
test_proxy.cpp
tests/test_proxy.cpp
+0
-0
test_req_relaxed.cpp
tests/test_req_relaxed.cpp
+1
-1
test_spec_req.cpp
tests/test_spec_req.cpp
+1
-1
test_sub_forward.cpp
tests/test_sub_forward.cpp
+1
-1
test_sub_forward_tipc.cpp
tests/test_sub_forward_tipc.cpp
+1
-1
test_term_endpoint.cpp
tests/test_term_endpoint.cpp
+2
-2
test_term_endpoint_tipc.cpp
tests/test_term_endpoint_tipc.cpp
+2
-3
testutil.hpp
tests/testutil.hpp
+11
-13
No files found.
tests/test_conflate.cpp
View file @
8797af77
...
...
@@ -45,7 +45,6 @@ int main (int argc, char *argv [])
assert
(
rc
==
0
);
int
message_count
=
20
;
for
(
int
j
=
0
;
j
<
message_count
;
++
j
)
{
rc
=
zmq_send
(
s_out
,
(
void
*
)
&
j
,
sizeof
(
int
),
0
);
if
(
rc
<
0
)
{
...
...
@@ -53,15 +52,13 @@ int main (int argc, char *argv [])
return
-
1
;
}
}
zmq_sleep
(
1
);
msleep
(
SETTLE_TIME
);
int
payload_recved
=
0
;
rc
=
zmq_recv
(
s_in
,
(
void
*
)
&
payload_recved
,
sizeof
(
int
),
0
);
rc
=
zmq_recv
(
s_in
,
(
void
*
)
&
payload_recved
,
sizeof
(
int
),
0
);
assert
(
rc
>
0
);
assert
(
payload_recved
==
message_count
-
1
);
rc
=
zmq_close
(
s_in
);
assert
(
rc
==
0
);
...
...
tests/test_connect_delay_tipc.cpp
View file @
8797af77
...
...
@@ -200,9 +200,7 @@ int main (void)
assert
(
rc
==
0
);
// Give time to process disconnect
// There's no way to do this except with a sleep
struct
timespec
t
=
{
0
,
250
*
1000000
};
nanosleep
(
&
t
,
NULL
);
msleep
(
SETTLE_TIME
);
// Send a message, should fail
rc
=
zmq_send
(
frontend
,
"Hello"
,
5
,
ZMQ_DONTWAIT
);
...
...
tests/test_ctx_destroy.cpp
View file @
8797af77
...
...
@@ -61,7 +61,7 @@ void test_ctx_shutdown()
void
*
receiver_thread
=
zmq_threadstart
(
&
receiver
,
socket
);
// Wait for thread to start up and block
zmq_sleep
(
1
);
msleep
(
SETTLE_TIME
);
// Shutdown context, if we used destroy here we would deadlock.
rc
=
zmq_ctx_shutdown
(
ctx
);
...
...
tests/test_immediate.cpp
View file @
8797af77
...
...
@@ -193,8 +193,7 @@ int main (void)
assert
(
rc
==
0
);
// Give time to process disconnect
// There's no way to do this except with a sleep
zmq_sleep
(
1
);
msleep
(
SETTLE_TIME
);
// Send a message, should fail
rc
=
zmq_send
(
frontend
,
"Hello"
,
5
,
ZMQ_DONTWAIT
);
...
...
tests/test_inproc_connect.cpp
View file @
8797af77
...
...
@@ -142,7 +142,7 @@ void test_connect_before_bind_pub_sub()
assert
(
rc
==
0
);
// Wait for pub-sub connection to happen
zmq_sleep
(
1
);
msleep
(
SETTLE_TIME
);
// Queue up some data, this not will be dropped
rc
=
zmq_send_const
(
connectSocket
,
"after"
,
6
,
0
);
...
...
tests/test_iov.cpp
View file @
8797af77
...
...
@@ -80,7 +80,7 @@ int main (void)
rc
=
zmq_bind
(
sb
,
"inproc://a"
);
assert
(
rc
==
0
);
zmq_sleep
(
1
);
msleep
(
SETTLE_TIME
);
void
*
sc
=
zmq_socket
(
ctx
,
ZMQ_PUSH
);
rc
=
zmq_connect
(
sc
,
"inproc://a"
);
...
...
tests/test_monitor.cpp
View file @
8797af77
...
...
@@ -211,7 +211,7 @@ int main (void)
rc
=
zmq_socket_monitor
(
req
,
"inproc://monitor.req"
,
ZMQ_EVENT_ALL
);
assert
(
rc
==
0
);
threads
[
1
]
=
zmq_threadstart
(
&
req_socket_monitor
,
ctx
);
zmq_sleep
(
1
);
msleep
(
SETTLE_TIME
);
// Bind REQ and REP
rc
=
zmq_bind
(
rep
,
addr
.
c_str
());
...
...
@@ -238,8 +238,8 @@ int main (void)
rc
=
zmq_close
(
rep
);
assert
(
rc
==
0
);
// Allow
some
time for detecting error states
zmq_sleep
(
1
);
// Allow
enough
time for detecting error states
msleep
(
250
);
// Close the REQ socket
rc
=
zmq_close
(
req
);
...
...
tests/test_proxy.cpp
View file @
8797af77
This diff is collapsed.
Click to expand it.
tests/test_req_relaxed.cpp
View file @
8797af77
...
...
@@ -54,7 +54,7 @@ int main (void)
// We have to give the connects time to finish otherwise the requests
// will not properly round-robin. We could alternatively connect the
// REQ sockets to the REP sockets.
zmq_sleep
(
1
);
msleep
(
SETTLE_TIME
);
// Case 1: Second send() before a reply arrives in a pipe.
...
...
tests/test_spec_req.cpp
View file @
8797af77
...
...
@@ -46,7 +46,7 @@ void test_round_robin_out (void *ctx)
// We have to give the connects time to finish otherwise the requests
// will not properly round-robin. We could alternatively connect the
// REQ sockets to the REP sockets.
zmq_sleep
(
1
);
msleep
(
SETTLE_TIME
);
// Send our peer-replies, and expect every REP it used once in order
for
(
size_t
peer
=
0
;
peer
<
services
;
peer
++
)
{
...
...
tests/test_sub_forward.cpp
View file @
8797af77
...
...
@@ -59,7 +59,7 @@ int main (void)
assert
(
rc
>=
0
);
// Wait a bit till the subscription gets to the publisher
zmq_sleep
(
1
);
msleep
(
SETTLE_TIME
);
// Send an empty message
rc
=
zmq_send
(
pub
,
NULL
,
0
,
0
);
...
...
tests/test_sub_forward_tipc.cpp
View file @
8797af77
...
...
@@ -67,7 +67,7 @@ int main (void)
assert
(
rc
>=
0
);
// Wait a bit till the subscription gets to the publisher.
zmq_sleep
(
1
);
msleep
(
SETTLE_TIME
);
// Send an empty message.
rc
=
zmq_send
(
pub
,
NULL
,
0
,
0
);
...
...
tests/test_term_endpoint.cpp
View file @
8797af77
...
...
@@ -49,7 +49,7 @@ int main (void)
assert
(
rc
==
0
);
// Allow unbind to settle
zmq_sleep
(
1
);
msleep
(
SETTLE_TIME
);
// Check that sending would block (there's no outbound connection)
rc
=
zmq_send
(
push
,
"ABC"
,
3
,
ZMQ_DONTWAIT
);
...
...
@@ -86,7 +86,7 @@ int main (void)
assert
(
rc
==
0
);
// Allow disconnect to settle
zmq_sleep
(
1
);
msleep
(
SETTLE_TIME
);
// Check that sending would block (there's no inbound connections).
rc
=
zmq_send
(
push
,
"ABC"
,
3
,
ZMQ_DONTWAIT
);
...
...
tests/test_term_endpoint_tipc.cpp
View file @
8797af77
...
...
@@ -59,7 +59,7 @@ int main (void)
assert
(
rc
==
0
);
// Let events some time
zmq_sleep
(
1
);
msleep
(
SETTLE_TIME
);
// Check that sending would block (there's no outbound connection).
rc
=
zmq_send
(
push
,
"ABC"
,
3
,
ZMQ_DONTWAIT
);
...
...
@@ -100,8 +100,7 @@ int main (void)
rc
=
zmq_disconnect
(
push
,
name
);
assert
(
rc
==
0
);
// Let events some time
zmq_sleep
(
1
);
msleep
(
SETTLE_TIME
);
// Check that sending would block (there's no inbound connections).
rc
=
zmq_send
(
push
,
"ABC"
,
3
,
ZMQ_DONTWAIT
);
...
...
tests/testutil.hpp
View file @
8797af77
...
...
@@ -24,6 +24,11 @@
#include "../include/zmq_utils.h"
#include "platform.hpp"
// This defines the settle time used in tests; raise this if we
// get test failures on slower systems due to binds/connects not
// settled. Tested to work reliably at 1 msec on a fast PC.
#define SETTLE_TIME 10 // In msec
#undef NDEBUG
#include <time.h>
#include <assert.h>
...
...
@@ -259,22 +264,15 @@ void setup_test_environment()
#endif
}
// provide portable millisecond sleep
#include <time.h>
// Provide portable millisecond sleep
// http://www.cplusplus.com/forum/unices/60161/ http://en.cppreference.com/w/cpp/thread/sleep_for
void
msleep
(
int
milliseconds
)
{
#ifdef ZMQ_HAVE_WINDOWS
#include <windows.h>
Sleep
(
milliseconds
);
#else
#include <unistd.h>
usleep
(
static_cast
<
useconds_t
>
(
milliseconds
)
*
1000
);
#endif
void
msleep
(
int
milliseconds
)
{
// http://www.cplusplus.com/forum/unices/60161/ http://en.cppreference.com/w/cpp/thread/sleep_for
#ifdef ZMQ_HAVE_WINDOWS
Sleep
(
milliseconds
);
#else
usleep
(
static_cast
<
useconds_t
>
(
milliseconds
)
*
1000
);
#endif
}
...
...
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