Skip to content

Commit

Permalink
Merge pull request #11 from RedisBloom/sanitizers
Browse files Browse the repository at this point in the history
Enabled sanitizers on CI
  • Loading branch information
filipecosta90 committed Feb 28, 2021
2 parents b95727e + f9f36f1 commit 97f31e9
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,22 @@ jobs:
command: |
make lint
sanitize:
docker:
- image: redislabsmodules/llvm-toolset:latest
steps:
- checkout
- run:
name: Install CMAKE
command: 'apt install -y cmake'
- run:
name: Pull Submodules
command: git submodule update --init --recursive
- run:
name: Build & Test with sanitizers
command: |
make sanitize
static-analysis-infer:
docker:
- image: redisbench/infer-linux64:1.0.0
Expand Down Expand Up @@ -64,6 +80,7 @@ workflows:
jobs:
- lint
- build
- sanitize
nightly:
triggers:
- schedule:
Expand Down
10 changes: 10 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,16 @@ IF(NOT CMAKE_BUILD_TYPE)
"Debug" "Release" "MinSizeRel" "RelWithDebInfo")
ENDIF()


if(ENABLE_SANITIZERS)
message(STATUS "Forcing build type to Debug to run coverage.")
set(CMAKE_BUILD_TYPE "Debug" CACHE
STRING "Choose the type of build." FORCE)
set (CMAKE_C_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=address")
set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=address")
set (CMAKE_LINKER_FLAGS_DEBUG "${CMAKE_LINKER_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=address")
ENDIF()

if(ENABLE_CODECOVERAGE)
message(STATUS "Forcing build type to Debug to run coverage.")
set(CMAKE_BUILD_TYPE "Debug" CACHE
Expand Down
16 changes: 16 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,18 @@ ifndef CMAKE_PROFILE_OPTIONS
endif


ifndef CMAKE_SANITIZE_OPTIONS
CMAKE_SANITIZE_OPTIONS=\
-DBUILD_SHARED=ON \
-DBUILD_STATIC=OFF \
-DENABLE_CODECOVERAGE=OFF \
-DBUILD_TESTS=ON \
-DBUILD_BENCHMARK=OFF \
-DBUILD_EXAMPLES=OFF \
-DENABLE_PROFILE=OFF \
-DENABLE_SANITIZERS=ON
endif

ifndef CMAKE_TEST_OPTIONS
CMAKE_TEST_OPTIONS=\
-DBUILD_SHARED=ON \
Expand Down Expand Up @@ -124,6 +136,10 @@ clean: distclean
distclean:
rm -rf build/*

sanitize: clean
( mkdir -p build; cd build ; cmake $(CMAKE_SANITIZE_OPTIONS) .. ; $(MAKE) VERBOSE=1 )
$(SHOW) build/tests/td_test

profile: clean
( mkdir -p build; cd build ; cmake $(CMAKE_PROFILE_OPTIONS) .. ; $(MAKE) VERBOSE=1 2> $(basename $@).compiler_stedrr_output.txt )

Expand Down

0 comments on commit 97f31e9

Please sign in to comment.