From f0b48167247103ce286d6dc78c566d4e217614a1 Mon Sep 17 00:00:00 2001 From: JesusPoderoso Date: Wed, 6 Mar 2024 19:38:57 +0100 Subject: [PATCH] Refs #20542: Refactor sanitizers Signed-off-by: JesusPoderoso --- .github/workflows/address-sanitizers.yaml | 247 ++++------------------ .github/workflows/nightly-sanitizer.yml | 65 ++++++ .github/workflows/reusable-sanitizer.yml | 228 ++++++++++++++++++++ .github/workflows/thread-sanitizer.yaml | 199 ++--------------- 4 files changed, 352 insertions(+), 387 deletions(-) create mode 100644 .github/workflows/nightly-sanitizer.yml create mode 100644 .github/workflows/reusable-sanitizer.yml diff --git a/.github/workflows/address-sanitizers.yaml b/.github/workflows/address-sanitizers.yaml index a4b311318fd..eacaf568c8f 100644 --- a/.github/workflows/address-sanitizers.yaml +++ b/.github/workflows/address-sanitizers.yaml @@ -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 @@ -20,229 +36,38 @@ on: - '**.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, 'skip-ci') && !contains(github.event.pull_request.labels.*.name, 'no-test') && !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: 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: 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: Get minimum supported version of CMake - uses: eProsima/eProsima-CI/external/get-cmake@v0 - with: - cmakeVersion: '3.22.6' - - - 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: Fetch Fast DDS ASan 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: 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, 'skip-ci') && !contains(github.event.pull_request.labels.*.name, 'no-test') && !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: 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: 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: Get minimum supported version of CMake - uses: eProsima/eProsima-CI/external/get-cmake@v0 - with: - cmakeVersion: '3.22.6' - - - 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: 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: Fetch Fast DDS ASan 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: 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' diff --git a/.github/workflows/nightly-sanitizer.yml b/.github/workflows/nightly-sanitizer.yml new file mode 100644 index 00000000000..fe261fd4647 --- /dev/null +++ b/.github/workflows/nightly-sanitizer.yml @@ -0,0 +1,65 @@ +name: Sanitizer analysis (nightly) + +on: + workflow_dispatch: + schedule: + - cron: '0 1 * * *' + +jobs: + nightly-address-sanitizer: + strategy: + fail-fast: false + 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: + fail-fast: false + 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: + fail-fast: false + 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' + diff --git a/.github/workflows/reusable-sanitizer.yml b/.github/workflows/reusable-sanitizer.yml new file mode 100644 index 00000000000..2cba82e21fc --- /dev/null +++ b/.github/workflows/reusable-sanitizer.yml @@ -0,0 +1,228 @@ +name: Sanitizer analysis reusable workflow + +on: + workflow_call: + inputs: + label: + description: 'ID associated to the workflow' + required: true + type: string + colcon_meta: + description: 'Path of the colcon meta file' + required: false + type: string + cmake_args: + description: 'CMake Compilation Flags' + required: false + type: string + ctest_args: + description: 'CTest Testing Flags' + required: false + type: string + fastdds_branch: + description: 'Branch or tag of Fast DDS repository (https://github.com/eProsima/Fast-DDS)' + required: true + type: string + default: 'master' + discovery_server_branch: + description: 'Branch or tag of Discovery Server repository (https://github.com/eProsima/Discovery-Server)' + required: false + type: string + default: 'master' + asan_report: + description: 'Run the address sanitizer report job step(s)' + required: false + default: 'false' + type: string + asan_discovery_server_report: + description: 'Run the address discovery server sanitizer report job step(s)' + required: false + default: 'false' + type: string + tsan_report: + description: 'Run the thread sanitizer report job step(s)' + required: false + default: 'false' + type: string + +defaults: + run: + shell: bash + +jobs: + + reusable-sanitizer-run: + runs-on: ubuntu-22.04 + + 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: ${{ inputs.fastdds_branch }} + + - 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 GTest + uses: eProsima/eProsima-CI/ubuntu/install_gtest@v0 + with: + version: release-1.11.0 + + - 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: Download Fast DDS .repos + uses: eProsima/eProsima-CI/ubuntu/vcs_import@v0 + with: + vcs_repos_file: ./src/fastrtps/fastrtps.repos + destination_workspace: src + skip_existing: 'true' + + - name: Sync eProsima/Discovery-Server repository + if : ${{ inputs.asan_discovery_server_report == 'true' }} + uses: actions/checkout@v4 + with: + path: src/discovery_server + repository: eProsima/Discovery-Server + ref: ${{ inputs.discovery_server_branch }} + + - name: Colcon build + continue-on-error: false + uses: eProsima/eProsima-CI/multiplatform/colcon_build@v0 + with: + colcon_meta_file: '${{ inputs.colcon_meta }}' + colcon_build_args: '' + colcon_build_args_default: '' + cmake_args: '${{ inputs.cmake_args }}' + cmake_args_default: '' + cmake_build_type: Release + workspace: ${{ github.workspace }} + workspace_dependencies: '' + + - name: Colcon test + id: test + uses: eProsima/eProsima-CI/multiplatform/colcon_test@v0 + with: + colcon_test_args: '' + colcon_test_args_default: '--event-handlers=console_direct+ --return-code-on-test-failure' + ctest_args: '${{ inputs.ctest_args }}' + ctest_args_default: '' + packages_names: fastrtps + workspace: ${{ github.workspace }} + workspace_dependencies: '' + test_report_artifact: ${{ format('test_report_{0}', github.job, join(matrix.*, '_')) }} + + - name: Upload Logs + uses: actions/upload-artifact@v3 + with: + name: ${{ inputs.label }}-logs + path: log/ + if: always() + + - name: Report sanitizer errors + if: ${{ inputs.asan_report == 'true' }} + 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 + + - name: Report discovery server sanitizer errors + if: ${{ inputs.asan_discovery_server_report == 'true' }} + 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 + + - name: Process sanitizer reports + if: ${{ inputs.tsan_report == 'true' }} + id: report_summary + shell: pwsh + continue-on-error: true + run: | + # Create a dir for the exportsTSAN_OPTIONSDirectory -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: Archive sanitation results + if: ${{ inputs.tsan_report == 'true' }} + uses: actions/upload-artifact@v3 + with: + name: ${{ inputs.label }}-sanitation-report + path: exports/* + + - name: Check on failures + if: ${{ steps.report_summary.outcome == 'failure' && inputs.tsan_report == 'true'}} + shell: pwsh + run: | + Write-Host ${{ steps.report_summary.outcome }} + exit 1 diff --git a/.github/workflows/thread-sanitizer.yaml b/.github/workflows/thread-sanitizer.yaml index b64852f73b8..7b1b331c470 100644 --- a/.github/workflows/thread-sanitizer.yaml +++ b/.github/workflows/thread-sanitizer.yaml @@ -1,19 +1,28 @@ name: Thread Sanitizer analysis + on: workflow_dispatch: inputs: - fastdds_branch: - description: 'Branch or tag of Fast DDS repository (https://github.com/eProsima/Fast-DDS)' + label: + description: 'ID associated to the workflow' required: true - default: 'master' - optional_cmake_args: + 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 - optional_ctest_args: + ctest_args: description: 'Optional CTest Testing Flags' required: false type: string + fastdds_branch: + description: 'Branch or tag of Fast DDS repository (https://github.com/eProsima/Fast-DDS)' + type: string + required: true pull_request: types: @@ -23,184 +32,22 @@ on: - '**.txt' - '!**/CMakeLists.txt' - schedule: - - cron: '0 1 * * *' - concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: true jobs: - - ubuntu-sanitizer-run: - name: Sanitizer Evaluation - + thread-sanitizer: + uses: ./.github/workflows/reusable-sanitizer.yml 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') ) }} - - runs-on: ubuntu-22.04 - - env: - FASTDDS_BRANCH: ${{ github.head_ref || github.event.inputs.fastdds_branch || 'master' }} - 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: 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: Get minimum supported version of CMake - uses: eProsima/eProsima-CI/external/get-cmake@v0 - with: - cmakeVersion: '3.22.6' - - - 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: 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: Build workspace - run: | - cat src/fastrtps/.github/workflows/config/tsan_colcon.meta - colcon build \ - --event-handlers=console_direct+ \ - --metas src/fastrtps/.github/workflows/config/tsan_colcon.meta \ - --cmake-args -DCMAKE_BUILD_TYPE=Debug ${{ inputs.optional_cmake_args }} - - - 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 \ - --timeout 30 \ - -V -E DDSSQLFilterValueTests ${{ inputs.optional_ctest_args }} - continue-on-error: true - - - name: Upload Logs - uses: actions/upload-artifact@v3 - with: - name: tsan-logs - path: log/ - if: always() - - - 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: Archive sanitation results - uses: actions/upload-artifact@v3 - with: - name: sanitation-report - path: exports/* - - - name: Check on failures - if: ${{ steps.report_summary.outcome == 'failure' }} - shell: pwsh - run: | - Write-Host ${{ steps.report_summary.outcome }} - exit 1 + with: + label: ${{ inputs.label || 'thread-sanitizer' }} + colcon_meta: ${{ inputs.colcon_meta || 'src/fastrtps/.github/workflows/config/tsan_colcon.meta' }} + cmake_args: ${{ inputs.cmake_args || '-DCMAKE_BUILD_TYPE=Debug' }} + ctest_args: ${{ inputs.ctest_args || '-timeout 30 -V -E DDSSQLFilterValueTests ' }} + fastdds_branch: ${{ github.head_ref || inputs.fastdds_branch || 'master' }} + tsan_report: 'true'