Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance code sanitizers workflow (fixed & resubmitted) #4278

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
92 changes: 36 additions & 56 deletions .github/workflows/code_sanitizers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,73 +2,53 @@ name: Code Sanitizers

on: [push, pull_request, workflow_dispatch]

env:
RELEASE: 0
artifact: 0

jobs:
google_sanitizers_linux:
name: ${{ matrix.SANITIZER }} / ROCKSDB=${{ matrix.TEST_USE_ROCKSDB }} / ${{ matrix.COMPILER }}
timeout-minutes: 90
jobs:
linux_sanitizers:
name: Linux [${{ matrix.SANITIZER }}] [${{ matrix.BACKEND }} | ${{ matrix.COMPILER }}]
timeout-minutes: 120
strategy:
fail-fast: false
matrix:
TEST_USE_ROCKSDB: [0, 1]
BACKEND: [lmdb, rocksdb]
COMPILER: [clang]
SANITIZER: [ASAN, ASAN_INT, TSAN]
runs-on: ubuntu-22.04
outputs:
issue_reported: ${{ steps.show_report.outputs.issue_reported }}
env:
COMPILER: ${{ matrix.COMPILER }}
TEST_USE_ROCKSDB: ${{ matrix.TEST_USE_ROCKSDB }}
XSAN: ${{ endsWith(matrix.sanitizer, 'ASAN_INT') && 'ASAN' || matrix.SANITIZER }}
XSAN_SUPPRESSIONS: ${{ endsWith(matrix.SANITIZER, 'TSAN') && 'suppressions=../tsan_suppressions:' || '' }}
BACKEND: ${{ matrix.BACKEND }}
SANITIZER: ${{ matrix.SANITIZER }}
TEST_USE_ROCKSDB: ${{ matrix.BACKEND == 'rocksdb' && '1' || '0' }}
DEADLINE_SCALE_FACTOR: ${{ matrix.BACKEND == 'rocksdb' && '2' || '1' }}
ASAN_OPTIONS: log_exe_name=1:log_path=sanitizer_report
TSAN_OPTIONS: log_exe_name=1:log_path=sanitizer_report:suppressions=../tsan_suppressions
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
steps:
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 #v3.1.0
- name: Checkout
uses: actions/checkout@v3
with:
submodules: "true"
- name: Git Submodule Update
run: git submodule update --init --recursive
- name: XSan variable values
run: |
(
echo "XSAN: '${XSAN}'"
echo "XSAN_SUPPRESSIONS: '${XSAN_SUPPRESSIONS}'"
)
- name: Install Dependencies
run: ci/actions/linux/install_deps.sh
submodules: "recursive"

- name: Prepare
run: sudo -E ci/prepare/linux/prepare.sh

- name: Build Tests
id: build_tests
run: docker run -e TEST_USE_ROCKSDB -v ${PWD}:/workspace ghcr.io/${{ github.repository }}/nano-env:${{ matrix.COMPILER }} /bin/bash -c \
"cd /workspace && ${{ matrix.SANITIZER }}=1 ci/build-ci.sh /usr/lib/x86_64-linux-gnu/cmake/Qt5 'core_test rpc_test'"
- name: Run core_test
id: core_test
id: build
run: ci/build-tests.sh

- name: Core Tests
if: steps.build.outcome == 'success' && (success() || failure())
continue-on-error: true
run: docker run -v ${PWD}:/workspace ghcr.io/${{ github.repository }}/nano-env:${{ matrix.COMPILER }} /bin/bash -c \
"cd /workspace/build && ${XSAN}_OPTIONS=${XSAN_SUPPRESSIONS}log_exe_name=1:log_path=sanitizer_report ./core_test"
- name: Run rpc_test
id: rpc_test
run: timeout -sKILL 45m ../ci/tests/run-core-tests.sh
working-directory: build

- name: RPC Tests
if: steps.build.outcome == 'success' && (success() || failure())
continue-on-error: true
run: timeout -sKILL 20m ../ci/tests/run-rpc-tests.sh
working-directory: build

