mirror of
https://github.com/SChernykh/p2pool.git
synced 2024-11-16 15:57:39 +00:00
Sync test: run with TSAN on Ubuntu
This commit is contained in:
parent
7134187dc9
commit
325f2dc22f
5 changed files with 26 additions and 3 deletions
4
.github/workflows/test-sync.yml
vendored
4
.github/workflows/test-sync.yml
vendored
|
@ -24,7 +24,7 @@ jobs:
|
|||
run: |
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -DDEV_TEST_SYNC=ON -DCMAKE_C_COMPILER=gcc-12 -DCMAKE_CXX_COMPILER=g++-12
|
||||
cmake .. -DDEV_TEST_SYNC=ON -DDEV_WITH_TSAN=ON -DCMAKE_C_COMPILER=gcc-12 -DCMAKE_CXX_COMPILER=g++-12
|
||||
make -j$(nproc)
|
||||
|
||||
- name: Run p2pool
|
||||
|
@ -35,7 +35,7 @@ jobs:
|
|||
python ../tests/src/stratum_dummy.py stratum_dummy1.log &
|
||||
python ../tests/src/stratum_dummy.py stratum_dummy2.log &
|
||||
python ../tests/src/stratum_dummy.py stratum_dummy3.log &
|
||||
./p2pool --host p2pmd.xmrvsbeast.com --zmq-port 18084 --wallet 44MnN1f3Eto8DZYUWuE5XZNUtE3vcRzt2j6PzqWpPau34e6Cf4fAxt6X2MBmrm6F9YMEiMNjN6W4Shn4pLcfNAja621jwyg --data-api data --local-api --loglevel 6
|
||||
TSAN_OPTIONS="suppressions=../tests/src/tsan_sup.txt halt_on_error=1" ./p2pool --host p2pmd.xmrvsbeast.com --zmq-port 18084 --wallet 44MnN1f3Eto8DZYUWuE5XZNUtE3vcRzt2j6PzqWpPau34e6Cf4fAxt6X2MBmrm6F9YMEiMNjN6W4Shn4pLcfNAja621jwyg --data-api data --local-api --loglevel 6
|
||||
grep 'Synchronization finished successfully' p2pool.log
|
||||
|
||||
- name: Archive p2pool.log
|
||||
|
|
|
@ -8,6 +8,7 @@ option(WITH_LTO "Use link-time compiler optimization (if linking fails for you,
|
|||
option(WITH_UPNP "Include UPnP support. If this is turned off, p2pool will not be able to configure port forwarding on UPnP-enabled routers." ON)
|
||||
|
||||
option(DEV_TEST_SYNC "[Developer only] Sync test, stop p2pool after sync is complete" OFF)
|
||||
option(DEV_WITH_TSAN "[Developer only] Compile with thread sanitizer" OFF)
|
||||
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")
|
||||
|
||||
|
@ -31,6 +32,10 @@ if (DEV_TEST_SYNC)
|
|||
add_definitions(-DDEV_TEST_SYNC)
|
||||
endif()
|
||||
|
||||
if (DEV_WITH_TSAN)
|
||||
add_definitions(-DDEV_WITH_TSAN)
|
||||
endif()
|
||||
|
||||
include(cmake/flags.cmake)
|
||||
|
||||
set(HEADERS
|
||||
|
|
|
@ -7,8 +7,18 @@ set(CMAKE_C_STANDARD_REQUIRED ON)
|
|||
|
||||
if (CMAKE_CXX_COMPILER_ID MATCHES GNU)
|
||||
set(GENERAL_FLAGS "-pthread")
|
||||
|
||||
if (DEV_WITH_TSAN)
|
||||
set(GENERAL_FLAGS "${GENERAL_FLAGS} -fno-omit-frame-pointer -fsanitize=thread")
|
||||
endif()
|
||||
|
||||
set(WARNING_FLAGS "-Wall -Wextra -Wcast-align -Wcast-qual -Wlogical-op -Wstrict-overflow=2 -Wundef -Wformat=2 -Wpointer-arith -Werror")
|
||||
|
||||
if (DEV_WITH_TSAN)
|
||||
set(OPTIMIZATION_FLAGS "-O2 -g")
|
||||
else()
|
||||
set(OPTIMIZATION_FLAGS "-Ofast -s")
|
||||
endif()
|
||||
|
||||
if (WITH_LTO)
|
||||
set(OPTIMIZATION_FLAGS "${OPTIMIZATION_FLAGS} -flto -fuse-linker-plugin")
|
||||
|
|
|
@ -154,7 +154,9 @@ public:
|
|||
memcpy(p + 1, buf + 1, size - 1);
|
||||
|
||||
// Ensure memory order in the writer thread
|
||||
#ifndef DEV_WITH_TSAN
|
||||
std::atomic_thread_fence(std::memory_order_seq_cst);
|
||||
#endif
|
||||
|
||||
// Mark that everything is written into this log slot
|
||||
p[0] = buf[0] + 1;
|
||||
|
@ -221,7 +223,9 @@ private:
|
|||
}
|
||||
|
||||
// Ensure memory order in the reader thread
|
||||
#ifndef DEV_WITH_TSAN
|
||||
std::atomic_thread_fence(std::memory_order_seq_cst);
|
||||
#endif
|
||||
|
||||
uint32_t size = static_cast<uint8_t>(p[2]);
|
||||
size = (size << 8) + static_cast<uint8_t>(p[1]);
|
||||
|
|
4
tests/src/tsan_sup.txt
Normal file
4
tests/src/tsan_sup.txt
Normal file
|
@ -0,0 +1,4 @@
|
|||
race:p2pool::log::Worker::run()
|
||||
race:p2pool::log::Worker::write
|
||||
called_from_lib:libzmq.so
|
||||
race_top:do_loglevel
|
Loading…
Reference in a new issue