Commit b1323051 authored by Markus Rothe's avatar Markus Rothe

tests: don't listen on public ports

parent dc79171f
...@@ -41,7 +41,7 @@ int main (void) ...@@ -41,7 +41,7 @@ int main (void)
val = 0; val = 0;
rc = zmq_setsockopt(to, ZMQ_LINGER, &val, sizeof(val)); rc = zmq_setsockopt(to, ZMQ_LINGER, &val, sizeof(val));
assert (rc == 0); assert (rc == 0);
rc = zmq_bind (to, "tcp://*:6555"); rc = zmq_bind (to, "tcp://127.0.0.1:6555");
assert (rc == 0); assert (rc == 0);
// Create a socket pushing to two endpoints - only 1 message should arrive. // Create a socket pushing to two endpoints - only 1 message should arrive.
...@@ -100,7 +100,7 @@ int main (void) ...@@ -100,7 +100,7 @@ int main (void)
// Bind the valid socket // Bind the valid socket
to = zmq_socket (context, ZMQ_PULL); to = zmq_socket (context, ZMQ_PULL);
assert (to); assert (to);
rc = zmq_bind (to, "tcp://*:5560"); rc = zmq_bind (to, "tcp://127.0.0.1:5560");
assert (rc == 0); assert (rc == 0);
val = 0; val = 0;
...@@ -174,7 +174,7 @@ int main (void) ...@@ -174,7 +174,7 @@ int main (void)
int on = 1; int on = 1;
rc = zmq_setsockopt (frontend, ZMQ_DELAY_ATTACH_ON_CONNECT, &on, sizeof (on)); rc = zmq_setsockopt (frontend, ZMQ_DELAY_ATTACH_ON_CONNECT, &on, sizeof (on));
assert (rc == 0); assert (rc == 0);
rc = zmq_bind (backend, "tcp://*:5560"); rc = zmq_bind (backend, "tcp://127.0.0.1:5560");
assert (rc == 0); assert (rc == 0);
rc = zmq_connect (frontend, "tcp://localhost:5560"); rc = zmq_connect (frontend, "tcp://localhost:5560");
assert (rc == 0); assert (rc == 0);
...@@ -205,7 +205,7 @@ int main (void) ...@@ -205,7 +205,7 @@ int main (void)
assert (backend); assert (backend);
rc = zmq_setsockopt (backend, ZMQ_LINGER, &zero, sizeof (zero)); rc = zmq_setsockopt (backend, ZMQ_LINGER, &zero, sizeof (zero));
assert (rc == 0); assert (rc == 0);
rc = zmq_bind (backend, "tcp://*:5560"); rc = zmq_bind (backend, "tcp://127.0.0.1:5560");
assert (rc == 0); assert (rc == 0);
// Ping backend to frontend so we know when the connection is up // Ping backend to frontend so we know when the connection is up
......
...@@ -39,7 +39,7 @@ int main(int argc, char** argv) { ...@@ -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_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, "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; int more;
size_t more_size = sizeof(more); size_t more_size = sizeof(more);
......
...@@ -28,7 +28,7 @@ int main (void) ...@@ -28,7 +28,7 @@ int main (void)
// Create server and bind to endpoint // Create server and bind to endpoint
void *server = zmq_socket (ctx, ZMQ_ROUTER); void *server = zmq_socket (ctx, ZMQ_ROUTER);
assert (server); assert (server);
int rc = zmq_bind (server, "tcp://*:5560"); int rc = zmq_bind (server, "tcp://127.0.0.1:5560");
assert (rc == 0); assert (rc == 0);
// Create client and connect to server, doing a probe // Create client and connect to server, doing a probe
......
...@@ -42,7 +42,7 @@ int main (void) ...@@ -42,7 +42,7 @@ int main (void)
rc = zmq_connect (req, "tcp://localhost:5555"); rc = zmq_connect (req, "tcp://localhost:5555");
assert (rc == 0); assert (rc == 0);
rc = zmq_bind (router, "tcp://*:5555"); rc = zmq_bind (router, "tcp://127.0.0.1:5555");
assert (rc == 0); assert (rc == 0);
// Send a multi-part request. // Send a multi-part request.
......
...@@ -36,7 +36,7 @@ int main (void) ...@@ -36,7 +36,7 @@ int main (void)
rc = zmq_setsockopt (req, ZMQ_REQ_REQUEST_IDS, &enabled, sizeof (int)); rc = zmq_setsockopt (req, ZMQ_REQ_REQUEST_IDS, &enabled, sizeof (int));
assert (rc == 0); assert (rc == 0);
rc = zmq_bind (req, "tcp://*:5555"); rc = zmq_bind (req, "tcp://127.0.0.1:5555");
assert (rc == 0); assert (rc == 0);
const size_t services = 5; const size_t services = 5;
......
...@@ -109,7 +109,7 @@ int main (void) ...@@ -109,7 +109,7 @@ int main (void)
assert (rc == 0); assert (rc == 0);
rc = zmq_setsockopt (server, ZMQ_IDENTITY, "IDENT", 6); rc = zmq_setsockopt (server, ZMQ_IDENTITY, "IDENT", 6);
assert (rc == 0); assert (rc == 0);
rc = zmq_bind (server, "tcp://*:9998"); rc = zmq_bind (server, "tcp://127.0.0.1:9998");
assert (rc == 0); assert (rc == 0);
// Check CURVE security with valid credentials // Check CURVE security with valid credentials
......
...@@ -83,12 +83,12 @@ int main (void) ...@@ -83,12 +83,12 @@ int main (void)
// We first test client/server with no ZAP domain // We first test client/server with no ZAP domain
// Libzmq does not call our ZAP handler, the connect must succeed // 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); assert (rc == 0);
rc = zmq_connect (client, "tcp://localhost:9000"); rc = zmq_connect (client, "tcp://localhost:9000");
assert (rc == 0); assert (rc == 0);
bounce (server, client); bounce (server, client);
zmq_unbind (server, "tcp://*:9000"); zmq_unbind (server, "tcp://127.0.0.1:9000");
zmq_disconnect (client, "tcp://localhost:9000"); zmq_disconnect (client, "tcp://localhost:9000");
// Now define a ZAP domain for the server; this enables // Now define a ZAP domain for the server; this enables
...@@ -111,18 +111,18 @@ int main (void) ...@@ -111,18 +111,18 @@ int main (void)
//// The above code should not be required //// The above code should not be required
//rc = zmq_setsockopt (server, ZMQ_ZAP_DOMAIN, "WRONG", 5); //rc = zmq_setsockopt (server, ZMQ_ZAP_DOMAIN, "WRONG", 5);
//assert (rc == 0); //assert (rc == 0);
//rc = zmq_bind (server, "tcp://*:9001"); //rc = zmq_bind (server, "tcp://127.0.0.1:9001");
//assert (rc == 0); //assert (rc == 0);
//rc = zmq_connect (client, "tcp://localhost:9001"); //rc = zmq_connect (client, "tcp://localhost:9001");
//assert (rc == 0); //assert (rc == 0);
//expect_bounce_fail (server, client); //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"); //zmq_disconnect (client, "tcp://localhost:9001");
// Now use the right domain, the test must pass // Now use the right domain, the test must pass
rc = zmq_setsockopt (server, ZMQ_ZAP_DOMAIN, "TEST", 4); rc = zmq_setsockopt (server, ZMQ_ZAP_DOMAIN, "TEST", 4);
assert (rc == 0); assert (rc == 0);
rc = zmq_bind (server, "tcp://*:9002"); rc = zmq_bind (server, "tcp://127.0.0.1:9002");
assert (rc == 0); assert (rc == 0);
rc = zmq_connect (client, "tcp://localhost:9002"); rc = zmq_connect (client, "tcp://localhost:9002");
assert (rc == 0); assert (rc == 0);
...@@ -132,7 +132,7 @@ int main (void) ...@@ -132,7 +132,7 @@ int main (void)
// never succeeds and the test hangs. // never succeeds and the test hangs.
// ************************************************************** // **************************************************************
bounce (server, client); bounce (server, client);
zmq_unbind (server, "tcp://*:9002"); zmq_unbind (server, "tcp://127.0.0.1:9002");
zmq_disconnect (client, "tcp://localhost:9002"); zmq_disconnect (client, "tcp://localhost:9002");
// Shutdown // Shutdown
......
...@@ -90,7 +90,7 @@ int main (void) ...@@ -90,7 +90,7 @@ int main (void)
int as_server = ZMQ_SERVER; int as_server = ZMQ_SERVER;
rc = zmq_setsockopt (server, ZMQ_PLAIN_NODE, &as_server, sizeof (int)); rc = zmq_setsockopt (server, ZMQ_PLAIN_NODE, &as_server, sizeof (int));
assert (rc == 0); assert (rc == 0);
rc = zmq_bind (server, "tcp://*:9998"); rc = zmq_bind (server, "tcp://127.0.0.1:9998");
assert (rc == 0); assert (rc == 0);
char username [256]; char username [256];
......
...@@ -222,7 +222,7 @@ int main (void) ...@@ -222,7 +222,7 @@ int main (void)
void *ctx = zmq_ctx_new (); void *ctx = zmq_ctx_new ();
assert (ctx); 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" }; const char *connects [] = { "inproc://a", "tcp://localhost:5555" };
for (int transports = 0; transports < 2; ++transports) { for (int transports = 0; transports < 2; ++transports) {
......
...@@ -260,7 +260,7 @@ int main (void) ...@@ -260,7 +260,7 @@ int main (void)
void *ctx = zmq_ctx_new (); void *ctx = zmq_ctx_new ();
assert (ctx); 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" }; const char *connects [] = { "inproc://a", "tcp://localhost:5555" };
for (int transport = 0; transport < 2; ++transport) { for (int transport = 0; transport < 2; ++transport) {
......
...@@ -125,7 +125,7 @@ int main (void) ...@@ -125,7 +125,7 @@ int main (void)
void *ctx = zmq_ctx_new (); void *ctx = zmq_ctx_new ();
assert (ctx); 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" }; const char *connects [] = { "inproc://a", "tcp://localhost:5555" };
for (int transport = 0; transport < 2; ++transport) { for (int transport = 0; transport < 2; ++transport) {
......
...@@ -217,7 +217,7 @@ int main (void) ...@@ -217,7 +217,7 @@ int main (void)
void *ctx = zmq_ctx_new (); void *ctx = zmq_ctx_new ();
assert (ctx); 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" }; const char *connects [] = { "inproc://a", "tcp://localhost:5555" };
for (int transport = 0; transport < 2; transport++) { for (int transport = 0; transport < 2; transport++) {
......
...@@ -179,7 +179,7 @@ int main (void) ...@@ -179,7 +179,7 @@ int main (void)
void *ctx = zmq_ctx_new (); void *ctx = zmq_ctx_new ();
assert (ctx); 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" }; const char *connects [] = { "inproc://a", "tcp://localhost:5555" };
for (int transport = 0; transport < 2; ++transport) { for (int transport = 0; transport < 2; ++transport) {
......
...@@ -54,7 +54,7 @@ test_stream_to_dealer (void) ...@@ -54,7 +54,7 @@ test_stream_to_dealer (void)
int zero = 0; int zero = 0;
rc = zmq_setsockopt (stream, ZMQ_LINGER, &zero, sizeof (zero)); rc = zmq_setsockopt (stream, ZMQ_LINGER, &zero, sizeof (zero));
assert (rc == 0); assert (rc == 0);
rc = zmq_bind (stream, "tcp://*:5556"); rc = zmq_bind (stream, "tcp://127.0.0.1:5556");
assert (rc == 0); assert (rc == 0);
// We'll be using this socket as the other peer // We'll be using this socket as the other peer
...@@ -173,7 +173,7 @@ test_stream_to_stream (void) ...@@ -173,7 +173,7 @@ test_stream_to_stream (void)
void *server = zmq_socket (ctx, ZMQ_STREAM); void *server = zmq_socket (ctx, ZMQ_STREAM);
assert (server); assert (server);
rc = zmq_bind (server, "tcp://*:8080"); rc = zmq_bind (server, "tcp://127.0.0.1:8080");
assert (rc == 0); assert (rc == 0);
void *client = zmq_socket (ctx, ZMQ_STREAM); void *client = zmq_socket (ctx, ZMQ_STREAM);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment