ctest_memcheck: join *SAN_OPTIONS with :

This commit is contained in:
Jamie Snape 2017-01-09 13:39:08 -05:00
parent cdacfbd255
commit 0a2e588585
3 changed files with 14 additions and 9 deletions

View File

@ -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.

View File

@ -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;

View File

@ -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}\"