summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Help/release/dev/ctest_memcheck-leak_sanitizer.rst5
-rw-r--r--Source/CTest/cmCTestMemCheckHandler.cxx8
-rw-r--r--Tests/RunCMake/ctest_memcheck/RunCMakeTest.cmake10
3 files changed, 14 insertions, 9 deletions
diff --git a/Help/release/dev/ctest_memcheck-leak_sanitizer.rst b/Help/release/dev/ctest_memcheck-leak_sanitizer.rst
index 1348c278a..60b4a22 100644
--- a/Help/release/dev/ctest_memcheck-leak_sanitizer.rst
+++ b/Help/release/dev/ctest_memcheck-leak_sanitizer.rst
@@ -7,3 +7,8 @@ ctest_memcheck-leak_sanitizer
* The :command:`ctest_memcheck` command learned to read the location of
suppressions files for sanitizers from the
:variable:`CTEST_MEMORYCHECK_SUPPRESSIONS_FILE` variable.
+
+* The :command:`ctest_memcheck` command was fixed to correctly append extra
+ sanitizer options read from the
+ :variable:`CTEST_MEMORYCHECK_SANITIZER_OPTIONS` variable to the environment
+ variables used internally by the sanitizers.
diff --git a/Source/CTest/cmCTestMemCheckHandler.cxx b/Source/CTest/cmCTestMemCheckHandler.cxx
index 81b73aa..fc07249 100644
--- a/Source/CTest/cmCTestMemCheckHandler.cxx
+++ b/Source/CTest/cmCTestMemCheckHandler.cxx
@@ -607,18 +607,18 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking()
this->MemoryTesterDynamicOptions.push_back("-E");
this->MemoryTesterDynamicOptions.push_back("env");
std::string envVar;
- std::string extraOptions =
+ std::string extraOptions = ":" +
this->CTest->GetCTestConfiguration("MemoryCheckSanitizerOptions");
std::string suppressionsOption;
if (!this->CTest->GetCTestConfiguration("MemoryCheckSuppressionFile")
.empty()) {
- suppressionsOption = " suppressions=" +
+ suppressionsOption = ":suppressions=" +
this->CTest->GetCTestConfiguration("MemoryCheckSuppressionFile");
}
if (this->MemoryTesterStyle ==
cmCTestMemCheckHandler::ADDRESS_SANITIZER) {
envVar = "ASAN_OPTIONS";
- extraOptions += " detect_leaks=1";
+ extraOptions += ":detect_leaks=1";
} else if (this->MemoryTesterStyle ==
cmCTestMemCheckHandler::LEAK_SANITIZER) {
envVar = "LSAN_OPTIONS";
@@ -633,7 +633,7 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking()
envVar = "UBSAN_OPTIONS";
}
std::string outputFile =
- envVar + "=log_path=\"" + this->MemoryTesterOutputFile + "\" ";
+ envVar + "=log_path=\"" + this->MemoryTesterOutputFile + "\"";
this->MemoryTesterEnvironmentVariable =
outputFile + extraOptions + suppressionsOption;
break;
diff --git a/Tests/RunCMake/ctest_memcheck/RunCMakeTest.cmake b/Tests/RunCMake/ctest_memcheck/RunCMakeTest.cmake
index 25bb6a2..352a381 100644
--- a/Tests/RunCMake/ctest_memcheck/RunCMakeTest.cmake
+++ b/Tests/RunCMake/ctest_memcheck/RunCMakeTest.cmake
@@ -32,7 +32,7 @@ unset(CTEST_EXTRA_CODE)
#-----------------------------------------------------------------------------
# add standalone LeakSanitizer test
set(CTEST_EXTRA_CODE
-"set(CTEST_MEMORYCHECK_SANITIZER_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
"add_test(NAME TestSan COMMAND \"${CMAKE_COMMAND}\"
@@ -45,7 +45,7 @@ unset(CTEST_EXTRA_CODE)
#-----------------------------------------------------------------------------
# add AddressSanitizer test
set(CTEST_EXTRA_CODE
-"set(CTEST_MEMORYCHECK_SANITIZER_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
"add_test(NAME TestSan COMMAND \"\${CMAKE_COMMAND}\"
@@ -58,7 +58,7 @@ unset(CTEST_EXTRA_CODE)
#-----------------------------------------------------------------------------
# add AddressSanitizer/LeakSanitizer test
set(CTEST_EXTRA_CODE
-"set(CTEST_MEMORYCHECK_SANITIZER_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
"add_test(NAME TestSan COMMAND \"${CMAKE_COMMAND}\"
@@ -71,7 +71,7 @@ unset(CTEST_EXTRA_CODE)
#-----------------------------------------------------------------------------
# add MemorySanitizer test
set(CTEST_EXTRA_CODE
-"set(CTEST_MEMORYCHECK_COMMAND_OPTIONS \"simulate_sanitizer=1 report_bugs=1 history_size=5 exitcode=55\")
+"set(CTEST_MEMORYCHECK_COMMAND_OPTIONS \"simulate_sanitizer=1:report_bugs=1:history_size=5:exitcode=55\")
")
set(CMAKELISTS_EXTRA_CODE
"add_test(NAME TestSan COMMAND \"\${CMAKE_COMMAND}\"
@@ -164,7 +164,7 @@ unset(CTEST_SUFFIX_CODE)
set(CTEST_SUFFIX_CODE "message(\"Defect count: \${defect_count}\")")
set(CTEST_MEMCHECK_ARGS "DEFECT_COUNT defect_count")
set(CTEST_EXTRA_CODE
-"set(CTEST_MEMORYCHECK_SANITIZER_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
"add_test(NAME TestSan COMMAND \"${CMAKE_COMMAND}\"