Skip to content
This repository has been archived by the owner on Oct 1, 2023. It is now read-only.

Add sanitizers #445

Closed
wants to merge 1 commit into from
Closed
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
45 changes: 45 additions & 0 deletions .github/workflows/sanitizers.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Sanitizers

on: [pull_request, push]

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

jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- name: asan
build-env: ""
build-options: "-Pasan"
- name: tsan
build-env: "TSAN_OPTIONS=second_deadlock_stack=1"
build-options: "-Ptsan"
- name: ubsan
build-env: ""
build-options: "-Pubsan"
name: "${{ matrix.name }}"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0

- uses: actions/setup-java@v1
with:
java-version: 11
architecture: x64

- name: Install Toolchain
run: ./gradlew installRoborioToolchain

- name: Run sanitizers on unit tests
run: ${{ matrix.build-env }} ./gradlew runSysidTestReleaseGoogleTestExe ${{ matrix.build-options }}
- name: Run sanitizers on analysis integration tests
run: ${{ matrix.build-env }} ./gradlew runAnalysisIntegrationTests -PwithIntegration ${{ matrix.build-options }}

- name: Run sanitizers on generation integration tests
run: ${{ matrix.build-env }} ./gradlew runGenerationIntegrationTests -PwithIntegration ${{ matrix.build-options }}
24 changes: 24 additions & 0 deletions sysid-application/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -213,5 +213,29 @@ model {
}
}

if (project.hasProperty("asan")) {
nativeUtils.platformConfigs.named("linuxx86-64").configure {
it.cppCompiler.args.add('-g3')
it.cppCompiler.args.add('-fsanitize=address')
it.linker.args.add('-fsanitize=address')
}
}

if (project.hasProperty("tsan")) {
nativeUtils.platformConfigs.named("linuxx86-64").configure {
it.cppCompiler.args.add('-g3')
it.cppCompiler.args.add('-fsanitize=thread')
it.linker.args.add('-fsanitize=thread')
}
}

if (project.hasProperty("ubsan")) {
nativeUtils.platformConfigs.named("linuxx86-64").configure {
it.cppCompiler.args.add('-g3')
it.cppCompiler.args.add('-fsanitize=undefined')
it.linker.args.add('-fsanitize=undefined')
}
}

// Configure publishing.
apply from: "config/publish.gradle"