Skip to content

Commit

Permalink
Refs #20542: Add Fast DDS Sanitizer worflow with support for asan fas…
Browse files Browse the repository at this point in the history
…tdds

Signed-off-by: eduponz <[email protected]>
  • Loading branch information
EduPonz committed Apr 5, 2024
1 parent e98cf7f commit 9f9cbe9
Show file tree
Hide file tree
Showing 2 changed files with 193 additions and 2 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/config/asan_colcon.meta
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
names:
fastrtps:
cmake-args:
- "-DCMAKE_BUILD_TYPE=Debug"
- "-DEPROSIMA_BUILD_TESTS=ON"
- "-DRTPS_API_TESTS=ON"
- "-DFASTRTPS_API_TESTS=ON"
Expand All @@ -14,7 +13,6 @@ names:
- "-DCMAKE_CXX_FLAGS='-Werror'"
discovery-server:
cmake-args:
- "-DCMAKE_BUILD_TYPE=Debug"
- "-DSANITIZER=Address"
googletest-distribution:
cmake-args:
Expand Down
193 changes: 193 additions & 0 deletions .github/workflows/sanitizers-ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,193 @@
name: Fast DDS Sanitizers Analysis

on:
workflow_dispatch:
inputs:
label:
description: 'ID associated to the workflow'
required: true
type: string
run_asan_fastdds:
description: 'Run Addess Sanitizer job for Fast DDS'
required: false
type: boolean
colcon_meta:
description: 'Optional Path of the colcon meta file'
required: false
type: string
colcon_build_args:
description: 'Optional colcon build arguments'
required: false
type: string
colcon_test_args:
description: 'Optional colcon test arguments'
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
fastdds_ref:
description: 'Branch or tag of Fast DDS repository (https://github.com/eProsima/Fast-DDS)'
required: true

pull_request:
types:
- review_requested
paths-ignore:
- '**.md'
- '**.txt'
- '!**/CMakeLists.txt'

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

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

env:
label: ${{ inputs.label || 'fastdds-sanitizers-ci' }}
build_asan_fastdds: ${{
inputs.run_asan_fastdds ||
github.event_name == 'schedule' ||
github.event_name == 'pull_request' }}
run_asan_fastdds: ${{ inputs.run_asan_fastdds ||
github.event_name == 'schedule' ||
github.event_name == 'pull_request' }}
colcon_meta: ${{ inputs.colcon_meta || '' }}
colcon_build_args: ${{ inputs.colcon_build_args || '' }}
colcon_test_args: ${{ inputs.colcon_test_args || '' }}
cmake_args: ${{ inputs.cmake_args || '' }}
ctest_args: ${{ inputs.ctest_args || '' }}
fastdds_ref: ${{ inputs.fastdds_ref || github.ref || 'master' }}

jobs:
asan_fastdds:
if: ${{ (
!contains(github.event.pull_request.labels.*.name, 'skip-ci') &&
!contains(github.event.pull_request.labels.*.name, 'no-test') &&
!contains(github.event.pull_request.labels.*.name, 'conflicts') &&
(
(inputs.run_asan_fastdds == '') ||
contains(fromJSON('["schedule", "pull_request"]'), github.event_name)
)
) }}

runs-on: ubuntu-22.04

steps:
- name: Print environment variables
run: |
echo "label: ${{ env.label }}"
echo "build_asan_fastdds: ${{ env.build_asan_fastdds }}"
echo "build_asan_fastdds: ${{ github.env.build_asan_fastdds }}"
echo "run_asan_fastdds: ${{ env.run_asan_fastdds }}"
echo "colcon_meta: ${{ env.colcon_meta }}"
echo "colcon_build_args: ${{ env.colcon_build_args }}"
echo "colcon_test_args: ${{ env.colcon_test_args }}"
echo "cmake_args: ${{ env.cmake_args }}"
echo "ctest_args: ${{ env.ctest_args }}"
echo "fastdds_ref: ${{ env.fastdds_ref }}"
- name: Add ci-pending label if PR
if: ${{ github.event_name == 'pull_request' }}
uses: eProsima/eProsima-CI/external/add_labels@v0
with:
labels: ci-pending
number: ${{ github.event.number }}
repo: eProsima/Fast-DDS

# https://github.com/actions/runner-images/issues/9491
- name: Fix kernel mmap rnd bits
run: sudo sysctl vm.mmap_rnd_bits=28

- name: Sync eProsima/Fast-DDS repository
uses: eProsima/eProsima-CI/external/checkout@v0
with:
path: src/fastrtps
ref: ${{ env.fastdds_ref }}

- name: Get minimum supported version of CMake
uses: eProsima/eProsima-CI/external/get-cmake@v0
with:
cmakeVersion: '3.22.6'

- 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 xmlschema

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

- name: Fetch Fast DDS dependencies
uses: eProsima/eProsima-CI/multiplatform/vcs_import@v0
with:
vcs_repos_file: ${{ github.workspace }}/src/fastrtps/fastrtps.repos
destination_workspace: src
skip_existing: 'true'

- name: Fetch Fast DDS CI dependencies
uses: eProsima/eProsima-CI/multiplatform/vcs_import@v0
with:
vcs_repos_file: ${{ github.workspace }}/src/fastrtps/.github/workflows/config/asan.repos
destination_workspace: src
skip_existing: 'true'

- name: Select .meta file
id: select_meta
if: ${{ env.colcon_meta == '' }}
run: |
echo "colcon_meta=${{ github.workspace }}/src/fastrtps/.github/workflows/config/asan_colcon.meta"
- name: Colcon build
continue-on-error: false
uses: eProsima/eProsima-CI/multiplatform/colcon_build@v0
with:
colcon_meta_file: ${{ env.colcon_meta }}
colcon_build_args: ${{ env.colcon_build_args }}
cmake_args: ${{ env.cmake_args }}
cmake_args_default: ''
cmake_build_type: 'Debug'
workspace: ${{ github.workspace }}
workspace_dependencies: ''

- name: Colcon test
if: ${{ env.run_asan_fastdds }}
id: test
uses: eProsima/eProsima-CI/multiplatform/colcon_test@v0
with:
colcon_test_args: ${{ env.colcon_test_args }}
colcon_test_args_default: '--event-handlers=console_direct+ --return-code-on-test-failure'
ctest_args: ${{ env.ctest_args }}
ctest_args_default: '--timeout 300 --label-exclude "xfail"'
packages_names: fastrtps
workspace: ${{ github.workspace }}
workspace_dependencies: ''
test_report_artifact: ${{ format('test_report_{0}_{1}', env.label, github.job) }}

- name: Report sanitizer errors
if: ${{ env.run_asan_fastdds }}
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

0 comments on commit 9f9cbe9

Please sign in to comment.