Skip to content

Latest commit

 

History

History
78 lines (55 loc) · 3.81 KB

README.md

File metadata and controls

78 lines (55 loc) · 3.81 KB

sanitizer_workflows

Memory Threading

Github workflows adding sanitizer checks to your repository.

Workflows to instrument your testing suite with various sanitizer checks. This means that your tests will not only check your predefined conditions, but also verify that no violations of thread safety, memory operations or well-defined behavior occured at runtime.

Sanitizers are part of the clang and gcc compilers. Usage of specific workflows is described below.

AddressSanitizer is a fast memory error detector. It consists of a compiler instrumentation module and a run-time library. The tool can detect the following types of bugs:

  • Out-of-bounds accesses to heap, stack and globals
  • Use-after-free
  • Use-after-return
  • Use-after-scope
  • Double-free, invalid free
  • Memory leaks

To use the address sanitizer workflow, add a .github/workflows/asan.yml file to your repository with the following contents:

name: Memory

on:
  push:
    branches: [ "main" ]
  pull_request:
    branches: [ "main" ]

jobs:
  address_sanitizer:
    uses: picanumber/sanitizer_workflows/.github/workflows/asan.yml@main
    with:
      testDir: 'tests'             # Optional, default value is 'tests'
      compiler_package: 'clang-11' # Optional compiler package to install, default value is 'g++-11'
      compiler_name: 'clang++-11'  # Optional compiler executable to use, default value is 'g++-11'

Of course you are free to specify a different name and workflow trigger. Using the workflow under a matrix strategy means you can perform your checks against multiple compilers.

Here is an example address sanitizer failure and the change that triggered it.

ThreadSanitizer is a tool that detects data races. It consists of a compiler instrumentation module and a run-time library.

To use the thread sanitizer workflow, add a .github/workflows/tsan.yml file to your repository with the following contents:

name: Threading

on:
  push:
    branches: [ "main" ]
  pull_request:
    branches: [ "main" ]

jobs:
  thread_sanitizer:
    uses: picanumber/sanitizer_workflows/.github/workflows/tsan.yml@main  
    with:
      testDir: 'tests' # Optional, default value is 'tests'
      compiler_package: 'clang-11' # Optional compiler package to install, default value is 'g++-11'
      compiler_name: 'clang++-11'  # Optional compiler executable to use, default value is 'g++-11'      

Of course you are free to specify a different name and workflow trigger. Using the workflow under a matrix strategy means you can perform your checks against multiple compilers.

Here is an example thread sanitizer failure and the change that triggered it.

Examples and documentation

  • The yapp library uses these workflows, since it heavily depends on multi-threading integrity.
  • You can read an introductory post on the scope of this project here.