From e8d878ca1ae6ac138c1b8e0a340bb4c69e4526d3 Mon Sep 17 00:00:00 2001 From: nponeccop Date: Tue, 17 Jun 2014 19:54:30 +0300 Subject: [PATCH 1/2] ipc:// is not supported on Windows https://zeromq.jira.com/browse/LIBZMQ-153 - here's official bug report. I used a rather dirty way of getting a free port instead of `TCP::Test::empty_port()` as I didn't want to introduce a dependency on `TCP::Test` if it's not really needed. And I didn't want to make code much more complicated either. So now we have a clear improvement on Windows (it kind of works instead of total failure), and on Unix the code didn't change. --- ZMQ-LibZMQ3/t/104_ipc.t | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ZMQ-LibZMQ3/t/104_ipc.t b/ZMQ-LibZMQ3/t/104_ipc.t index 78c2d9c..425176d 100644 --- a/ZMQ-LibZMQ3/t/104_ipc.t +++ b/ZMQ-LibZMQ3/t/104_ipc.t @@ -9,18 +9,20 @@ BEGIN { } my $path = File::Temp->new(UNLINK => 0); +my $endpoint = $^O eq 'MSWin32' ? 'tcp://127.0.0.1:63'.int(rand(2000)) : "ipc://$path"; + my $pid = Test::SharedFork->fork(); if ($pid == 0) { sleep 1; # hmmm, not a good way to do this... my $ctxt = zmq_init(); my $child = zmq_socket($ctxt, ZMQ_REQ ); - zmq_connect( $child, "ipc://$path" ); + zmq_connect( $child, $endpoint ); zmq_sendmsg( $child, zmq_msg_init_data( "Hello from $$" ) ); exit 0; } elsif ($pid) { my $ctxt = zmq_init(); my $parent_sock = zmq_socket( $ctxt, ZMQ_REP); - zmq_bind( $parent_sock, "ipc://$path" ); + zmq_bind( $parent_sock, $endpoint ); my $msg = zmq_recvmsg( $parent_sock ); my $data = zmq_msg_data($msg); if (! is $data, "Hello from $pid", "message is the expected message") { From ab1823df88b373580173932889ba6c4fb216ee00 Mon Sep 17 00:00:00 2001 From: nponeccop Date: Tue, 17 Jun 2014 20:01:51 +0300 Subject: [PATCH 2/2] inproc:// is used in last_endpoint.t on Windows --- ZMQ-LibZMQ3/t/106_last_endpoint.t | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ZMQ-LibZMQ3/t/106_last_endpoint.t b/ZMQ-LibZMQ3/t/106_last_endpoint.t index 79e6c84..2c2fd6b 100644 --- a/ZMQ-LibZMQ3/t/106_last_endpoint.t +++ b/ZMQ-LibZMQ3/t/106_last_endpoint.t @@ -11,7 +11,7 @@ my $path = File::Temp->new(UNLINK => 0); my $ctxt = zmq_init(); my $sock = zmq_socket($ctxt, ZMQ_REQ ); -my $set_endpoint = "ipc://$path"; +my $set_endpoint = $^O eq 'MSWin32' ? 'inproc://test' : "ipc://$path"; zmq_connect( $sock, $set_endpoint ); my $read_endpoint = zmq_getsockopt($sock, ZMQ_LAST_ENDPOINT);