mirror of
https://github.com/reactos/CMake.git
synced 2024-12-13 22:58:41 +00:00
Merge topic 'sanitizer-options'
e116f2a5
ctest_memcheck: Fix sanitizers when MemoryCheckSanitizerOptions is empty522e1588
Tests: Use CTEST_MEMORYCHECK_SANITIZER_OPTIONS where appropriate
This commit is contained in:
commit
54790e77d7
@ -607,9 +607,13 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking()
|
|||||||
this->MemoryTesterDynamicOptions.push_back("-E");
|
this->MemoryTesterDynamicOptions.push_back("-E");
|
||||||
this->MemoryTesterDynamicOptions.push_back("env");
|
this->MemoryTesterDynamicOptions.push_back("env");
|
||||||
std::string envVar;
|
std::string envVar;
|
||||||
std::string extraOptions = ":" +
|
std::string extraOptions;
|
||||||
this->CTest->GetCTestConfiguration("MemoryCheckSanitizerOptions");
|
|
||||||
std::string suppressionsOption;
|
std::string suppressionsOption;
|
||||||
|
if (!this->CTest->GetCTestConfiguration("MemoryCheckSanitizerOptions")
|
||||||
|
.empty()) {
|
||||||
|
extraOptions = ":" +
|
||||||
|
this->CTest->GetCTestConfiguration("MemoryCheckSanitizerOptions");
|
||||||
|
}
|
||||||
if (!this->CTest->GetCTestConfiguration("MemoryCheckSuppressionFile")
|
if (!this->CTest->GetCTestConfiguration("MemoryCheckSuppressionFile")
|
||||||
.empty()) {
|
.empty()) {
|
||||||
suppressionsOption = ":suppressions=" +
|
suppressionsOption = ":suppressions=" +
|
||||||
@ -631,8 +635,10 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking()
|
|||||||
cmCTestMemCheckHandler::UB_SANITIZER) {
|
cmCTestMemCheckHandler::UB_SANITIZER) {
|
||||||
envVar = "UBSAN_OPTIONS";
|
envVar = "UBSAN_OPTIONS";
|
||||||
}
|
}
|
||||||
|
// Quote log_path with single quotes; see
|
||||||
|
// https://bugs.chromium.org/p/chromium/issues/detail?id=467936
|
||||||
std::string outputFile =
|
std::string outputFile =
|
||||||
envVar + "=log_path=\"" + this->MemoryTesterOutputFile + "\"";
|
envVar + "=log_path='" + this->MemoryTesterOutputFile + "'";
|
||||||
this->MemoryTesterEnvironmentVariable =
|
this->MemoryTesterEnvironmentVariable =
|
||||||
outputFile + suppressionsOption + extraOptions;
|
outputFile + suppressionsOption + extraOptions;
|
||||||
break;
|
break;
|
||||||
|
@ -19,7 +19,7 @@ unset(CMAKELISTS_EXTRA_CODE)
|
|||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
# add ThreadSanitizer test
|
# add ThreadSanitizer test
|
||||||
set(CTEST_EXTRA_CODE
|
set(CTEST_EXTRA_CODE
|
||||||
"set(CTEST_MEMORYCHECK_COMMAND_OPTIONS \"report_bugs=1 history_size=5 exitcode=55\")
|
"set(CTEST_MEMORYCHECK_SANITIZER_OPTIONS \"report_bugs=1:history_size=5:exitcode=55\")
|
||||||
")
|
")
|
||||||
set(CMAKELISTS_EXTRA_CODE
|
set(CMAKELISTS_EXTRA_CODE
|
||||||
"add_test(NAME TestSan COMMAND \"\${CMAKE_COMMAND}\"
|
"add_test(NAME TestSan COMMAND \"\${CMAKE_COMMAND}\"
|
||||||
@ -71,7 +71,7 @@ unset(CTEST_EXTRA_CODE)
|
|||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
# add MemorySanitizer test
|
# add MemorySanitizer test
|
||||||
set(CTEST_EXTRA_CODE
|
set(CTEST_EXTRA_CODE
|
||||||
"set(CTEST_MEMORYCHECK_COMMAND_OPTIONS \"simulate_sanitizer=1:report_bugs=1:history_size=5:exitcode=55\")
|
"set(CTEST_MEMORYCHECK_SANITIZER_OPTIONS \"simulate_sanitizer=1:report_bugs=1:history_size=5:exitcode=55\")
|
||||||
")
|
")
|
||||||
set(CMAKELISTS_EXTRA_CODE
|
set(CMAKELISTS_EXTRA_CODE
|
||||||
"add_test(NAME TestSan COMMAND \"\${CMAKE_COMMAND}\"
|
"add_test(NAME TestSan COMMAND \"\${CMAKE_COMMAND}\"
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
# options
|
# options
|
||||||
|
|
||||||
message("ASAN_OPTIONS = [$ENV{ASAN_OPTIONS}]")
|
message("ASAN_OPTIONS = [$ENV{ASAN_OPTIONS}]")
|
||||||
string(REGEX REPLACE ".*log_path=\"([^\"]*)\".*" "\\1" LOG_FILE "$ENV{ASAN_OPTIONS}")
|
string(REGEX REPLACE ".*log_path=\'([^\']*)\'.*" "\\1" LOG_FILE "$ENV{ASAN_OPTIONS}")
|
||||||
message("LOG_FILE=[${LOG_FILE}]")
|
message("LOG_FILE=[${LOG_FILE}]")
|
||||||
|
|
||||||
# if we are not asked to simulate AddressSanitizer don't do it
|
# if we are not asked to simulate AddressSanitizer don't do it
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
# options
|
# options
|
||||||
|
|
||||||
message("ASAN_OPTIONS = [$ENV{ASAN_OPTIONS}]")
|
message("ASAN_OPTIONS = [$ENV{ASAN_OPTIONS}]")
|
||||||
string(REGEX REPLACE ".*log_path=\"([^\"]*)\".*" "\\1" LOG_FILE "$ENV{ASAN_OPTIONS}")
|
string(REGEX REPLACE ".*log_path=\'([^\']*)\'.*" "\\1" LOG_FILE "$ENV{ASAN_OPTIONS}")
|
||||||
message("LOG_FILE=[${LOG_FILE}]")
|
message("LOG_FILE=[${LOG_FILE}]")
|
||||||
|
|
||||||
# if we are not asked to simulate address sanitizer don't do it
|
# if we are not asked to simulate address sanitizer don't do it
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
# options
|
# options
|
||||||
|
|
||||||
message("LSAN_OPTIONS = [$ENV{LSAN_OPTIONS}]")
|
message("LSAN_OPTIONS = [$ENV{LSAN_OPTIONS}]")
|
||||||
string(REGEX REPLACE ".*log_path=\"([^\"]*)\".*" "\\1" LOG_FILE "$ENV{LSAN_OPTIONS}")
|
string(REGEX REPLACE ".*log_path=\'([^\']*)\'.*" "\\1" LOG_FILE "$ENV{LSAN_OPTIONS}")
|
||||||
message("LOG_FILE=[${LOG_FILE}]")
|
message("LOG_FILE=[${LOG_FILE}]")
|
||||||
|
|
||||||
# if we are not asked to simulate LeakSanitizer don't do it
|
# if we are not asked to simulate LeakSanitizer don't do it
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
# this file simulates a program that has been built with thread sanitizer
|
# this file simulates a program that has been built with MemorySanitizer
|
||||||
# options
|
# options
|
||||||
|
|
||||||
message("MSAN_OPTIONS = [$ENV{MSAN_OPTIONS}]")
|
message("MSAN_OPTIONS = [$ENV{MSAN_OPTIONS}]")
|
||||||
string(REGEX REPLACE ".*log_path=\"([^\"]*)\".*" "\\1" LOG_FILE "$ENV{MSAN_OPTIONS}")
|
string(REGEX REPLACE ".*log_path=\'([^\']*)\'.*" "\\1" LOG_FILE "$ENV{MSAN_OPTIONS}")
|
||||||
message("LOG_FILE=[${LOG_FILE}]")
|
message("LOG_FILE=[${LOG_FILE}]")
|
||||||
|
|
||||||
# if we are not asked to simulate address sanitizer don't do it
|
# if we are not asked to simulate address sanitizer don't do it
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
# this file simulates a program that has been built with thread sanitizer
|
# this file simulates a program that has been built with ThreadSanitizer
|
||||||
# options
|
# options
|
||||||
|
|
||||||
message("TSAN_OPTIONS = [$ENV{TSAN_OPTIONS}]")
|
message("TSAN_OPTIONS = [$ENV{TSAN_OPTIONS}]")
|
||||||
string(REGEX REPLACE ".*log_path=\"([^\"]*)\".*" "\\1" LOG_FILE "$ENV{TSAN_OPTIONS}")
|
string(REGEX REPLACE ".*log_path=\'([^\']*)\'.*" "\\1" LOG_FILE "$ENV{TSAN_OPTIONS}")
|
||||||
message("LOG_FILE=[${LOG_FILE}]")
|
message("LOG_FILE=[${LOG_FILE}]")
|
||||||
|
|
||||||
set(error_types
|
set(error_types
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
# this file simulates a program that has been built with undefined behavior
|
# this file simulates a program that has been built with
|
||||||
# sanitizer options
|
# UndefinedBehaviorSanitizer options
|
||||||
|
|
||||||
message("UBSAN_OPTIONS = [$ENV{UBSAN_OPTIONS}]")
|
message("UBSAN_OPTIONS = [$ENV{UBSAN_OPTIONS}]")
|
||||||
string(REGEX REPLACE ".*log_path=\"([^\"]*)\".*" "\\1" LOG_FILE "$ENV{UBSAN_OPTIONS}")
|
string(REGEX REPLACE ".*log_path=\'([^\']*)\'.*" "\\1" LOG_FILE "$ENV{UBSAN_OPTIONS}")
|
||||||
message("LOG_FILE=[${LOG_FILE}]")
|
message("LOG_FILE=[${LOG_FILE}]")
|
||||||
|
|
||||||
# if we are not asked to simulate address sanitizer don't do it
|
# if we are not asked to simulate address sanitizer don't do it
|
||||||
|
Loading…
Reference in New Issue
Block a user