-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding support for sanitised builds (#182)
* adding sanitiser flags and workflow file * adding files to diff against * cleaning up workflow file * run only on workflow dispatch * properly use caching * setting flag as default to false * cache the right folder * Fix ASAN_OPTIONS typo * Try using cachev2 instead of artifact for conan dependencies * Use a local conan cache folder when using the cli, just like in faasm * UBSan fix: Make sure created int pointer are 4-aligned * ASan,TSan: Latch destruction race-condition fix * ASan: MPI World test buffer too small * ASan: fix mismatched new[]-delete * ASan: out-of-bound read, this was a simple copy-paste error * ASan: Copy temporary strings in RapidJSON * fix #183: Use unique_ptr for all redis reply objects so they get cleaned up on exceptions and any scope exit * ASan/leak: use unique_ptr for pulled and dirtyMask to free the arrays automatically in the destructor * Change the BYTES macro to a template to catch potential type errors * Replace all other uses of new/delete with unique_ptr/vector. Also minor bugfix to the redis api, dequeueBytes did not return the actual number of bytes read - fixed that and the corresponding test. * Add a TSan ignore list * TSan: Fix data race in Scheduler testing code * Ignore zeromq races * TSan: fix shared_ptr data races (in a shared_ptr the counter is atomic, but ptr is not, and requires explicit atomic accesses) C++20 has a different api for this, but not yet supported by libstdc++ * Ignore config change data races, as they could only affect tests * TSan: Missing lock on scheduler reset * Ignore catch2 bad signal handler errors in tsan * TSan: Fix racy executor cleanup/deadlock * Missing locks in SnapshotClient mock code * MockMode needs to be atomic to work across threads without a mutex * Missing mutexes in FunctionCallClient mock code * More missing locks on reads in the scheduler * Missing locks on *ThisHostResources in Scheduler * Skip mpi::allGather as I don't know what this exactly does * Catch2 REQUIRE is not thread-safe, use assert * TSan snapshot fixes * Run TSan with maximum history size so it doesn't lose stack traces * Missing shared lock in KV State * Disable two tests that break in TSan builds * Stop gid generation from tripping TSan using relaxed atomics * Avoid racy destruction on FlagWaiter just like the Latch * Missing lock on a queue push * Fix formatting * Address review comments * Remove mode checking from python as it's already done by cmake * Fix gha cache key, add restore-keys to fall back on cache misses and try a different key * Another attempt at fixing checksum hashes, this time use bash instead of GHA builtins * Show full test and sanitiser logs, it halts on errors so still should be readable Co-authored-by: Jakub Szewczyk <git@kubasz.xyz>
- Loading branch information
1 parent
dba98f1
commit 27ffd58
Showing
43 changed files
with
755 additions
and
314 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,264 @@ | ||
name: Sanitiser Checks | ||
|
||
on: | ||
push: | ||
branches: [master] | ||
pull_request: | ||
branches: [master] | ||
types: [opened, synchronize, reopened, ready_for_review] | ||
|
||
jobs: | ||
conan-cache: | ||
if: github.event.pull_request.draft == false | ||
runs-on: ubuntu-latest | ||
env: | ||
HOST_TYPE: ci | ||
REDIS_QUEUE_HOST: redis | ||
REDIS_STATE_HOST: redis | ||
container: | ||
image: faasm/faabric:0.2.2 | ||
defaults: | ||
run: | ||
working-directory: /code/faabric | ||
services: | ||
redis: | ||
image: redis | ||
steps: | ||
# --- Code update --- | ||
- name: "Fetch ref" | ||
run: git fetch origin ${GITHUB_REF}:ci-branch | ||
- name: "Check out branch" | ||
run: git checkout --force ci-branch | ||
# --- Set-up --- | ||
- name: "Ping redis" | ||
run: redis-cli -h redis ping | ||
# --- Cache based on Conan version and ExternalProjects cmake source | ||
- name: Get Conan version | ||
id: get-conan-version | ||
run: | | ||
echo "::set-output name=conan-version::$(conan --version | tr -d '[:alpha:] ')" | ||
shell: bash | ||
- name: Hash ExternalProjects | ||
id: hash-external | ||
run: | | ||
echo "::set-output name=hash-external::$(sha256sum cmake/ExternalProjects.cmake | cut '-d ' -f 1)" | ||
shell: bash | ||
- uses: actions/cache@v2 | ||
with: | ||
path: '~/.conan' | ||
key: ${{ runner.os }}-${{ steps.get-conan-version.outputs.conan-version }}-${{ steps.hash-external.outputs.hash-external }} | ||
restore-keys: | | ||
${{ runner.os }}-${{ steps.get-conan-version.outputs.conan-version }}- | ||
${{ runner.os }}- | ||
# --- Build dependencies | ||
- name: "Build dependencies to be shared by all sanitiser runs" | ||
run: inv dev.cmake -b Debug | ||
|
||
address-sanitiser: | ||
if: github.event.pull_request.draft == false | ||
needs: [conan-cache] | ||
runs-on: ubuntu-latest | ||
env: | ||
HOST_TYPE: ci | ||
REDIS_QUEUE_HOST: redis | ||
REDIS_STATE_HOST: redis | ||
container: | ||
image: faasm/faabric:0.2.2 | ||
defaults: | ||
run: | ||
working-directory: /code/faabric | ||
services: | ||
redis: | ||
image: redis | ||
steps: | ||
# --- Code update --- | ||
- name: "Fetch ref" | ||
run: git fetch origin ${GITHUB_REF}:ci-branch | ||
- name: "Check out branch" | ||
run: git checkout --force ci-branch | ||
# --- Set-up --- | ||
- name: "Ping redis" | ||
run: redis-cli -h redis ping | ||
# --- Cache based on Conan version and ExternalProjects cmake source | ||
- name: Get Conan version | ||
id: get-conan-version | ||
run: | | ||
echo "::set-output name=conan-version::$(conan --version | tr -d '[:alpha:] ')" | ||
shell: bash | ||
- name: Hash ExternalProjects | ||
id: hash-external | ||
run: | | ||
echo "::set-output name=hash-external::$(sha256sum cmake/ExternalProjects.cmake | cut '-d ' -f 1)" | ||
shell: bash | ||
- uses: actions/cache@v2 | ||
with: | ||
path: '~/.conan' | ||
key: ${{ runner.os }}-${{ steps.get-conan-version.outputs.conan-version }}-${{ steps.hash-external.outputs.hash-external }} | ||
restore-keys: | | ||
${{ runner.os }}-${{ steps.get-conan-version.outputs.conan-version }}- | ||
${{ runner.os }}- | ||
# --- Build with thread sanitising | ||
- name: "Build tests with address sanitising" | ||
run: inv dev.sanitise Address --noclean | ||
- name: "Run tests with address sanitising on and print to stderr to file" | ||
run: ./bin/faabric_tests | ||
working-directory: /build/faabric/static | ||
env: | ||
ASAN_OPTIONS: "verbosity=1:halt_on_error=1" | ||
|
||
thread-sanitiser: | ||
if: github.event.pull_request.draft == false | ||
needs: [conan-cache] | ||
runs-on: ubuntu-latest | ||
env: | ||
HOST_TYPE: ci | ||
REDIS_QUEUE_HOST: redis | ||
REDIS_STATE_HOST: redis | ||
container: | ||
image: faasm/faabric:0.2.2 | ||
defaults: | ||
run: | ||
working-directory: /code/faabric | ||
services: | ||
redis: | ||
image: redis | ||
steps: | ||
# --- Code update --- | ||
- name: "Fetch ref" | ||
run: git fetch origin ${GITHUB_REF}:ci-branch | ||
- name: "Check out branch" | ||
run: git checkout --force ci-branch | ||
# --- Set-up --- | ||
- name: "Ping redis" | ||
run: redis-cli -h redis ping | ||
# --- Cache based on Conan version and ExternalProjects cmake source | ||
- name: Get Conan version | ||
id: get-conan-version | ||
run: | | ||
echo "::set-output name=conan-version::$(conan --version | tr -d '[:alpha:] ')" | ||
shell: bash | ||
- name: Hash ExternalProjects | ||
id: hash-external | ||
run: | | ||
echo "::set-output name=hash-external::$(sha256sum cmake/ExternalProjects.cmake | cut '-d ' -f 1)" | ||
shell: bash | ||
- uses: actions/cache@v2 | ||
with: | ||
path: '~/.conan' | ||
key: ${{ runner.os }}-${{ steps.get-conan-version.outputs.conan-version }}-${{ steps.hash-external.outputs.hash-external }} | ||
restore-keys: | | ||
${{ runner.os }}-${{ steps.get-conan-version.outputs.conan-version }}- | ||
${{ runner.os }}- | ||
# --- Build with thread sanitising | ||
- name: "Build tests with thread sanitising" | ||
run: inv dev.sanitise Thread --noclean | ||
# --- Tests --- | ||
- name: "Run tests with thread sanitising on and print stderr to file" | ||
run: ./bin/faabric_tests | ||
working-directory: /build/faabric/static | ||
env: | ||
TSAN_OPTIONS: "verbosity=1:halt_on_error=1:suppressions=/code/faabric/thread-sanitizer-ignorelist.txt:history_size=7" | ||
|
||
undefined-sanitiser: | ||
if: github.event.pull_request.draft == false | ||
needs: [conan-cache] | ||
runs-on: ubuntu-latest | ||
env: | ||
HOST_TYPE: ci | ||
REDIS_QUEUE_HOST: redis | ||
REDIS_STATE_HOST: redis | ||
container: | ||
image: faasm/faabric:0.2.2 | ||
defaults: | ||
run: | ||
working-directory: /code/faabric | ||
services: | ||
redis: | ||
image: redis | ||
steps: | ||
# --- Code update --- | ||
- name: "Fetch ref" | ||
run: git fetch origin ${GITHUB_REF}:ci-branch | ||
- name: "Check out branch" | ||
run: git checkout --force ci-branch | ||
# --- Set-up --- | ||
- name: "Ping redis" | ||
run: redis-cli -h redis ping | ||
# --- Cache based on Conan version and ExternalProjects cmake source | ||
- name: Get Conan version | ||
id: get-conan-version | ||
run: | | ||
echo "::set-output name=conan-version::$(conan --version | tr -d '[:alpha:] ')" | ||
shell: bash | ||
- name: Hash ExternalProjects | ||
id: hash-external | ||
run: | | ||
echo "::set-output name=hash-external::$(sha256sum cmake/ExternalProjects.cmake | cut '-d ' -f 1)" | ||
shell: bash | ||
- uses: actions/cache@v2 | ||
with: | ||
path: '~/.conan' | ||
key: ${{ runner.os }}-${{ steps.get-conan-version.outputs.conan-version }}-${{ steps.hash-external.outputs.hash-external }} | ||
restore-keys: | | ||
${{ runner.os }}-${{ steps.get-conan-version.outputs.conan-version }}- | ||
${{ runner.os }}- | ||
# --- Build with thread sanitising | ||
- name: "Build tests with undefined sanitising" | ||
run: inv dev.sanitise Undefined --noclean | ||
# --- Tests --- | ||
- name: "Run tests with undefined sanitising on and print stderr to file" | ||
run: ./bin/faabric_tests | ||
working-directory: /build/faabric/static | ||
env: | ||
UBSAN_OPTIONS: "print_stacktrace=1:halt_on_error=1" | ||
|
||
leak-sanitiser: | ||
if: github.event.pull_request.draft == false | ||
needs: [conan-cache] | ||
runs-on: ubuntu-latest | ||
env: | ||
HOST_TYPE: ci | ||
REDIS_QUEUE_HOST: redis | ||
REDIS_STATE_HOST: redis | ||
container: | ||
image: faasm/faabric:0.2.2 | ||
defaults: | ||
run: | ||
working-directory: /code/faabric | ||
services: | ||
redis: | ||
image: redis | ||
steps: | ||
# --- Code update --- | ||
- name: "Fetch ref" | ||
run: git fetch origin ${GITHUB_REF}:ci-branch | ||
- name: "Check out branch" | ||
run: git checkout --force ci-branch | ||
# --- Set-up --- | ||
- name: "Ping redis" | ||
run: redis-cli -h redis ping | ||
# --- Cache based on Conan version and ExternalProjects cmake source | ||
- name: Get Conan version | ||
id: get-conan-version | ||
run: | | ||
echo "::set-output name=conan-version::$(conan --version | tr -d '[:alpha:] ')" | ||
shell: bash | ||
- name: Hash ExternalProjects | ||
id: hash-external | ||
run: | | ||
echo "::set-output name=hash-external::$(sha256sum cmake/ExternalProjects.cmake | cut '-d ' -f 1)" | ||
shell: bash | ||
- uses: actions/cache@v2 | ||
with: | ||
path: '~/.conan' | ||
key: ${{ runner.os }}-${{ steps.get-conan-version.outputs.conan-version }}-${{ steps.hash-external.outputs.hash-external }} | ||
restore-keys: | | ||
${{ runner.os }}-${{ steps.get-conan-version.outputs.conan-version }}- | ||
${{ runner.os }}- | ||
# --- Build with thread sanitising | ||
- name: "Build tests with leak sanitising" | ||
run: inv dev.sanitise Leak --noclean | ||
# --- Tests --- | ||
- name: "Run tests with leak sanitising on and print stderr to file" | ||
run: ./bin/faabric_tests | ||
working-directory: /build/faabric/static |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
build/ | ||
|
||
conan-cache/ | ||
# Clang | ||
.clangd | ||
compile_commands.json | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.