Skip to content

Set c/c++ compiler

Set c/c++ compiler #4

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:
integration-test-suite:
runs-on: self-hosted
env:
ERIGON_DATA_DIR: /opt/erigon-versions/reference-version/datadir
RPC_PAST_TEST_DIR: /opt/rpc-past-tests
ERIGON_QA_PATH: /opt/erigon-qa
steps:
- name: Checkout Silkworm Repository
uses: actions/checkout@v3
with:
submodules: recursive
fetch-depth: "1" # Fetch only the last commit, not the entire history
- name: Clean Build Directory
run: rm -rf ${{runner.workspace}}/silkworm/build
- name: Create Build Environment
run: cmake -E make_directory ${{runner.workspace}}/silkworm/build
- 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=../project/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
working-directory: ${{runner.workspace}}/silkworm/build/cmd/test
id: test_step
run: |
set +e # Disable exit on error
./rpcdaemon_fuzzer_test $RPC_PAST_TEST_DIR/silkworm-fuzzer/corpus artifacts -max_total_time=86400 -detect_leaks=0
# To enable running multiple tests in parallel, use the following command
# ./rpcdaemon_fuzzer_test $RPC_PAST_TEST_DIR/silkworm-fuzzer/corpus artifacts -max_total_time=86400 -detect_leaks=0 -jobs=8
# Check test runner exit status
if [ $test_exit_status -eq 0 ]; then
echo "tests completed successfully"
echo
echo "TEST_RESULT=success" >> "$GITHUB_OUTPUT"
else
echo "error detected during tests"
echo "TEST_RESULT=failure" >> "$GITHUB_OUTPUT"
# Save failed results to a directory with timestamp and commit hash
cp crash-* $RPC_PAST_TEST_DIR/silkworm-fuzzer/crashes/
fi
- name: Resume the Erigon instance dedicated to db maintenance
run: |
python3 $ERIGON_QA_PATH/test_system/db-producer/resume_production.py || true
- name: Action for Success
if: steps.test_step.outputs.TEST_RESULT == 'success'
run: echo "::notice::Tests completed successfully"
- name: Action for Failure
if: steps.test_step.outputs.TEST_RESULT != 'success'
run: |
echo "::error::Error detected during tests"
exit 1