From f57c37a62194f28fdfdcafd3a42845b60173dbe4 Mon Sep 17 00:00:00 2001 From: Rossi Sun Date: Thu, 9 Jan 2025 14:01:35 +0800 Subject: [PATCH] GH-45206: [C++][CMake] Add sanitizer presets (#45207) ### Rationale for this change See #45206 ### What changes are included in this PR? Add base presets for ASAN/TSAN/UBSAN. And cross product such base presets by `ninja-debug` which is, IMO, the config just enough necessary and likely to need sanitizers' aid. ### Are these changes tested? No need. ### Are there any user-facing changes? None. * GitHub Issue: #45206 Authored-by: Rossi Sun Signed-off-by: Rossi Sun --- cpp/CMakePresets.json | 62 ++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 59 insertions(+), 3 deletions(-) diff --git a/cpp/CMakePresets.json b/cpp/CMakePresets.json index 2fb7b2044f54a..ee8fc1248b9fc 100644 --- a/cpp/CMakePresets.json +++ b/cpp/CMakePresets.json @@ -232,6 +232,33 @@ "ARROW_TEST_MEMCHECK": "ON" } }, + { + "name": "sanitizer-asan", + "hidden": true, + "cacheVariables": { + "ARROW_USE_ASAN": "ON", + "ARROW_JEMALLOC": "OFF", + "ARROW_MIMALLOC": "OFF" + } + }, + { + "name": "sanitizer-tsan", + "hidden": true, + "cacheVariables": { + "ARROW_USE_TSAN": "ON", + "ARROW_JEMALLOC": "OFF", + "ARROW_MIMALLOC": "OFF" + } + }, + { + "name": "sanitizer-ubsan", + "hidden": true, + "cacheVariables": { + "ARROW_USE_UBSAN": "ON", + "ARROW_JEMALLOC": "OFF", + "ARROW_MIMALLOC": "OFF" + } + }, { "name": "ninja-debug-minimal", "inherits": [ @@ -527,16 +554,45 @@ "displayName": "Benchmarking build with everything enabled", "cacheVariables": {} }, + { + "name": "ninja-debug-asan", + "inherits": [ + "ninja-debug", + "sanitizer-asan" + ], + "displayName": "Debug ASAN build with tests and more optional components", + "cacheVariables": {} + }, + { + "name": "ninja-debug-tsan", + "inherits": [ + "ninja-debug", + "sanitizer-tsan" + ], + "displayName": "Debug TSAN build with tests and more optional components", + "cacheVariables": {} + }, + { + "name": "ninja-debug-ubsan", + "inherits": [ + "ninja-debug", + "sanitizer-ubsan" + ], + "displayName": "Debug UBSAN build with tests and more optional components", + "cacheVariables": {} + }, { "name": "fuzzing", - "inherits": "base", + "inherits": [ + "base", + "sanitizer-asan", + "sanitizer-ubsan" + ], "displayName": "Debug build with IPC and Parquet fuzzing targets", "cacheVariables": { "CMAKE_BUILD_TYPE": "Debug", "CMAKE_C_COMPILER": "clang", "CMAKE_CXX_COMPILER": "clang++", - "ARROW_USE_ASAN": "ON", - "ARROW_USE_UBSAN": "ON", "ARROW_IPC": "ON", "ARROW_PARQUET": "ON", "ARROW_FUZZING": "ON"