diff --git a/.github/workflows/test-sync.yml b/.github/workflows/test-sync.yml index 6d0f396..48a8aa1 100644 --- a/.github/workflows/test-sync.yml +++ b/.github/workflows/test-sync.yml @@ -286,6 +286,63 @@ jobs: build/*.log build/data/ + sync-test-ubuntu-tysan: + timeout-minutes: 60 + runs-on: ubuntu-22.04 + + steps: + - name: Install dependencies + run: | + sudo apt update + sudo apt install -y git build-essential cmake libuv1-dev libzmq3-dev libgss-dev libcurl4-openssl-dev libidn2-0-dev + + - name: Install clang + run: | + wget https://apt.llvm.org/llvm.sh + chmod +x llvm.sh + sudo ./llvm.sh 21 all + + - name: Checkout repository + uses: actions/checkout@v4 + with: + submodules: recursive + + - name: Build p2pool + run: | + mkdir build + cd build + cmake .. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=clang-21 -DCMAKE_CXX_COMPILER=clang++-21 -DDEV_TEST_SYNC=ON -DDEV_DEBUG=ON -DDEV_WITH_TYSAN=ON -DCMAKE_C_FLAGS="-fno-omit-frame-pointer -fsanitize=type -O0 -g3" -DCMAKE_CXX_FLAGS="-fno-omit-frame-pointer -fsanitize=type -O0 -g3" -DWITH_LTO=OFF -DWITH_INDEXED_HASHES=ON -DCMAKE_POLICY_VERSION_MINIMUM="3.5" + make -j$(nproc) p2pool + + - name: Run p2pool + run: | + cd build + mkdir data + python ../tests/src/stratum_dummy.py 1 & + python ../tests/src/stratum_dummy.py 2 & + python ../tests/src/stratum_dummy.py 3 & + sudo sysctl vm.mmap_rnd_bits=28 + TYSAN_OPTIONS=print_stacktrace=1 ./p2pool --host node.monerodevs.org --rpc-port 18089 --zmq-port 18084 --host node.richfowler.net --rpc-port 18089 --zmq-port 18084 --rpc-ssl --wallet 44MnN1f3Eto8DZYUWuE5XZNUtE3vcRzt2j6PzqWpPau34e6Cf4fAxt6X2MBmrm6F9YMEiMNjN6W4Shn4pLcfNAja621jwyg ${{ secrets.MM_PARAMS }} --out-peers 50 --data-api data --local-api --loglevel 6 --light-mode 2> stderr.log + + - name: Check synchronization + run: | + cd build + grep 'Synchronization finished successfully' p2pool.log + + - name: Check p2pool.log for errors + run: | + cd build + ../scripts/workflows/test-sync-check.sh + + - name: Archive p2pool.log + if: '!cancelled()' + uses: actions/upload-artifact@v4 + with: + name: p2pool_ubuntu_data_tysan + path: | + build/*.log + build/data/ + sync-test-macos: timeout-minutes: 120 diff --git a/CMakeLists.txt b/CMakeLists.txt index 3088734..7b2759a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -27,6 +27,7 @@ option(DEV_WITH_TSAN "[Developer only] Compile with thread sanitizer" OFF) option(DEV_WITH_MSAN "[Developer only] Compile with memory sanitizer" OFF) option(DEV_WITH_UBSAN "[Developer only] Compile with undefined behavior sanitizer" OFF) option(DEV_WITH_ASAN "[Developer only] Compile with address sanitizer" OFF) +option(DEV_WITH_TYSAN "[Developer only] Compile with type sanitizer" OFF) option(DEV_CLANG_TIDY "[Developer only] Compile for clang-tidy" OFF) option(DEV_TRACK_MEMORY "[Developer only] Track memory allocations" OFF) option(DEV_DEBUG "[Developer only] Compile a debug build" OFF) diff --git a/cmake/flags.cmake b/cmake/flags.cmake index ce688b9..370e222 100644 --- a/cmake/flags.cmake +++ b/cmake/flags.cmake @@ -113,6 +113,10 @@ elseif (CMAKE_CXX_COMPILER_ID MATCHES Clang) set(GENERAL_FLAGS "${GENERAL_FLAGS} -mfix-cortex-a53-835769") endif() + if (DEV_WITH_TYSAN) + set(GENERAL_FLAGS "${GENERAL_FLAGS} -fno-omit-frame-pointer -fsanitize=type") + endif() + set(WARNING_FLAGS "-Wall -Wextra -Wno-unused-function -Wno-undefined-internal -Wno-unknown-warning-option -Wno-nan-infinity-disabled -Wunreachable-code-aggressive -Wmissing-prototypes -Wmissing-variable-declarations -Werror") if (NOT (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 20)) @@ -123,7 +127,7 @@ elseif (CMAKE_CXX_COMPILER_ID MATCHES Clang) set(WARNING_FLAGS "-w") endif() - if (DEV_WITH_MSAN OR DEV_DEBUG OR (CMAKE_BUILD_TYPE STREQUAL "Debug") OR (CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")) + if (DEV_WITH_MSAN OR DEV_WITH_TYSAN OR DEV_DEBUG OR (CMAKE_BUILD_TYPE STREQUAL "Debug") OR (CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")) add_definitions(-DDEBUG_BUILD) if (CMAKE_BUILD_TYPE STREQUAL "Debug") set(OPTIMIZATION_FLAGS "-O0")