ctest_memcheck: Order sanitizer type code consistently
Use alphabetic order everywhere we enumerate the sanitizer types.
This commit is contained in:
parent
f48a2968aa
commit
b67ef537d4
|
@ -370,12 +370,12 @@ void cmCTestMemCheckHandler::GenerateDartOutput(std::ostream& os)
|
||||||
case cmCTestMemCheckHandler::BOUNDS_CHECKER:
|
case cmCTestMemCheckHandler::BOUNDS_CHECKER:
|
||||||
os << "BoundsChecker";
|
os << "BoundsChecker";
|
||||||
break;
|
break;
|
||||||
case cmCTestMemCheckHandler::THREAD_SANITIZER:
|
|
||||||
os << "ThreadSanitizer";
|
|
||||||
break;
|
|
||||||
case cmCTestMemCheckHandler::ADDRESS_SANITIZER:
|
case cmCTestMemCheckHandler::ADDRESS_SANITIZER:
|
||||||
os << "AddressSanitizer";
|
os << "AddressSanitizer";
|
||||||
break;
|
break;
|
||||||
|
case cmCTestMemCheckHandler::THREAD_SANITIZER:
|
||||||
|
os << "ThreadSanitizer";
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
os << "Unknown";
|
os << "Unknown";
|
||||||
}
|
}
|
||||||
|
@ -536,14 +536,6 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking()
|
||||||
= this->CTest->GetCTestConfiguration("BoundsCheckerCommand").c_str();
|
= this->CTest->GetCTestConfiguration("BoundsCheckerCommand").c_str();
|
||||||
this->MemoryTesterStyle = cmCTestMemCheckHandler::BOUNDS_CHECKER;
|
this->MemoryTesterStyle = cmCTestMemCheckHandler::BOUNDS_CHECKER;
|
||||||
}
|
}
|
||||||
if ( this->CTest->GetCTestConfiguration("MemoryCheckType")
|
|
||||||
== "ThreadSanitizer")
|
|
||||||
{
|
|
||||||
this->MemoryTester
|
|
||||||
= this->CTest->GetCTestConfiguration("CMakeCommand").c_str();
|
|
||||||
this->MemoryTesterStyle = cmCTestMemCheckHandler::THREAD_SANITIZER;
|
|
||||||
this->LogWithPID = true; // even if we give the log file the pid is added
|
|
||||||
}
|
|
||||||
if ( this->CTest->GetCTestConfiguration("MemoryCheckType")
|
if ( this->CTest->GetCTestConfiguration("MemoryCheckType")
|
||||||
== "AddressSanitizer")
|
== "AddressSanitizer")
|
||||||
{
|
{
|
||||||
|
@ -552,6 +544,14 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking()
|
||||||
this->MemoryTesterStyle = cmCTestMemCheckHandler::ADDRESS_SANITIZER;
|
this->MemoryTesterStyle = cmCTestMemCheckHandler::ADDRESS_SANITIZER;
|
||||||
this->LogWithPID = true; // even if we give the log file the pid is added
|
this->LogWithPID = true; // even if we give the log file the pid is added
|
||||||
}
|
}
|
||||||
|
if ( this->CTest->GetCTestConfiguration("MemoryCheckType")
|
||||||
|
== "ThreadSanitizer")
|
||||||
|
{
|
||||||
|
this->MemoryTester
|
||||||
|
= this->CTest->GetCTestConfiguration("CMakeCommand").c_str();
|
||||||
|
this->MemoryTesterStyle = cmCTestMemCheckHandler::THREAD_SANITIZER;
|
||||||
|
this->LogWithPID = true; // even if we give the log file the pid is added
|
||||||
|
}
|
||||||
// Check the MemoryCheckType
|
// Check the MemoryCheckType
|
||||||
if(this->MemoryTesterStyle == cmCTestMemCheckHandler::UNKNOWN)
|
if(this->MemoryTesterStyle == cmCTestMemCheckHandler::UNKNOWN)
|
||||||
{
|
{
|
||||||
|
@ -674,8 +674,7 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking()
|
||||||
this->MemoryTesterOptions.push_back("/M");
|
this->MemoryTesterOptions.push_back("/M");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// these two are almost the same but the env var used
|
// these are almost the same but the env var used is different
|
||||||
// is different
|
|
||||||
case cmCTestMemCheckHandler::ADDRESS_SANITIZER:
|
case cmCTestMemCheckHandler::ADDRESS_SANITIZER:
|
||||||
case cmCTestMemCheckHandler::THREAD_SANITIZER:
|
case cmCTestMemCheckHandler::THREAD_SANITIZER:
|
||||||
{
|
{
|
||||||
|
@ -689,16 +688,16 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking()
|
||||||
std::string envVar;
|
std::string envVar;
|
||||||
std::string extraOptions =
|
std::string extraOptions =
|
||||||
this->CTest->GetCTestConfiguration("MemoryCheckSanitizerOptions");
|
this->CTest->GetCTestConfiguration("MemoryCheckSanitizerOptions");
|
||||||
if(this->MemoryTesterStyle == cmCTestMemCheckHandler::THREAD_SANITIZER)
|
if(this->MemoryTesterStyle == cmCTestMemCheckHandler::ADDRESS_SANITIZER)
|
||||||
{
|
|
||||||
envVar = "TSAN_OPTIONS";
|
|
||||||
}
|
|
||||||
else if(this->MemoryTesterStyle ==
|
|
||||||
cmCTestMemCheckHandler::ADDRESS_SANITIZER)
|
|
||||||
{
|
{
|
||||||
envVar = "ASAN_OPTIONS";
|
envVar = "ASAN_OPTIONS";
|
||||||
extraOptions += " detect_leaks=1";
|
extraOptions += " detect_leaks=1";
|
||||||
}
|
}
|
||||||
|
else if(this->MemoryTesterStyle ==
|
||||||
|
cmCTestMemCheckHandler::THREAD_SANITIZER)
|
||||||
|
{
|
||||||
|
envVar = "TSAN_OPTIONS";
|
||||||
|
}
|
||||||
std::string outputFile = envVar + "=log_path=\""
|
std::string outputFile = envVar + "=log_path=\""
|
||||||
+ this->MemoryTesterOutputFile + "\" ";
|
+ this->MemoryTesterOutputFile + "\" ";
|
||||||
this->MemoryTesterEnvironmentVariable = outputFile + extraOptions;
|
this->MemoryTesterEnvironmentVariable = outputFile + extraOptions;
|
||||||
|
@ -734,9 +733,9 @@ ProcessMemCheckOutput(const std::string& str,
|
||||||
return this->ProcessMemCheckPurifyOutput(str, log, results);
|
return this->ProcessMemCheckPurifyOutput(str, log, results);
|
||||||
}
|
}
|
||||||
else if ( this->MemoryTesterStyle ==
|
else if ( this->MemoryTesterStyle ==
|
||||||
cmCTestMemCheckHandler::THREAD_SANITIZER ||
|
cmCTestMemCheckHandler::ADDRESS_SANITIZER ||
|
||||||
this->MemoryTesterStyle ==
|
this->MemoryTesterStyle ==
|
||||||
cmCTestMemCheckHandler::ADDRESS_SANITIZER)
|
cmCTestMemCheckHandler::THREAD_SANITIZER)
|
||||||
{
|
{
|
||||||
return this->ProcessMemCheckSanitizerOutput(str, log, results);
|
return this->ProcessMemCheckSanitizerOutput(str, log, results);
|
||||||
}
|
}
|
||||||
|
@ -776,13 +775,16 @@ bool cmCTestMemCheckHandler::ProcessMemCheckSanitizerOutput(
|
||||||
std::vector<int>& result)
|
std::vector<int>& result)
|
||||||
{
|
{
|
||||||
std::string regex;
|
std::string regex;
|
||||||
if(this->MemoryTesterStyle == cmCTestMemCheckHandler::THREAD_SANITIZER)
|
switch ( this->MemoryTesterStyle )
|
||||||
{
|
|
||||||
regex = "WARNING: ThreadSanitizer: (.*) \\(pid=.*\\)";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
|
case cmCTestMemCheckHandler::ADDRESS_SANITIZER:
|
||||||
regex = "ERROR: AddressSanitizer: (.*) on.*";
|
regex = "ERROR: AddressSanitizer: (.*) on.*";
|
||||||
|
break;
|
||||||
|
case cmCTestMemCheckHandler::THREAD_SANITIZER:
|
||||||
|
regex = "WARNING: ThreadSanitizer: (.*) \\(pid=.*\\)";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
cmsys::RegularExpression sanitizerWarning(regex);
|
cmsys::RegularExpression sanitizerWarning(regex);
|
||||||
cmsys::RegularExpression leakWarning("(Direct|Indirect) leak of .*");
|
cmsys::RegularExpression leakWarning("(Direct|Indirect) leak of .*");
|
||||||
|
|
|
@ -50,8 +50,8 @@ private:
|
||||||
PURIFY,
|
PURIFY,
|
||||||
BOUNDS_CHECKER,
|
BOUNDS_CHECKER,
|
||||||
// checkers after here do not use the standard error list
|
// checkers after here do not use the standard error list
|
||||||
THREAD_SANITIZER,
|
ADDRESS_SANITIZER,
|
||||||
ADDRESS_SANITIZER
|
THREAD_SANITIZER
|
||||||
};
|
};
|
||||||
public:
|
public:
|
||||||
enum { // Memory faults
|
enum { // Memory faults
|
||||||
|
|
Loading…
Reference in New Issue