ctest_memcheck: Add support for MemorySanitizer msan

This commit is contained in:
Bill Hoffman 2014-10-07 11:34:53 -04:00 committed by Brad King
parent 9ba8bf123c
commit 0c6330da38
3 changed files with 24 additions and 1 deletions

View File

@ -4,4 +4,4 @@ CTEST_MEMORYCHECK_TYPE
Specify the CTest ``MemoryCheckType`` setting
in a :manual:`ctest(1)` dashboard client script.
Valid values are Valgrind, Purify, BoundsChecker, and ThreadSanitizer,
AddressSanitizer, and UndefinedBehaviorSanitizer.
AddressSanitizer, MemorySanitizer, and UndefinedBehaviorSanitizer.

View File

@ -376,6 +376,9 @@ void cmCTestMemCheckHandler::GenerateDartOutput(std::ostream& os)
case cmCTestMemCheckHandler::THREAD_SANITIZER:
os << "ThreadSanitizer";
break;
case cmCTestMemCheckHandler::MEMORY_SANITIZER:
os << "MemorySanitizer";
break;
case cmCTestMemCheckHandler::UB_SANITIZER:
os << "UndefinedBehaviorSanitizer";
break;
@ -555,6 +558,14 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking()
this->MemoryTesterStyle = cmCTestMemCheckHandler::THREAD_SANITIZER;
this->LogWithPID = true; // even if we give the log file the pid is added
}
if ( this->CTest->GetCTestConfiguration("MemoryCheckType")
== "MemorySanitizer")
{
this->MemoryTester
= this->CTest->GetCTestConfiguration("CMakeCommand").c_str();
this->MemoryTesterStyle = cmCTestMemCheckHandler::MEMORY_SANITIZER;
this->LogWithPID = true; // even if we give the log file the pid is added
}
if ( this->CTest->GetCTestConfiguration("MemoryCheckType")
== "UndefinedBehaviorSanitizer")
{
@ -688,6 +699,7 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking()
// these are almost the same but the env var used is different
case cmCTestMemCheckHandler::ADDRESS_SANITIZER:
case cmCTestMemCheckHandler::THREAD_SANITIZER:
case cmCTestMemCheckHandler::MEMORY_SANITIZER:
case cmCTestMemCheckHandler::UB_SANITIZER:
{
// To pass arguments to ThreadSanitizer the environment variable
@ -710,6 +722,11 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking()
{
envVar = "TSAN_OPTIONS";
}
else if(this->MemoryTesterStyle ==
cmCTestMemCheckHandler::MEMORY_SANITIZER)
{
envVar = "MSAN_OPTIONS";
}
else if(this->MemoryTesterStyle == cmCTestMemCheckHandler::UB_SANITIZER)
{
envVar = "UBSAN_OPTIONS";
@ -753,6 +770,8 @@ ProcessMemCheckOutput(const std::string& str,
this->MemoryTesterStyle ==
cmCTestMemCheckHandler::THREAD_SANITIZER ||
this->MemoryTesterStyle ==
cmCTestMemCheckHandler::MEMORY_SANITIZER ||
this->MemoryTesterStyle ==
cmCTestMemCheckHandler::UB_SANITIZER)
{
return this->ProcessMemCheckSanitizerOutput(str, log, results);
@ -801,6 +820,9 @@ bool cmCTestMemCheckHandler::ProcessMemCheckSanitizerOutput(
case cmCTestMemCheckHandler::THREAD_SANITIZER:
regex = "WARNING: ThreadSanitizer: (.*) \\(pid=.*\\)";
break;
case cmCTestMemCheckHandler::MEMORY_SANITIZER:
regex = "WARNING: MemorySanitizer: (.*)";
break;
case cmCTestMemCheckHandler::UB_SANITIZER:
regex = "runtime error: (.*)";
break;

View File

@ -52,6 +52,7 @@ private:
// checkers after here do not use the standard error list
ADDRESS_SANITIZER,
THREAD_SANITIZER,
MEMORY_SANITIZER,
UB_SANITIZER
};
public: