From 56fc2b03c81b87334438e5512499dd94cf405aad Mon Sep 17 00:00:00 2001 From: Ben Clayton Date: Fri, 5 Jun 2020 20:33:11 +0100 Subject: [PATCH] Kokoro: Enable debug checks Enabled `MARL_FATAL` and `MARL_ASSERT` even in debug builds. --- CMakeLists.txt | 5 +++++ kokoro/macos/presubmit.sh | 7 ++++++- kokoro/ubuntu/presubmit-docker.sh | 3 ++- kokoro/windows/presubmit.bat | 2 +- 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 963f1c8..7e71740 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -44,6 +44,7 @@ option_if_not_defined(MARL_MSAN "Build marl with memory sanitizer" OFF) option_if_not_defined(MARL_TSAN "Build marl with thread sanitizer" OFF) option_if_not_defined(MARL_INSTALL "Create marl install target" OFF) option_if_not_defined(MARL_FULL_BENCHMARK "Benchmark all cores and a range of tasks" OFF) +option_if_not_defined(MARL_DEBUG_ENABLED "Enable debug checks even in release builds" OFF) ########################################################### # Directories @@ -187,6 +188,10 @@ function(marl_set_target_options target) target_link_libraries(${target} PUBLIC "-fsanitize=thread") endif() + if (MARL_DEBUG_ENABLED) + target_compile_definitions(${target} PRIVATE "MARL_DEBUG_ENABLED=1") + endif() + target_include_directories(${target} PUBLIC $) endfunction(marl_set_target_options) diff --git a/kokoro/macos/presubmit.sh b/kokoro/macos/presubmit.sh index f2009c8..60300c4 100755 --- a/kokoro/macos/presubmit.sh +++ b/kokoro/macos/presubmit.sh @@ -13,7 +13,12 @@ if [ "$BUILD_SYSTEM" == "cmake" ]; then mkdir build cd build - cmake .. -DMARL_BUILD_EXAMPLES=1 -DMARL_BUILD_TESTS=1 -DMARL_BUILD_BENCHMARKS=1 -DMARL_WARNINGS_AS_ERRORS=1 + cmake .. -DMARL_BUILD_EXAMPLES=1 \ + -DMARL_BUILD_TESTS=1 \ + -DMARL_BUILD_BENCHMARKS=1 \ + -DMARL_WARNINGS_AS_ERRORS=1 \ + -DMARL_DEBUG_ENABLED=1 + make -j$(sysctl -n hw.logicalcpu) ./marl-unittests diff --git a/kokoro/ubuntu/presubmit-docker.sh b/kokoro/ubuntu/presubmit-docker.sh index 262ec5f..1439bd4 100755 --- a/kokoro/ubuntu/presubmit-docker.sh +++ b/kokoro/ubuntu/presubmit-docker.sh @@ -39,7 +39,8 @@ if [ "$BUILD_SYSTEM" == "cmake" ]; then -DMARL_BUILD_EXAMPLES=1 \ -DMARL_BUILD_TESTS=1 \ -DMARL_BUILD_BENCHMARKS=1 \ - -DMARL_WARNINGS_AS_ERRORS=1 + -DMARL_WARNINGS_AS_ERRORS=1 \ + -DMARL_DEBUG_ENABLED=1 make --jobs=$(nproc) diff --git a/kokoro/windows/presubmit.bat b/kokoro/windows/presubmit.bat index 1cb9caa..a73aa7c 100644 --- a/kokoro/windows/presubmit.bat +++ b/kokoro/windows/presubmit.bat @@ -20,7 +20,7 @@ cd %SRC%\build if !ERRORLEVEL! neq 0 exit !ERRORLEVEL! IF /I "%BUILD_SYSTEM%"=="cmake" ( - cmake .. -G "%BUILD_GENERATOR%" "-DMARL_BUILD_TESTS=1" "-DMARL_BUILD_EXAMPLES=1" "-DMARL_BUILD_BENCHMARKS=1" "-DMARL_WARNINGS_AS_ERRORS=1" + cmake .. -G "%BUILD_GENERATOR%" "-DMARL_BUILD_TESTS=1" "-DMARL_BUILD_EXAMPLES=1" "-DMARL_BUILD_BENCHMARKS=1" "-DMARL_WARNINGS_AS_ERRORS=1" "-DMARL_DEBUG_ENABLED=1" if !ERRORLEVEL! neq 0 exit !ERRORLEVEL! %MSBUILD% /p:Configuration=%CONFIG% Marl.sln if !ERRORLEVEL! neq 0 exit !ERRORLEVEL!