Skip to content

Commit

Permalink
Refs #20542: Add tsan_fastdds_test job
Browse files Browse the repository at this point in the history
Signed-off-by: eduponz <eduardoponz@eprosima.com>
  • Loading branch information
EduPonz committed Apr 6, 2024
1 parent 91c2cf3 commit 78b0e40
Showing 1 changed file with 174 additions and 0 deletions.
174 changes: 174 additions & 0 deletions .github/workflows/sanitizers-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ on:
description: 'Run Addess Sanitizer job for Discovery Server'
required: false
type: boolean
run_tsan_fastdds:
description: 'Run Thread Sanitizer job for Fast DDS'
required: false
type: boolean
colcon_meta:
description: 'Optional Path of the colcon meta file'
required: false
Expand Down Expand Up @@ -69,7 +73,11 @@ env:
run_asan_discovery_server: ${{ inputs.run_asan_discovery_server ||
github.event_name == 'schedule' ||
github.event_name == 'pull_request' }}
run_tsan_fastdds: ${{ inputs.run_tsan_fastdds ||
github.event_name == 'schedule' ||
github.event_name == 'pull_request' }}
asan_colcon_meta: ${{ inputs.colcon_meta || '' }}
tsan_colcon_meta: ${{ inputs.colcon_meta || '' }}
colcon_build_args: ${{ inputs.colcon_build_args || '' }}
colcon_test_args: ${{ inputs.colcon_test_args || '' }}
cmake_args: ${{ inputs.cmake_args || '' }}
Expand Down Expand Up @@ -356,3 +364,169 @@ jobs:
--specific-error-file _tmp_specific_error_file.log \
--output-file $GITHUB_STEP_SUMMARY \
--sanitizer=asan
tsan_fastdds_test:
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_tsan_fastdds == true) ||
contains(fromJSON('["schedule", "pull_request"]'), github.event_name)
)
) }}
runs-on: ubuntu-22.04
env:
TSAN_OPTIONS: second_deadlock_stack=1 history_size=7 memory_limit_mb=5000
# GCC 11.3 (Ubuntu Jammy default) produces several false positives regarding timed synchronization protocols
# These issues were fixed in GCC 12 so we upgrade to that version.
CC: gcc-12
CXX: g++-12
steps:
- 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 setuptools gcovr tomark xmltodict jsondiff pandas

- 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/ci.repos
destination_workspace: src
skip_existing: 'true'

- name: Select .meta file
id: select_meta
if: ${{ env.tsan_colcon_meta == '' }}
run: |
echo "tsan_colcon_meta=${{ github.workspace }}/src/fastrtps/.github/workflows/config/tsan_colcon.meta" >> $GITHUB_ENV
cat ${{ github.workspace }}/src/fastrtps/.github/workflows/config/tsan_colcon.meta
- name: Colcon build
continue-on-error: false
uses: eProsima/eProsima-CI/multiplatform/colcon_build@v0
with:
colcon_meta_file: ${{ env.tsan_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
continue-on-error: true
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" -V -E DDSSQLFilterValueTests'
packages_names: fastrtps
workspace: ${{ github.workspace }}
workspace_dependencies: ''
test_report_artifact: ${{ format('test_report_{0}_{1}', env.label, github.job) }}

- name: Process sanitizer reports
id: report_summary
shell: pwsh
continue-on-error: true
run: |
# Create a dir for the exports
$exports = New-Item -ItemType Directory -Path ./exports
# Move to the reports dir
pushd ./log/latest_test/fastrtps
# Install the report parser module
Find-Module -Repository PSGallery -Name SanReportParser | Install-Module -Scope CurrentUser -Force
# Parse the report files
$rp = Show-Tsan -Path ./stdout_stderr.log
# filter duplicates
$rp = $rp | group md5hash | % { $_.group[0] }
# Export raw data
$rp | Export-CliXML (Join-Path $exports all_reports.xml)
# Group the reports by issue
$g = $rp | group fuzzhash
# Split up deadlocks and race reports
$gd = $rp | ? type -match dead | group fuzzhash
$gr = $rp | ? type -match race | group fuzzhash
# Simplified deadlock summary (only one representative report and tests associated)
$sd = $gd | Sort-Object count -desc | select @{l="fuzzhash";e="name"}, count, `
@{l="échantillon";e={$_.group[0].report}}, @{l="tests"; `
e={$_.group.file | sls "(.*)\.\d+$" | % { $_.Matches.Groups[1].Value } | Sort-Object | get-unique}}
# Simplified race summary (only one representative report and tests associated)
$sr = $gr | Sort-Object count -desc | select @{l="fuzzhash";e="name"}, count, `
@{l="échantillon";e={$_.group[0].report}}, @{l="tests"; `
e={$_.group.file | sls "(.*)\.\d+$" | % { $_.Matches.Groups[1].Value } | Sort-Object | get-unique}}
# Export simplified summaries
$sd, $sr | Export-Clixml (Join-Path $exports summary_data.xml)
# Export CSV summary of frequencies
$sd | select fuzzhash, count | Export-CSV -Path (Join-Path $exports deadlocks.csv)
$sr | select fuzzhash, count | Export-CSV -Path (Join-Path $exports races.csv)
# Export test mappings
& {$sd; $sr} | Sort-Object { [int]$_.fuzzhash} | % { $fuzzy=$_.fuzzhash;$_.tests |
select @{l="fuzzhash";e={$fuzzy}}, @{l="test";e={$_}}} |
Export-Csv (Join-Path $exports issue_test_map.csv)
# Keep a file per issue
$dir = New-Item -ItemType Directory -Path (Join-Path $exports reports)
& {$sd; $sr} | % { $_.échantillon | Out-File (Join-Path $dir "$($_.fuzzhash).tsan") }
# Create a summary table
@{Type="Deadlock";Failed=$sd.count;Hashes=$sd.fuzzhash},
@{Type="Data race";Failed=$sr.count;Hashes=$sr.fuzzhash} |
% { $_.Summary = $_.Hashes | select -First 5 | Join-String -Separator ", "
if ($_.Hashes.count -gt 5 ) {
$_.Summary += ", ..." }; $_ } |
% { [PSCustomObject]$_} |
New-MDTable -Columns ([ordered]@{Failed=$null;Type=$null;Summary=$null}) |
Out-File $Env:GITHUB_STEP_SUMMARY
# The step fails on new deadlocks
$LASTEXITCODE=$sd.count
- name: Check on failures
if: ${{ steps.report_summary.outcome == 'failure' }}
shell: pwsh
run: |
Write-Host ${{ steps.report_summary.outcome }}
exit 1

0 comments on commit 78b0e40

Please sign in to comment.