On Sun, 2019-01-13 at 15:04 +0000, Luca Boccassi wrote:
> On Sun, 2019-01-13 at 13:21 +0000, Luca Boccassi wrote:
> > On Sun, 2019-01-13 at 14:16 +0100, László Böszörményi (GCS) wrote:
> > > On Sun, Jan 13, 2019 at 1:27 AM Luca Boccassi <bl...@debian.org>
> > > wrote:
> > > > On Sat, 12 Jan 2019, 19:53 László Böszörményi (GCS) <gcs@debian
> > > > .o
> > > > rg
> > > >  wrote:
> > > > >  No problem. But I ask for a help with 4.3.1 as one of its
> > > > > tests
> > > > > fail
> > > > > on ppc64el architecture [1].
> > > > > The minimal log I see:
> > > > > "FAIL: tests/test_hwm_pubsub
> > > > > ===========================
> > > > > 
> > > > > Assertion failed: check () (src/msg.cpp:347)
> > > > > FAIL tests/test_hwm_pubsub (exit status: 134)"
> > > > 
> > > > I've seen that test fail sometimes on the very very slow
> > > > windows
> > > > CI
> > > > we use upstream, I've never reproduced it locally or on porter
> > > > machines or on the PPC Linux CI we use upstream.
> > > > I'd suggest to just try to ask wanna-build for a give back, and
> > > > it
> > > > will most likely pass. If it still fails I'll hop on a porter
> > > > box
> > > > tomorrow.
> > > 
> > >  Tested on plummer and about half the time this test is failed.
> > > Once
> > > from ten times an other test is failed as well. I chose to upload
> > > my
> > > build instead of a give back as that may fail as well.
> > 
> > I might have an idea on how to make it more reliable, I'm testing
> > on
> > kyoto right now, as I've seen there's definitely an issue with
> > another
> > test helper doing unaligned pointer access which triggers a sigbus
> > on
> > sparc64 (it's not a problem in the library thankfully, just in the
> > unit
> > test itself).
> 
> I'm seeing very strange behaviour on plummer, with a message which
> internal metadata is getting overwritten. Didn't see that on sparc64
> or
> on my machines, very weird. I'm still looking.

Unfortunately I haven't figured out the test_hwm_pubsub failure yet.
I'd suggest to patch it out for now if it's urgent to do a new upload.
I'll keep investigating later tonight and report back.

It is definitely not related to the fix for the security issue, though.
I've bisected it, and it fails all the way back to when test_hwm_pubsub
was extended to run on TCP and IPC other than inproc by commit
eb3e63e22f64c6974959458dd90db30959c2ebf1 upstream.

> In the meanwhile, I've found and fixed the issue with the other 3
> tests
> that seemingly randomly fail - it's not random at all, it's just that
> they were left with hard-coded IPC file paths, so collisions might
> happen. I've fixed them to use random paths like the others (those
> were
> test_use_fd, test_reconnect_ivl, test_rebind_ipc and test_pair_ipc).

Patches for these are attached.

-- 
Kind regards,
Luca Boccassi
Author: Luca Boccassi <bl...@debian.org>
Description test_security_zap fails on architectures that disallow unaligned pointer access
 use memcpy instead of doing pointer arithmetics with casting
 and dereferencing to fix the error on sparc64
