Fix setting of ASAN_OPTIONS, UBSAN_OPTIONS, OMP_NUM_THREADS environment variables so they're only set if the job needs them

This commit is contained in:
Sebastian Messmer 2021-04-19 10:24:29 -07:00
parent 18b7cc63ec
commit b4328a0d74
2 changed files with 15 additions and 7 deletions

View File

@ -4,6 +4,9 @@ inputs:
gtest_args:
description: "Extra arguments for gtest runners, for example tests to exclude"
required: true
extra_env_vars:
description: "Extra environment variables to set before running tests"
required: true
runs:
using: "composite"
steps:
@ -13,6 +16,9 @@ runs:
set -v
echo Running on ${{runner.os}}
cd build
export ${{ inputs.extra_env_vars }}
./test/gitversion/gitversion-test ${{inputs.gtest_args}}
./test/cpp-utils/cpp-utils-test ${{inputs.gtest_args}}
./test/parallelaccessstore/parallelaccessstore-test ${{inputs.gtest_args}}

View File

@ -73,6 +73,7 @@ jobs:
- RelWithDebInfo
extra_cmake_flags: [""]
extra_cxxflags: [""]
extra_env_vars_for_test: [""]
install_dependencies_manually: [false]
run_tests: [true]
include:
@ -85,6 +86,7 @@ jobs:
build_type: RelWithDebInfo
extra_cmake_flags: -DDEPENDENCY_CONFIG=../cmake-utils/DependenciesFromLocalSystem.cmake
extra_cxxflags: ""
extra_env_vars_for_test: ""
install_dependencies_manually: true
run_tests: true
- name: Local dependencies
@ -96,6 +98,7 @@ jobs:
build_type: RelWithDebInfo
extra_cmake_flags: -DDEPENDENCY_CONFIG=../cmake-utils/DependenciesFromLocalSystem.cmake
extra_cxxflags: ""
extra_env_vars_for_test: ""
install_dependencies_manually: true
run_tests: true
- name: Werror gcc
@ -129,6 +132,7 @@ jobs:
build_type: RelWithDebInfo
extra_cmake_flags: ""
extra_cxxflags: "-DCRYFS_NO_COMPATIBILITY"
extra_env_vars_for_test: ""
install_dependencies_manually: false
run_tests: true
- name: ASAN
@ -142,7 +146,7 @@ jobs:
# TODO is it enough to replace this with omp_num_threads: 1 ?
extra_cmake_flags: "-DDISABLE_OPENMP=ON"
extra_cxxflags: "-O1 -fsanitize=address -fno-omit-frame-pointer -fno-optimize-sibling-calls -fno-common -fsanitize-address-use-after-scope"
asan_options: "detect_leaks=1 check_initialization_order=1 detect_stack_use_after_return=1 detect_invalid_pointer_pairs=1 atexit=1"
extra_env_vars_for_test: ASAN_OPTIONS="detect_leaks=1 check_initialization_order=1 detect_stack_use_after_return=1 detect_invalid_pointer_pairs=1 atexit=1"
install_dependencies_manually: false
run_tests: true
- name: UBSAN
@ -156,7 +160,7 @@ jobs:
# TODO is it enough to replace this with omp_num_threads: 1 ?
extra_cmake_flags: "-DDISABLE_OPENMP=ON"
extra_cxxflags: "-O1 -fno-sanitize-recover=undefined,nullability,implicit-conversion,unsigned-integer-overflow,local-bounds,float-divide-by-zero -fno-omit-frame-pointer -fno-optimize-sibling-calls -fno-common"
ubsan_options: "print_stacktrace=1"
extra_env_vars_for_test: UBSAN_OPTIONS="print_stacktrace=1"
install_dependencies_manually: false
run_tests: true
- name: TSAN
@ -171,14 +175,11 @@ jobs:
install_dependencies_manually: false
run_tests: true
gtest_args: "--gtest_filter=-LoggingTest.LoggingAlsoWorksAfterFork:AssertTest_*:BacktraceTest.*:SignalCatcherTest.*_thenDies:SignalHandlerTest.*_thenDies:SignalHandlerTest.givenMultipleSigIntHandlers_whenRaising_thenCatchesCorrectSignal:CliTest_Setup.*:CliTest_IntegrityCheck.*:*/CliTest_WrongEnvironment.*:CliTest_Unmount.*:CliTest.WorksWithCommasInBasedir"
omp_num_threads: 1
extra_env_vars_for_test: OMP_NUM_THREADS=1
runs-on: ${{matrix.os}}
env:
# Setting conan cache dir to a location where our Github Cache Action can find it
CONAN_USER_HOME: "${{ github.workspace }}/conan-cache/"
ASAN_OPTIONS: ${{matrix.asan_options}}
UBSAN_OPTIONS: ${{matrix.ubsan_options}}
OMP_NUM_THREADS: ${{matrix.omp_num_threads}}
steps:
- name: Checkout
uses: actions/checkout@v1
@ -354,4 +355,5 @@ jobs:
if: ${{ matrix.run_tests }}
uses: ./.github/workflows/actions/run_tests
with:
gtest_args: ${{matrix.gtest_args}}
gtest_args: ${{matrix.gtest_args}}
extra_env_vars: ${{matrix.extra_env_vars_for_test}}