1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
|
Fix building with -Wall.
Description from upstream repo:
Author: Pieter Hintjens <ph@imatix.com>
Date: Wed Jan 30 23:53:23 2013 +0100
Various cleanups to test programs
- Patch applied using git am from libzmq commit 5f009e52
- tests/test_raw_sock.cpp doesn't exist in zeromq3-x, so that
file was manually removed from the patch before 'git am'
Signed-off-by: AJ Lewis <aj.lewis@quantum.com>
X-GENTOO-BUG: 483318
X-GENTOO-BUG-URL: https://bugs.gentoo.org/show_bug.cgi?id=483318
X-UPSTREAM-URL: https://github.com/zeromq/zeromq3-x/commit/bdd72826c96fa7cb6a8d2e5cf688c973a8e8d42f
--- a/tests/test_connect_delay.cpp
+++ b/tests/test_connect_delay.cpp
@@ -61,12 +61,12 @@ int main (void)
assert(from);
val = 0;
- zmq_setsockopt (from, ZMQ_LINGER, &val, sizeof(val));
+ zmq_setsockopt (from, ZMQ_LINGER, &val, sizeof (val));
// This pipe will not connect
rc = zmq_connect (from, "tcp://localhost:5556");
assert (rc == 0);
// This pipe will
- rc = zmq_connect (from, "tcp://localhost:5555");
+ rc = zmq_connect (from, "tcp://localhost:6555");
assert (rc == 0);
// We send 10 messages, 5 should just get stuck in the queue
@@ -112,7 +112,6 @@ int main (void)
// cause the pipe attachment to be delayed until the connection
// succeeds.
context = zmq_ctx_new();
- fprintf (stderr, " Rerunning with DELAY_ATTACH_ON_CONNECT\n");
// Bind the valid socket
to = zmq_socket (context, ZMQ_PULL);
@@ -182,7 +181,6 @@ int main (void)
// block. Then we reconnect and verify messages flow again.
context = zmq_ctx_new();
void *context2 = zmq_ctx_new();
- fprintf (stderr, " Running DELAY_ATTACH_ON_CONNECT with disconnect\n");
to = zmq_socket (context2, ZMQ_PULL);
assert (to);
diff --git a/tests/test_disconnect_inproc.cpp b/tests/test_disconnect_inproc.cpp
index 7875083..d6b68c6 100644
--- a/tests/test_disconnect_inproc.cpp
+++ b/tests/test_disconnect_inproc.cpp
@@ -40,16 +40,14 @@ int main(int argc, char** argv) {
zmq_msg_t msg;
zmq_msg_init (&msg);
zmq_msg_recv (&msg, pubSocket, 0);
- int msgSize = zmq_msg_size(&msg);
char* buffer = (char*)zmq_msg_data(&msg);
if (buffer[0] == 0) {
assert(isSubscribed);
- printf("unsubscribing from '%s'\n", strndup(buffer + 1, msgSize - 1));
isSubscribed = false;
- } else {
+ }
+ else {
assert(!isSubscribed);
- printf("subscribing on '%s'\n", strndup(buffer + 1, msgSize - 1));
isSubscribed = true;
}
@@ -66,11 +64,6 @@ int main(int argc, char** argv) {
zmq_msg_t msg;
zmq_msg_init (&msg);
zmq_msg_recv (&msg, subSocket, 0);
- int msgSize = zmq_msg_size(&msg);
- char* buffer = (char*)zmq_msg_data(&msg);
-
- printf("received on subscriber '%s'\n", strndup(buffer, msgSize));
-
zmq_getsockopt (subSocket, ZMQ_RCVMORE, &more, &more_size);
zmq_msg_close (&msg);
diff --git a/tests/test_last_endpoint.cpp b/tests/test_last_endpoint.cpp
index 5f121c4..ef3230b 100644
--- a/tests/test_last_endpoint.cpp
+++ b/tests/test_last_endpoint.cpp
@@ -29,11 +29,10 @@ static void do_bind_and_verify (void *s, const char *endpoint)
{
int rc = zmq_bind (s, endpoint);
assert (rc == 0);
-
- char test [255];
- size_t siz = 255;
- rc = zmq_getsockopt (s, ZMQ_LAST_ENDPOINT, test, &siz);
- assert (rc == 0 && strcmp (test, endpoint) == 0);
+ char reported [255];
+ size_t size = 255;
+ rc = zmq_getsockopt (s, ZMQ_LAST_ENDPOINT, reported, &size);
+ assert (rc == 0 && strcmp (reported, endpoint) == 0);
}
int main (void)
|