summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/CTest/cmCTestMemCheckHandler.cxx23
-rw-r--r--Source/CTest/cmCTestMemCheckHandler.h3
2 files changed, 24 insertions, 2 deletions
diff --git a/Source/CTest/cmCTestMemCheckHandler.cxx b/Source/CTest/cmCTestMemCheckHandler.cxx
index 8a8a373..cc691aa 100644
--- a/Source/CTest/cmCTestMemCheckHandler.cxx
+++ b/Source/CTest/cmCTestMemCheckHandler.cxx
@@ -376,6 +376,9 @@ void cmCTestMemCheckHandler::GenerateDartOutput(std::ostream& os)
case cmCTestMemCheckHandler::THREAD_SANITIZER:
os << "ThreadSanitizer";
break;
+ case cmCTestMemCheckHandler::UB_SANITIZER:
+ os << "UndefinedBehaviorSanitizer";
+ break;
default:
os << "Unknown";
}
@@ -552,6 +555,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")
+ == "UndefinedBehaviorSanitizer")
+ {
+ this->MemoryTester
+ = this->CTest->GetCTestConfiguration("CMakeCommand").c_str();
+ this->MemoryTesterStyle = cmCTestMemCheckHandler::UB_SANITIZER;
+ this->LogWithPID = true; // even if we give the log file the pid is added
+ }
// Check the MemoryCheckType
if(this->MemoryTesterStyle == cmCTestMemCheckHandler::UNKNOWN)
{
@@ -677,6 +688,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::UB_SANITIZER:
{
// To pass arguments to ThreadSanitizer the environment variable
// TSAN_OPTIONS is used. This is done with the cmake -E env command.
@@ -698,6 +710,10 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking()
{
envVar = "TSAN_OPTIONS";
}
+ else if(this->MemoryTesterStyle == cmCTestMemCheckHandler::UB_SANITIZER)
+ {
+ envVar = "UBSAN_OPTIONS";
+ }
std::string outputFile = envVar + "=log_path=\""
+ this->MemoryTesterOutputFile + "\" ";
this->MemoryTesterEnvironmentVariable = outputFile + extraOptions;
@@ -735,7 +751,9 @@ ProcessMemCheckOutput(const std::string& str,
else if ( this->MemoryTesterStyle ==
cmCTestMemCheckHandler::ADDRESS_SANITIZER ||
this->MemoryTesterStyle ==
- cmCTestMemCheckHandler::THREAD_SANITIZER)
+ cmCTestMemCheckHandler::THREAD_SANITIZER ||
+ this->MemoryTesterStyle ==
+ cmCTestMemCheckHandler::UB_SANITIZER)
{
return this->ProcessMemCheckSanitizerOutput(str, log, results);
}
@@ -783,6 +801,9 @@ bool cmCTestMemCheckHandler::ProcessMemCheckSanitizerOutput(
case cmCTestMemCheckHandler::THREAD_SANITIZER:
regex = "WARNING: ThreadSanitizer: (.*) \\(pid=.*\\)";
break;
+ case cmCTestMemCheckHandler::UB_SANITIZER:
+ regex = "runtime error: (.*)";
+ break;
default:
break;
}
diff --git a/Source/CTest/cmCTestMemCheckHandler.h b/Source/CTest/cmCTestMemCheckHandler.h
index 3ceaa25..f5cc91c 100644
--- a/Source/CTest/cmCTestMemCheckHandler.h
+++ b/Source/CTest/cmCTestMemCheckHandler.h
@@ -51,7 +51,8 @@ private:
BOUNDS_CHECKER,
// checkers after here do not use the standard error list
ADDRESS_SANITIZER,
- THREAD_SANITIZER
+ THREAD_SANITIZER,
+ UB_SANITIZER
};
public:
enum { // Memory faults