Skip to content

Commit

Permalink
Refs #20542: Refactor sanitizers
Browse files Browse the repository at this point in the history
Signed-off-by: JesusPoderoso <jesuspoderoso@eprosima.com>
  • Loading branch information
JesusPoderoso committed Mar 14, 2024
1 parent c219bc7 commit 8ccfaec
Show file tree
Hide file tree
Showing 4 changed files with 330 additions and 327 deletions.
206 changes: 36 additions & 170 deletions .github/workflows/address-sanitizers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,22 @@ name: Address Sanitizer analysis
on:
workflow_dispatch:
inputs:
label:
description: 'ID associated to the workflow'
required: true
type: string
colcon_meta:
description: 'Optional Path of the colcon meta file'
required: false
type: string
cmake_args:
description: 'Optional CMake Compilation Flags'
required: false
type: string
ctest_args:
description: 'Optional CTest Testing Flags'
required: false
type: string
discovery_server_branch:
description: 'Branch or tag of Discovery Server repository (https://github.com/eProsima/Discovery-Server)'
required: true
Expand All @@ -19,185 +35,35 @@ on:
- '**.md'
- '**.txt'
- '!**/CMakeLists.txt'

schedule:
- cron: '0 1 * * *'

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
asan-test:

address-sanitizer:
uses: ./.github/workflows/reusable-sanitizer.yml
if: ${{ !(contains(github.event.pull_request.labels.*.name, 'no-test') ||
contains(github.event.pull_request.labels.*.name, 'skip-ci') ||
contains(github.event.pull_request.labels.*.name, 'conflicts')) }}

runs-on: ubuntu-22.04

env:
FASTDDS_BRANCH: ${{ github.head_ref || github.event.inputs.fastdds_branch || 'master' }}

steps:
- name: Install apt packages
uses: eProsima/eProsima-CI/ubuntu/install_apt_packages@v0
with:
packages: curl grep libasio-dev libtinyxml2-dev python3 python3-pip software-properties-common wget

- name: Setup CCache
uses: eProsima/eProsima-CI/external/setup-ccache-action@v0

- name: Install colcon
uses: eProsima/eProsima-CI/ubuntu/install_colcon@v0

- name: Install Python dependencies
uses: eProsima/eProsima-CI/ubuntu/install_python_packages@v0
with:
packages: vcstool setuptools gcovr tomark xmltodict jsondiff pandas

- name: Get fastrtps.repos file
uses: eProsima/eProsima-CI/ubuntu/get_file_from_repo@v0
with:
source_repository: eProsima/Fast-DDS
source_repository_branch: ${{ env.FASTDDS_BRANCH }}
file_name: fastrtps.repos
file_result: fastrtps.repos

- name: Fetch Fast DDS & dependencies
uses: eProsima/eProsima-CI/ubuntu/vcs_import@v0
with:
vcs_repos_file: fastrtps.repos
destination_workspace: src

- name: Checkout Fast DDS branch
run: |
cd ./src/fastrtps
git checkout ${{ env.FASTDDS_BRANCH }}
- name: Install GTest
uses: eProsima/eProsima-CI/ubuntu/install_gtest@v0
with:
version: v1.12.1

- name: Build workspace
run: |
cat src/fastrtps/.github/workflows/config/asan_colcon.meta
colcon build \
--event-handlers=console_direct+ \
--metas src/fastrtps/.github/workflows/config/asan_colcon.meta
- name: Run tests Fast DDS
run: |
source install/setup.bash && \
colcon test \
--packages-select fastrtps \
--event-handlers=console_direct+ \
--return-code-on-test-failure \
--ctest-args \
--label-exclude xfail \
--timeout 300
continue-on-error: true

- name: Upload Logs
uses: actions/upload-artifact@v1
with:
name: asan-logs
path: log/
if: always()

- name: Report ASAN errors
if: always()
run: |
bash src/fastrtps/.github/workflows/utils/specific_errors_filter.sh "==ERROR:" log/latest_test/fastrtps/stdout_stderr.log _tmp_specific_error_file.log
python3 src/fastrtps/.github/workflows/utils/log_parser.py --log-file log/latest_test/fastrtps/stdout_stderr.log --specific-error-file _tmp_specific_error_file.log --output-file $GITHUB_STEP_SUMMARY --sanitizer asan
asan-discovery-server-test:

with:
label: ${{ inputs.label || 'address-sanitizer' }}
colcon_meta: ${{ inputs.colcon_meta || 'src/fastrtps/.github/workflows/config/asan_colcon.meta' }}
cmake_args: ${{ inputs.cmake_args || '' }}
ctest_args: ${{ inputs.ctest_args || '--label-exclude xfail --timeout 300' }}
fastdds_branch: ${{ github.head_ref || inputs.fastdds_branch || 'master' }}
asan_report: 'true'

discovery-server-address-sanitizer:
uses: ./.github/workflows/reusable-sanitizer.yml
if: ${{ !(contains(github.event.pull_request.labels.*.name, 'no-test') ||
contains(github.event.pull_request.labels.*.name, 'skip-ci') ||
contains(github.event.pull_request.labels.*.name, 'conflicts')) }}

runs-on: ubuntu-22.04

env:
FASTDDS_BRANCH: ${{ github.head_ref || github.event.inputs.fastdds_branch || 'master' }}
DEFAULT_DISCOVERY_SERVER_BRANCH: ${{ github.event.inputs.discovery_server_branch || 'master' }}

