mirror of
https://github.com/zeromq/libzmq.git
synced 2025-01-14 17:58:01 +08:00
Merge pull request #668 from mrothe/no-public-tests
tests: don't listen on public ports
This commit is contained in:
commit
de91c7362c
@ -41,7 +41,7 @@ int main (void)
|
||||
val = 0;
|
||||
rc = zmq_setsockopt(to, ZMQ_LINGER, &val, sizeof(val));
|
||||
assert (rc == 0);
|
||||
rc = zmq_bind (to, "tcp://*:6555");
|
||||
rc = zmq_bind (to, "tcp://127.0.0.1:6555");
|
||||
assert (rc == 0);
|
||||
|
||||
// Create a socket pushing to two endpoints - only 1 message should arrive.
|
||||
@ -100,7 +100,7 @@ int main (void)
|
||||
// Bind the valid socket
|
||||
to = zmq_socket (context, ZMQ_PULL);
|
||||
assert (to);
|
||||
rc = zmq_bind (to, "tcp://*:5560");
|
||||
rc = zmq_bind (to, "tcp://127.0.0.1:5560");
|
||||
assert (rc == 0);
|
||||
|
||||
val = 0;
|
||||
@ -174,7 +174,7 @@ int main (void)
|
||||
int on = 1;
|
||||
rc = zmq_setsockopt (frontend, ZMQ_DELAY_ATTACH_ON_CONNECT, &on, sizeof (on));
|
||||
assert (rc == 0);
|
||||
rc = zmq_bind (backend, "tcp://*:5560");
|
||||
rc = zmq_bind (backend, "tcp://127.0.0.1:5560");
|
||||
assert (rc == 0);
|
||||
rc = zmq_connect (frontend, "tcp://localhost:5560");
|
||||
assert (rc == 0);
|
||||
@ -205,7 +205,7 @@ int main (void)
|
||||
assert (backend);
|
||||
rc = zmq_setsockopt (backend, ZMQ_LINGER, &zero, sizeof (zero));
|
||||
assert (rc == 0);
|
||||
rc = zmq_bind (backend, "tcp://*:5560");
|
||||
rc = zmq_bind (backend, "tcp://127.0.0.1:5560");
|
||||
assert (rc == 0);
|
||||
|
||||
// Ping backend to frontend so we know when the connection is up
|
||||
|
@ -39,7 +39,7 @@ int main(int argc, char** argv) {
|
||||
zmq_setsockopt(subSocket, ZMQ_SUBSCRIBE, "foo", 3) && printf("zmq_setsockopt: %s\n",zmq_strerror(errno));
|
||||
|
||||
zmq_bind(pubSocket, "inproc://someInProcDescriptor") && printf("zmq_bind: %s\n", zmq_strerror(errno));
|
||||
//zmq_bind(pubSocket, "tcp://*:30010") && printf("zmq_bind: %s\n", zmq_strerror(errno));
|
||||
//zmq_bind(pubSocket, "tcp://127.0.0.1:30010") && printf("zmq_bind: %s\n", zmq_strerror(errno));
|
||||
|
||||
int more;
|
||||
size_t more_size = sizeof(more);
|
||||
|
@ -28,7 +28,7 @@ int main (void)
|
||||
// Create server and bind to endpoint
|
||||
void *server = zmq_socket (ctx, ZMQ_ROUTER);
|
||||
assert (server);
|
||||
int rc = zmq_bind (server, "tcp://*:5560");
|
||||
int rc = zmq_bind (server, "tcp://127.0.0.1:5560");
|
||||
assert (rc == 0);
|
||||
|
||||
// Create client and connect to server, doing a probe
|
||||
|
@ -42,7 +42,7 @@ int main (void)
|
||||
rc = zmq_connect (req, "tcp://localhost:5555");
|
||||
assert (rc == 0);
|
||||
|
||||
rc = zmq_bind (router, "tcp://*:5555");
|
||||
rc = zmq_bind (router, "tcp://127.0.0.1:5555");
|
||||
assert (rc == 0);
|
||||
|
||||
// Send a multi-part request.
|
||||
|
@ -36,7 +36,7 @@ int main (void)
|
||||
rc = zmq_setsockopt (req, ZMQ_REQ_REQUEST_IDS, &enabled, sizeof (int));
|
||||
assert (rc == 0);
|
||||
|
||||
rc = zmq_bind (req, "tcp://*:5555");
|
||||
rc = zmq_bind (req, "tcp://127.0.0.1:5555");
|
||||
assert (rc == 0);
|
||||
|
||||
const size_t services = 5;
|
||||
|
@ -109,7 +109,7 @@ int main (void)
|
||||
assert (rc == 0);
|
||||
rc = zmq_setsockopt (server, ZMQ_IDENTITY, "IDENT", 6);
|
||||
assert (rc == 0);
|
||||
rc = zmq_bind (server, "tcp://*:9998");
|
||||
rc = zmq_bind (server, "tcp://127.0.0.1:9998");
|
||||
assert (rc == 0);
|
||||
|
||||
// Check CURVE security with valid credentials
|
||||
|
@ -83,12 +83,12 @@ int main (void)
|
||||
|
||||
// We first test client/server with no ZAP domain
|
||||
// Libzmq does not call our ZAP handler, the connect must succeed
|
||||
rc = zmq_bind (server, "tcp://*:9000");
|
||||
rc = zmq_bind (server, "tcp://127.0.0.1:9000");
|
||||
assert (rc == 0);
|
||||
rc = zmq_connect (client, "tcp://localhost:9000");
|
||||
assert (rc == 0);
|
||||
bounce (server, client);
|
||||
zmq_unbind (server, "tcp://*:9000");
|
||||
zmq_unbind (server, "tcp://127.0.0.1:9000");
|
||||
zmq_disconnect (client, "tcp://localhost:9000");
|
||||
|
||||
// Now define a ZAP domain for the server; this enables
|
||||
@ -111,18 +111,18 @@ int main (void)
|
||||
//// The above code should not be required
|
||||
//rc = zmq_setsockopt (server, ZMQ_ZAP_DOMAIN, "WRONG", 5);
|
||||
//assert (rc == 0);
|
||||
//rc = zmq_bind (server, "tcp://*:9001");
|
||||
//rc = zmq_bind (server, "tcp://127.0.0.1:9001");
|
||||
//assert (rc == 0);
|
||||
//rc = zmq_connect (client, "tcp://localhost:9001");
|
||||
//assert (rc == 0);
|
||||
//expect_bounce_fail (server, client);
|
||||
//zmq_unbind (server, "tcp://*:9001");
|
||||
//zmq_unbind (server, "tcp://127.0.0.1:9001");
|
||||
//zmq_disconnect (client, "tcp://localhost:9001");
|
||||
|
||||
// Now use the right domain, the test must pass
|
||||
rc = zmq_setsockopt (server, ZMQ_ZAP_DOMAIN, "TEST", 4);
|
||||
assert (rc == 0);
|
||||
rc = zmq_bind (server, "tcp://*:9002");
|
||||
rc = zmq_bind (server, "tcp://127.0.0.1:9002");
|
||||
assert (rc == 0);
|
||||
rc = zmq_connect (client, "tcp://localhost:9002");
|
||||
assert (rc == 0);
|
||||
@ -132,7 +132,7 @@ int main (void)
|
||||
// never succeeds and the test hangs.
|
||||
// **************************************************************
|
||||
bounce (server, client);
|
||||
zmq_unbind (server, "tcp://*:9002");
|
||||
zmq_unbind (server, "tcp://127.0.0.1:9002");
|
||||
zmq_disconnect (client, "tcp://localhost:9002");
|
||||
|
||||
// Shutdown
|
||||
|
@ -90,7 +90,7 @@ int main (void)
|
||||
int as_server = 1;
|
||||
rc = zmq_setsockopt (server, ZMQ_PLAIN_SERVER, &as_server, sizeof (int));
|
||||
assert (rc == 0);
|
||||
rc = zmq_bind (server, "tcp://*:9998");
|
||||
rc = zmq_bind (server, "tcp://127.0.0.1:9998");
|
||||
assert (rc == 0);
|
||||
|
||||
char username [256];
|
||||
|
@ -222,7 +222,7 @@ int main (void)
|
||||
void *ctx = zmq_ctx_new ();
|
||||
assert (ctx);
|
||||
|
||||
const char *binds [] = { "inproc://a", "tcp://*:5555" };
|
||||
const char *binds [] = { "inproc://a", "tcp://127.0.0.1:5555" };
|
||||
const char *connects [] = { "inproc://a", "tcp://localhost:5555" };
|
||||
|
||||
for (int transports = 0; transports < 2; ++transports) {
|
||||
|
@ -260,7 +260,7 @@ int main (void)
|
||||
void *ctx = zmq_ctx_new ();
|
||||
assert (ctx);
|
||||
|
||||
const char *binds [] = { "inproc://a", "tcp://*:5555" };
|
||||
const char *binds [] = { "inproc://a", "tcp://127.0.0.1:5555" };
|
||||
const char *connects [] = { "inproc://a", "tcp://localhost:5555" };
|
||||
|
||||
for (int transport = 0; transport < 2; ++transport) {
|
||||
|
@ -125,7 +125,7 @@ int main (void)
|
||||
void *ctx = zmq_ctx_new ();
|
||||
assert (ctx);
|
||||
|
||||
const char *binds [] = { "inproc://a", "tcp://*:5555" };
|
||||
const char *binds [] = { "inproc://a", "tcp://127.0.0.1:5555" };
|
||||
const char *connects [] = { "inproc://a", "tcp://localhost:5555" };
|
||||
|
||||
for (int transport = 0; transport < 2; ++transport) {
|
||||
|
@ -217,7 +217,7 @@ int main (void)
|
||||
void *ctx = zmq_ctx_new ();
|
||||
assert (ctx);
|
||||
|
||||
const char *binds [] = { "inproc://a", "tcp://*:5555" };
|
||||
const char *binds [] = { "inproc://a", "tcp://127.0.0.1:5555" };
|
||||
const char *connects [] = { "inproc://a", "tcp://localhost:5555" };
|
||||
|
||||
for (int transport = 0; transport < 2; transport++) {
|
||||
|
@ -179,7 +179,7 @@ int main (void)
|
||||
void *ctx = zmq_ctx_new ();
|
||||
assert (ctx);
|
||||
|
||||
const char *binds [] = { "inproc://a", "tcp://*:5555" };
|
||||
const char *binds [] = { "inproc://a", "tcp://127.0.0.1:5555" };
|
||||
const char *connects [] = { "inproc://a", "tcp://localhost:5555" };
|
||||
|
||||
for (int transport = 0; transport < 2; ++transport) {
|
||||
|
@ -54,7 +54,7 @@ test_stream_to_dealer (void)
|
||||
int zero = 0;
|
||||
rc = zmq_setsockopt (stream, ZMQ_LINGER, &zero, sizeof (zero));
|
||||
assert (rc == 0);
|
||||
rc = zmq_bind (stream, "tcp://*:5556");
|
||||
rc = zmq_bind (stream, "tcp://127.0.0.1:5556");
|
||||
assert (rc == 0);
|
||||
|
||||
// We'll be using this socket as the other peer
|
||||
@ -173,7 +173,7 @@ test_stream_to_stream (void)
|
||||
|
||||
void *server = zmq_socket (ctx, ZMQ_STREAM);
|
||||
assert (server);
|
||||
rc = zmq_bind (server, "tcp://*:8080");
|
||||
rc = zmq_bind (server, "tcp://127.0.0.1:8080");
|
||||
assert (rc == 0);
|
||||
|
||||
void *client = zmq_socket (ctx, ZMQ_STREAM);
|
||||
|
Loading…
x
Reference in New Issue
Block a user