Origin: https://github.com/zeromq/libzmq/pull/3358
--- a/tests/testutil_security.hpp
+++ b/tests/testutil_security.hpp
@@ -345,7 +345,7 @@ static int get_monitor_event_internal (void *monitor_,
     uint8_t *data = (uint8_t *) zmq_msg_data (&msg);
     uint16_t event = *(uint16_t *) (data);
     if (value_)
-        *value_ = *(uint32_t *) (data + 2);
+        memcpy (value_, data + 2, sizeof (uint32_t));
 
     //  Second frame in message contains event address
     zmq_msg_init (&msg);
Author: Luca Boccassi <bl...@debian.org>
Description: tests use hard-coded fixed IPC file path
 use wildcards or random directories to avoid races when
 multiple users are running the same test on the same machine
Origin: https://github.com/zeromq/libzmq/pull/3358
--- a/tests/test_pair_ipc.cpp
+++ b/tests/test_pair_ipc.cpp
@@ -44,11 +44,16 @@ void tearDown ()
 
 void test_roundtrip ()
 {
+    char my_endpoint[256];
+    size_t len = sizeof (my_endpoint);
+
     void *sb = test_context_socket (ZMQ_PAIR);
-    TEST_ASSERT_SUCCESS_ERRNO (zmq_bind (sb, "ipc:///tmp/test_pair_ipc"));
+    TEST_ASSERT_SUCCESS_ERRNO (zmq_bind (sb, "ipc://*"));
+    TEST_ASSERT_SUCCESS_ERRNO (
+      zmq_getsockopt (sb, ZMQ_LAST_ENDPOINT, my_endpoint, &len));
 
     void *sc = test_context_socket (ZMQ_PAIR);
-    TEST_ASSERT_SUCCESS_ERRNO (zmq_connect (sc, "ipc:///tmp/test_pair_ipc"));
+    TEST_ASSERT_SUCCESS_ERRNO (zmq_connect (sc, my_endpoint));
 
     bounce (sb, sc);
 
diff --git a/tests/test_rebind_ipc.cpp b/tests/test_rebind_ipc.cpp
index 830d1803..78464127 100644
--- a/tests/test_rebind_ipc.cpp
+++ b/tests/test_rebind_ipc.cpp
@@ -42,24 +42,27 @@ void tearDown ()
     teardown_test_context ();
 }
 
-static const char *SOCKET_ADDR = "ipc:///tmp/test_rebind_ipc";
-
 void test_rebind_ipc ()
 {
+    char my_endpoint[256];
+    size_t len = sizeof (my_endpoint);
+
     void *sb0 = test_context_socket (ZMQ_PUSH);
     void *sb1 = test_context_socket (ZMQ_PUSH);
 
-    TEST_ASSERT_SUCCESS_ERRNO (zmq_bind (sb0, SOCKET_ADDR));
+    TEST_ASSERT_SUCCESS_ERRNO (zmq_bind (sb0, "ipc://*"));
+    TEST_ASSERT_SUCCESS_ERRNO (
+      zmq_getsockopt (sb0, ZMQ_LAST_ENDPOINT, my_endpoint, &len));
 
     void *sc = test_context_socket (ZMQ_PULL);
-    TEST_ASSERT_SUCCESS_ERRNO (zmq_connect (sc, SOCKET_ADDR));
+    TEST_ASSERT_SUCCESS_ERRNO (zmq_connect (sc, my_endpoint));
 
     send_string_expect_success (sb0, "42", 0);
     recv_string_expect_success (sc, "42", 0);
 
     test_context_socket_close (sb0);
 
-    TEST_ASSERT_SUCCESS_ERRNO (zmq_bind (sb1, SOCKET_ADDR));
+    TEST_ASSERT_SUCCESS_ERRNO (zmq_bind (sb1, my_endpoint));
 
     send_string_expect_success (sb1, "42", 0);
     recv_string_expect_success (sc, "42", 0);
diff --git a/tests/test_reconnect_ivl.cpp b/tests/test_reconnect_ivl.cpp
index b67b40e5..6dd0e4cd 100644
--- a/tests/test_reconnect_ivl.cpp
+++ b/tests/test_reconnect_ivl.cpp
@@ -71,11 +71,15 @@ void test_reconnect_ivl_against_pair_socket (const char *my_endpoint_,
 #if !defined(ZMQ_HAVE_WINDOWS) && !defined(ZMQ_HAVE_GNU)
 void test_reconnect_ivl_ipc (void)
 {
-    const char *ipc_endpoint = "ipc:///tmp/test_reconnect_ivl";
+    char my_endpoint[256];
+    size_t len = sizeof (my_endpoint);
+
     void *sb = test_context_socket (ZMQ_PAIR);
-    TEST_ASSERT_SUCCESS_ERRNO (zmq_bind (sb, ipc_endpoint));
+    TEST_ASSERT_SUCCESS_ERRNO (zmq_bind (sb, "ipc://*"));
+    TEST_ASSERT_SUCCESS_ERRNO (
+      zmq_getsockopt (sb, ZMQ_LAST_ENDPOINT, my_endpoint, &len));
 
-    test_reconnect_ivl_against_pair_socket (ipc_endpoint, sb);
+    test_reconnect_ivl_against_pair_socket (my_endpoint, sb);
     test_context_socket_close (sb);
 }
 #endif
diff --git a/tests/test_use_fd.cpp b/tests/test_use_fd.cpp
index 67414f5b..e9852b13 100644
--- a/tests/test_use_fd.cpp
+++ b/tests/test_use_fd.cpp
@@ -237,24 +237,38 @@ void pre_allocate_sock_ipc_int (void *zmq_socket_, const char *path_)
                              sizeof (struct sockaddr_un));
 }
 
+char ipc_endpoint[16];
+
 void pre_allocate_sock_ipc (void *sb_, char *my_endpoint_)
 {
-    pre_allocate_sock_ipc_int (sb_, "/tmp/test_use_fd_ipc");
-    strcpy (my_endpoint_, "ipc:///tmp/test_use_fd_ipc");
+    strcpy (ipc_endpoint, "tmpXXXXXX");
+
+#ifdef HAVE_MKDTEMP
+    TEST_ASSERT_TRUE (mkdtemp (ipc_endpoint));
+    strcat (ipc_endpoint, "/ipc");
+#else
+    int fd = mkstemp (ipc_endpoint);
+    TEST_ASSERT_TRUE (fd != -1);
+    close (fd);
+#endif
+
+    pre_allocate_sock_ipc_int (sb_, ipc_endpoint);
+    strcpy (my_endpoint_, "ipc://");
+    strcat (my_endpoint_, ipc_endpoint);
 }
 
 void test_req_rep_ipc ()
 {
     test_req_rep (pre_allocate_sock_ipc);
 
-    TEST_ASSERT_SUCCESS_ERRNO (unlink ("/tmp/test_use_fd_ipc"));
+    TEST_ASSERT_SUCCESS_ERRNO (unlink (ipc_endpoint));
 }
 
 void test_pair_ipc ()
 {
     test_pair (pre_allocate_sock_ipc);
 
-    TEST_ASSERT_SUCCESS_ERRNO (unlink ("/tmp/test_use_fd_ipc"));
+    TEST_ASSERT_SUCCESS_ERRNO (unlink (ipc_endpoint));
 }
 
 void test_client_server_ipc ()
@@ -262,7 +276,7 @@ void test_client_server_ipc ()
 #if defined(ZMQ_SERVER) && defined(ZMQ_CLIENT)
     test_client_server (pre_allocate_sock_ipc);
 
-    TEST_ASSERT_SUCCESS_ERRNO (unlink ("/tmp/test_use_fd_ipc"));
+    TEST_ASSERT_SUCCESS_ERRNO (unlink (ipc_endpoint));
 #endif
 }
 

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to