QA - RPC Fuzzer Tests #31
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: QA - RPC Fuzzer Tests | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 0 * * 0' # Runs every Sunday at 00:00 AM UTC | |
push: | |
branches: | |
- fuzzer-github-actions | |
jobs: | |
fuzzer-test-suite: | |
runs-on: self-hosted | |
env: | |
RPC_PAST_TEST_DIR: /opt/rpc-past-tests | |
ERIGON_QA_PATH: /opt/erigon-qa | |
timeout-minutes: 1440 | |
steps: | |
- name: Checkout Silkworm Repository | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
fetch-depth: "1" # Fetch only the last commit, not the entire history | |
- name: Install Compiler (Clang 15) | |
run: | | |
# Ensure the correct version of Clang is installed | |
# sudo apt-get install -y libc++-15-dev libc++abi-15-dev clang-15 | |
# Set the compiler paths | |
sudo ln -sfv /usr/bin/clang-15 /usr/bin/clang | |
sudo ln -sfv /usr/bin/clang++-15 /usr/bin/clang++ | |
sudo update-alternatives --install /usr/bin/cc cc /usr/bin/clang 120 | |
sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/clang++ 120 | |
update-alternatives --query cc | |
update-alternatives --query c++ | |
- name: Clean Build Directory | |
run: rm -rf ${{runner.workspace}}/silkworm/build | |
- name: Create Build Environment | |
run: cmake -E make_directory ${{runner.workspace}}/silkworm/build | |
# Temporarily disabled, try to enable it if issues with building Conan packages (e.g. Boost) arise | |
# - name: Preinstall Conan packages | |
# working-directory: ${{runner.workspace}}/silkworm | |
# run: conan install --install-folder=build/conan --build=missing --profile=cmake/profiles/linux_x64_clang_13_release . | |
- name: Configure CMake | |
working-directory: ${{runner.workspace}}/silkworm/build | |
run: CC=clang-15 CXX=clang++-15 cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCONAN_PROFILE=linux_x64_clang_13_release -DCMAKE_TOOLCHAIN_FILE=../cmake/toolchain/clang_libcxx.cmake -DSILKWORM_FUZZER=ON | |
- name: Build Silkworm Fuzzer Test | |
working-directory: ${{runner.workspace}}/silkworm/build | |
run: CC=clang-15 CXX=clang++-15 cmake --build . --target rpcdaemon_fuzzer_test -j 8 | |
- name: Prepare Corpus Directories | |
working-directory: ${{runner.workspace}}/silkworm/build/cmd/test | |
run: | | |
echo "Ensure persistent directories for fuzzing corpus are created" | |
mkdir -p $RPC_PAST_TEST_DIR/silkworm-fuzzer/corpus | |
mkdir -p $RPC_PAST_TEST_DIR/silkworm-fuzzer/crashes | |
echo "Create corpus artifacts from execution-api specification" | |
mkdir -p artifacts | |
for file in ../../../third_party/execution-apis/tests/*/*.io; do cp --backup=numbered "$file" artifacts; done | |
for file in artifacts/*; do sed -i '2,$d' "$file"; done | |
for file in artifacts/*; do sed -i 's/^>> //' "$file"; done | |
- name: Pause the Erigon instance dedicated to db maintenance | |
run: | | |
python3 $ERIGON_QA_PATH/test_system/db-producer/pause_production.py || true | |
- name: Execute Silkworm Fuzzer Test | |
timeout-minutes: 1440 | |
working-directory: ${{runner.workspace}}/silkworm/build/cmd/test | |
run: | | |
# # Single thread execution | |
# ./rpcdaemon_fuzzer_test $RPC_PAST_TEST_DIR/silkworm-fuzzer/corpus artifacts -max_total_time=86300 -detect_leaks=0 | |
# Multi-thread execution | |
./rpcdaemon_fuzzer_test $RPC_PAST_TEST_DIR/silkworm-fuzzer/corpus artifacts -max_total_time=86300 -detect_leaks=0 -jobs=4 -rss_limit_mb=8192 | |
- name: Tear Down | |
if: always() | |
working-directory: ${{runner.workspace}}/silkworm/build/cmd/test | |
run: | | |
# Reset compiler paths | |
sudo update-alternatives --remove cc /usr/bin/clang | |
sudo update-alternatives --remove c++ /usr/bin/clang++ | |
sudo rm -f /usr/bin/clang | |
sudo rm -f /usr/bin/clang++ | |
# Save failed results to the crash directory (ignore errors) | |
cp crash-* $RPC_PAST_TEST_DIR/silkworm-fuzzer/crashes/ 2>/dev/null || : | |
cp leak-* $RPC_PAST_TEST_DIR/silkworm-fuzzer/crashes/ 2>/dev/null || : | |
# Resume the Erigon instance dedicated to db maintenance | |
python3 $ERIGON_QA_PATH/test_system/db-producer/resume_production.py || true | |