steps:
- name: Install apt packages
uses: eProsima/eProsima-CI/ubuntu/install_apt_packages@v0
with:
packages: curl grep libasio-dev libtinyxml2-dev python3 python3-pip software-properties-common wget

- name: Install colcon
uses: eProsima/eProsima-CI/ubuntu/install_colcon@v0

- name: Install Python dependencies
uses: eProsima/eProsima-CI/ubuntu/install_python_packages@v0
with:
packages: vcstool setuptools gcovr tomark xmltodict jsondiff pandas

- name: Get fastrtps.repos file
uses: eProsima/eProsima-CI/ubuntu/get_file_from_repo@v0
with:
source_repository: eProsima/Fast-DDS
source_repository_branch: ${{ env.FASTDDS_BRANCH }}
file_name: fastrtps.repos
file_result: fastrtps.repos

- name: Fetch Fast DDS & dependencies
uses: eProsima/eProsima-CI/ubuntu/vcs_import@v0
with:
vcs_repos_file: fastrtps.repos
destination_workspace: src

- name: Checkout Fast DDS branch
run: |
cd ./src/fastrtps
git checkout ${{ env.FASTDDS_BRANCH }}
- name: Sync eProsima/Discovery-Server repository
uses: actions/checkout@v4
with:
path: src/discovery_server
repository: eProsima/Discovery-Server
ref: ${{ env.DEFAULT_DISCOVERY_SERVER_BRANCH }}

- name: Install GTest
uses: eProsima/eProsima-CI/ubuntu/install_gtest@v0
with:
version: v1.12.1

- name: Build workspace
run: |
cat src/fastrtps/.github/workflows/config/asan_colcon.meta
colcon build \
--event-handlers=console_direct+ \
--metas src/fastrtps/.github/workflows/config/asan_colcon.meta
- name: Run tests Fast DDS
run: |
source install/setup.bash && \
colcon test \
--packages-select discovery-server \
--event-handlers=console_direct+ \
--return-code-on-test-failure \
--ctest-args \
--label-exclude xfail \
--timeout 300
continue-on-error: true

- name: Upload Logs
uses: actions/upload-artifact@v1
with:
name: asan-ds-logs
path: log/
if: always()

- name: Report ASAN errors
if: always()
run: |
bash src/fastrtps/.github/workflows/utils/specific_errors_filter.sh "==ERROR:" log/latest_test/discovery-server/stdout_stderr.log _tmp_specific_error_file.log
python3 src/fastrtps/.github/workflows/utils/log_parser.py --log-file log/latest_test/discovery-server/stdout_stderr.log --specific-error-file _tmp_specific_error_file.log --output-file $GITHUB_STEP_SUMMARY --sanitizer=asan
with:
label: ${{ inputs.label || 'discovery-server-address-sanitizer' }}
colcon_meta: ${{ inputs.colcon_meta || 'src/fastrtps/.github/workflows/config/asan_colcon.meta' }}
cmake_args: ${{ inputs.cmake_args || '' }}
ctest_args: ${{ inputs.ctest_args || '--label-exclude xfail --timeout 300' }}
fastdds_branch: ${{ github.head_ref || inputs.fastdds_branch || 'master' }}
discovery_server_branch: ${{ inputs.discovery_server_branch || 'master' }}
asan_discovery_server_report: 'true'
62 changes: 62 additions & 0 deletions .github/workflows/nightly-sanitizer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Sanitizer analysis (nightly)

on:
workflow_dispatch:
schedule:
- cron: '0 1 * * *'

jobs:
nightly-address-sanitizer:
strategy:
matrix:
fastdds-branch:
- 'master'
- '2.13.x'
- '2.12.x'
- '2.10.x'
- '2.6.x'
uses: ./.github/workflows/reusable-sanitizer.yml
with:
label: 'nightly-address-sanitizer-${{ matrix.fastdds-branch }}'
colcon_meta: 'src/fastrtps/.github/workflows/config/asan_colcon.meta'
cmake_args: ''
ctest_args: '--label-exclude xfail --timeout 300'
fastdds_branch: '${{ matrix.fastdds-branch }}'
asan_report: 'true'

nightly-discovery-server-address-sanitizer:
strategy:
matrix:
fastdds-branch:
- 'master'
- '2.13.x'
- '2.12.x'
- '2.10.x'
- '2.6.x'
uses: ./.github/workflows/reusable-sanitizer.yml
with:
label: 'nightly-discovery-server-address-sanitizer-${{ matrix.fastdds-branch }}'
colcon_meta: 'src/fastrtps/.github/workflows/config/asan_colcon.meta'
cmake_args: ''
ctest_args: '--label-exclude xfail --timeout 300'
fastdds_branch: '${{ matrix.fastdds-branch }}'
asan_discovery_server_report: 'true'

nightly-thread-sanitizer:
strategy:
matrix:
fastdds-branch:
- 'master'
- '2.13.x'
- '2.12.x'
- '2.10.x'
- '2.6.x'
uses: ./.github/workflows/reusable-sanitizer.yml
with:
label: 'nightly-thread-sanitizer-${{ matrix.fastdds-branch }}'
colcon_meta: 'src/fastrtps/.github/workflows/config/tsan_colcon.meta'
cmake_args: '-DCMAKE_BUILD_TYPE=Debug'
ctest_args: '-timeout 30 -V -E DDSSQLFilterValueTests'
fastdds_branch: '${{ matrix.fastdds-branch }}'
tsan_report: 'true'

Loading

0 comments on commit 8ccfaec

Please sign in to comment.