TokTok / c-toxcore

The future of online communications.
https://tox.chat
GNU General Public License v3.0
2.27k stars 285 forks source link

Use socket-wrapper in tests if available (and use it on CI). #1524

Open iphydf opened 4 years ago

iphydf commented 4 years ago

E.g.: LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libsocket_wrapper.so ./lan_discovery_test

We can use this to make our tests on CI more reliable, except for the ones that need a real internet connection, the non-hermetic bootstrap and tcp relay tests. Marking those explicitly in the build as non-hermetic allows us to ensure no other tests are non-hermetic.

References: https://lwn.net/Articles/594863/

iphydf commented 2 years ago

This doesn't seem to work:

$ LD_PRELOAD=libsocket_wrapper.so \
    SOCKET_WRAPPER_DIR=/tmp/tmp.bQRELqDrhM \
    SOCKET_WRAPPER_DEFAULT_IFACE=10 \
    bazel-bin/c-toxcore/auto_tests/tox_dispatch_test
[#1] DEBUG network.c:966    new_networking_ex:  Dual-stack socket: enabled
[#1] DEBUG network.c:983    new_networking_ex:  Local multicast group FF02::1 joined successfully. (92, Protocol not available)
[#1] DEBUG network.c:1022   new_networking_ex:  Bound successfully to :::33445
[#2] DEBUG network.c:966    new_networking_ex:  Dual-stack socket: enabled
[#2] DEBUG network.c:983    new_networking_ex:  Local multicast group FF02::1 joined successfully. (92, Protocol not available)
[#2] DEBUG network.c:1022   new_networking_ex:  Bound successfully to :::33445
bootstrapping and connecting 2 toxes

Both toxes bind to the same port and don't connect.

cryptomilk commented 2 years ago

You open the same port on the same IP address, that won't work. You need two different IP addresses ...