- name: Reports
if: steps.build.outcome == 'success' && (success() || failure())
continue-on-error: true
run: docker run -v ${PWD}:/workspace ghcr.io/${{ github.repository }}/nano-env:${{ matrix.COMPILER }} /bin/bash -c \
"cd /workspace/build && ${XSAN}_OPTIONS=${XSAN_SUPPRESSIONS}log_exe_name=1:log_path=sanitizer_report ./rpc_test"
- name: Test Reports
id: show_report
run: |
(
issue_reported=false
reports=$(ls build/sanitizer_report*)
if [[ -n "${reports}" ]]; then
echo "Report Output:"
for report in ${reports}; do
echo "File: $report"
docker run -v ${PWD}:/workspace ghcr.io/${{ github.repository }}/nano-env:${{ matrix.COMPILER }} /bin/bash -c "cat /workspace/${report}"
echo
done
issue_reported=true
else
echo "No report has been generated."
fi
echo "issue_reported=${issue_reported}" >> $GITHUB_OUTPUT
) || exit 0
run: ../ci/tests/show-sanitizer-reports.sh
working-directory: build
30 changes: 20 additions & 10 deletions .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,18 @@ jobs:

- name: Core Tests
if: steps.build.outcome == 'success' && (success() || failure())
run: cd build && ../ci/tests/run-core-tests.sh
run: ../ci/tests/run-core-tests.sh
working-directory: build

- name: RPC Tests
if: steps.build.outcome == 'success' && (success() || failure())
run: cd build && ../ci/tests/run-rpc-tests.sh
run: ../ci/tests/run-rpc-tests.sh
working-directory: build

- name: System Tests
if: steps.build.outcome == 'success' && (success() || failure())
run: cd build && ../ci/tests/run-system-tests.sh
run: ../ci/tests/run-system-tests.sh
working-directory: build

linux_test:
name: Linux [${{ matrix.BACKEND }} | ${{ matrix.COMPILER }}]
Expand Down Expand Up @@ -118,19 +121,23 @@ jobs:

- name: Core Tests
if: steps.build.outcome == 'success' && (success() || failure())
run: cd build && ../ci/tests/run-core-tests.sh
run: ../ci/tests/run-core-tests.sh
working-directory: build

- name: RPC Tests
if: steps.build.outcome == 'success' && (success() || failure())
run: cd build && ../ci/tests/run-rpc-tests.sh
run: ../ci/tests/run-rpc-tests.sh
working-directory: build

- name: System Tests
if: steps.build.outcome == 'success' && (success() || failure())
run: cd build && ../ci/tests/run-system-tests.sh
run: ../ci/tests/run-system-tests.sh
working-directory: build

- name: QT Tests
if: steps.build.outcome == 'success' && (success() || failure())
run: cd build && ../ci/tests/run-qt-tests.sh
run: ../ci/tests/run-qt-tests.sh
working-directory: build

windows_test:
name: Windows [${{ matrix.BACKEND }}]
Expand Down Expand Up @@ -185,15 +192,18 @@ jobs:

- name: Core Tests
if: steps.build.outcome == 'success' && (success() || failure())
run: cd build && ../ci/tests/run-core-tests.sh
run: ../ci/tests/run-core-tests.sh
working-directory: build
shell: bash

- name: RPC Tests
if: steps.build.outcome == 'success' && (success() || failure())
run: cd build && ../ci/tests/run-rpc-tests.sh
run: ../ci/tests/run-rpc-tests.sh
working-directory: build
shell: bash

- name: System Tests
if: steps.build.outcome == 'success' && (success() || failure())
run: cd build && ../ci/tests/run-system-tests.sh
run: ../ci/tests/run-system-tests.sh
working-directory: build
shell: bash
33 changes: 33 additions & 0 deletions ci/tests/show-sanitizer-reports.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/bash
set -uo pipefail

issue_reported=false

# Check for sanitizer reports using glob
shopt -s nullglob
reports=(./sanitizer_report*)

if [[ ${#reports[@]} -gt 0 ]]; then
for report in "${reports[@]}"; do
report_name=$(basename "${report}")
echo "::group::Report: $report_name"

cat "${report}"

echo "::endgroup::"

issue_reported=true
done
else
echo "::notice::No report has been generated."
fi

echo "issue_reported=${issue_reported}" >> $GITHUB_OUTPUT

if $issue_reported; then
echo "::error::Issues were reported in the sanitizer report."
exit 1
else
echo "::notice::No issues found in the sanitizer reports."
exit 0
fi
Loading