zeromq / azmq

C++ language binding library integrating ZeroMQ with Boost Asio
Boost Software License 1.0
318 stars 108 forks source link

test fails on OSX #183

Closed ClausKlein closed 2 years ago

ClausKlein commented 3 years ago

I can build the project but one test fails:

bash-3.2$ make
cmake -B ../build -S . -G Ninja # TODO -D ZMQ_ROOT=../../stage
-- ZeroMQ version: 4.1.0
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/clausklein/Workspace/c/libzmq/examples/build
ninja -C ../build
ninja: Entering directory `../build'
ninja: no work to do.
cd ../build && ctest --rerun-failed --output-on-failure
Test project /Users/clausklein/Workspace/c/libzmq/examples/build
    Start 4: test_socket
1/1 Test #4: test_socket ......................***Failed    6.24 sec

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
test_socket is a Catch v1.0 b53 host application.
Run with -? for options

-------------------------------------------------------------------------------
Socket Monitor
-------------------------------------------------------------------------------
/Users/clausklein/Workspace/c/libzmq/examples/azmq/test/socket/main.cpp:554
...............................................................................

/Users/clausklein/Workspace/c/libzmq/examples/azmq/test/socket/main.cpp:607: FAILED:
  CHECK( server_monitor.events_.at(i++).e == 0x0400 )
with expansion:
  512 == 1024

/Users/clausklein/Workspace/c/libzmq/examples/azmq/test/socket/main.cpp:608: FAILED:
  REQUIRE( server_monitor.events_.size() == i )
with expansion:
  5 == 4

===============================================================================
test cases: 13 | 12 passed | 1 failed
assertions: 50 | 48 passed | 2 failed

0% tests passed, 1 tests failed out of 1

Total Test time (real) =   6.25 sec

The following tests FAILED:
      4 - test_socket (Failed)
Errors while running CTest
make: *** [all] Error 8
bash-3.2$ 
aboseley commented 3 years ago

This looks related to https://github.com/zeromq/azmq/issues/169

aboseley commented 3 years ago

What version of zmq are you using? Did you enable ZMQ_BUILD_DRAFT?

ClausKlein commented 3 years ago

What version of zmq are you using? Did you enable ZMQ_BUILD_DRAFT?

Not yet

ClausKlein commented 3 years ago

@aboseley May you have a look at this CI test failures too? I try to prevent usage of deprecated boost::asio interfaces:

aboseley commented 3 years ago

See the following link for the tests running successfully on macos 11 and 10.15 https://github.com/aboseley/azmq/runs/3586293691

I'm not sure why your test is failing.

ClausKlein commented 3 years ago

See the following link for the tests running successfully on macos 11 and 10.15 https://github.com/aboseley/azmq/runs/3586293691

I'm not sure why your test is failing.

better now, but not all:

Claus-iMac:libzmq clausklein$ make test
mkdir -p ../.build-libzmq-Debug
cd ../.build-libzmq-Debug && cmake -G Ninja -Wno-deprecated -Wno-dev \
      -DENABLE_DRAFTS=1 \
      -DUSE_LCOV=OFF -DCMAKE_BUILD_TYPE=Debug \
      -DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=BOTH \
      -DCMAKE_PREFIX_PATH="/Users/clausklein/Workspace/cpp/libzmq/stage;/Users/clausklein/Workspace/cpp/libzmq/stage;/usr/local/opt/boost;/opt/local;/usr" \
      -DCMAKE_STAGING_PREFIX=/Users/clausklein/Workspace/cpp/libzmq/stage \
      -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_C_COMPILER=/usr/bin/gcc -DCMAKE_CXX_COMPILER=/usr/bin/g++ /Users/clausklein/Workspace/cpp/libzmq
-- Detected ZMQ Version - 4.3.5
-- Building draft classes and methods
-- Using radix tree implementation to manage subscriptions
-- Enable WebSocket transport
-- Enable WSS transport
-- Checking for module 'libbsd'
--   No package 'libbsd' found
-- Using libsodium for CURVE security
-- Using polling method in I/O threads: kqueue
-- Using polling method in zmq_poll(er)_* API: poll
-- Using 64 bytes alignment for lock-free data structures
-- Using condition_variable_t implementation: stl11
-- Checking whether noexcept is supported
-- Checking whether SOCK_CLOEXEC is supported
-- Checking whether O_CLOEXEC is supported
-- Checking whether SO_BINDTODEVICE is supported
-- Checking whether SO_KEEPALIVE is supported
-- Checking whether SO_PRIORITY is supported
-- Checking whether TCP_KEEPCNT is supported
-- Checking whether TCP_KEEPIDLE is supported
-- Checking whether TCP_KEEPINTVL is supported
-- Checking whether TCP_KEEPALIVE is supported
-- Checking whether TIPC is supported
-- Checking pthread_setname signature
-- Checking pthread_setaffinity signature
-- Checking whether getrandom is supported
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/clausklein/Workspace/cpp/.build-libzmq-Debug
# -DCMAKE_PROJECT_INCLUDE_BEFORE=/Users/clausklein/Workspace/cmake/before_project_setup.cmake \
        # -DCMAKE_PROJECT_INCLUDE=/Users/clausklein/Workspace/cmake/build_options.cmake \
    touch .configure-Debug
ln -sf ../.build-libzmq-Debug/compile_commands.json .
find . -name CMakeLists.txt -o -name '*.cmake' -o -iname 'cmake*.in' -o -name '*meson*' > .buildfiles.log
cmake --build ../.build-libzmq-Debug --  all
ninja: no work to do.
cd ../.build-libzmq-Debug && ctest -C Debug --rerun-failed --output-on-failure .
Test project /Users/clausklein/Workspace/cpp/.build-libzmq-Debug
    Start 77: test_security_curve
1/1 Test #77: test_security_curve ..............***Exception: SegFault  0.01 sec

0% tests passed, 1 tests failed out of 1

Total Test time (real) =   0.02 sec

The following tests FAILED:
     77 - test_security_curve (SEGFAULT)
Errors while running CTest
make: *** [test] Error 8
Claus-iMac:libzmq clausklein$ 
ClausKlein commented 3 years ago

Note: there is also a deprecated g++ warning:

[200/442] Building CXX object tests/CMakeFiles/test_wss_transport.dir/test_wss_transport.cpp.o
/Users/clausklein/Workspace/cpp/libzmq/tests/test_wss_transport.cpp:128:25: warning: variable length arrays are a C99 feature [-Wvla-extension]
    char connect_address[MAX_SOCKET_STRING + strlen ("/roundtrip")];
                        ^
1 warning generated.
ClausKlein commented 3 years ago

I have installed==> Pouring libsodium--1.0.18_1.big_sur.bottle.tar.gz

ClausKlein commented 3 years ago

See the following link for the tests running successfully on macos 11 and 10.15 https://github.com/aboseley/azmq/runs/3586293691

I'm not sure why your test is failing.

I know the different: your build use the last ZMQ4 release version v4.3.2. see https://github.com/zeromq/azmq/compare/master...aboseley:adam/github-pipeline

well done!

I use the lastest brew version:

Claus-iMac:libzmq clausklein$ brew info zeromq
zeromq: stable 4.3.4 (bottled), HEAD
High-performance, asynchronous messaging library
https://zeromq.org/
/usr/local/Cellar/zeromq/4.3.4 (83 files, 6.0MB)
ClausKlein commented 3 years ago

the problem is here: https://github.com/ClausKlein/azmq/commit/d355ef3b128ef04e6a85f6b252ece7436dc055a1

aboseley commented 2 years ago

I'm not sure if your suggestion will always fix the issue. I'm see this test failing and passing on both macos and linux somewhat randomly. I wonder if there is a timing issue.

aboseley commented 2 years ago

https://github.com/aboseley/azmq/commit/0d985a9108cd3d5a4153a413a280cb3c98615692

aboseley commented 2 years ago

fix merged to master

aboseley commented 2 years ago

If I load up the CPU on linux, with something like stress-ng --cpu 2 I can repeat this issue with both v4.3.0 and v4.3.4 of libzmq.