MCPcopy Create free account
hub / github.com/Kitware/CMake / InitializeMemoryChecking

Method InitializeMemoryChecking

Source/CTest/cmCTestMemCheckHandler.cxx:434–768  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

432}
433
434bool cmCTestMemCheckHandler::InitializeMemoryChecking()
435{
436 this->MemoryTesterEnvironmentVariable.clear();
437 this->MemoryTester.clear();
438 // Setup the command
439 if (cmSystemTools::FileExists(
440 this->CTest->GetCTestConfiguration("MemoryCheckCommand"))) {
441 this->MemoryTester =
442 this->CTest->GetCTestConfiguration("MemoryCheckCommand");
443 std::string testerName =
444 cmSystemTools::GetFilenameName(this->MemoryTester);
445 // determine the checker type
446 if (testerName.find("valgrind") != std::string::npos ||
447 this->CTest->GetCTestConfiguration("MemoryCheckType") == "Valgrind") {
448 this->MemoryTesterStyle = cmCTestMemCheckHandler::VALGRIND;
449 } else if (testerName.find("drmemory") != std::string::npos ||
450 this->CTest->GetCTestConfiguration("MemoryCheckType") ==
451 "DrMemory") {
452 this->MemoryTesterStyle = cmCTestMemCheckHandler::DRMEMORY;
453 } else if (testerName.find("purify") != std::string::npos) {
454 this->MemoryTesterStyle = cmCTestMemCheckHandler::PURIFY;
455 } else if (testerName.find("BC") != std::string::npos) {
456 this->MemoryTesterStyle = cmCTestMemCheckHandler::BOUNDS_CHECKER;
457 } else if (testerName.find("cuda-memcheck") != std::string::npos ||
458 testerName.find("compute-sanitizer") != std::string::npos) {
459 this->MemoryTesterStyle = cmCTestMemCheckHandler::CUDA_SANITIZER;
460 } else {
461 this->MemoryTesterStyle = cmCTestMemCheckHandler::UNKNOWN;
462 }
463 } else if (cmSystemTools::FileExists(
464 this->CTest->GetCTestConfiguration("PurifyCommand"))) {
465 this->MemoryTester = this->CTest->GetCTestConfiguration("PurifyCommand");
466 this->MemoryTesterStyle = cmCTestMemCheckHandler::PURIFY;
467 } else if (cmSystemTools::FileExists(
468 this->CTest->GetCTestConfiguration("ValgrindCommand"))) {
469 this->MemoryTester = this->CTest->GetCTestConfiguration("ValgrindCommand");
470 this->MemoryTesterStyle = cmCTestMemCheckHandler::VALGRIND;
471 } else if (cmSystemTools::FileExists(
472 this->CTest->GetCTestConfiguration("DrMemoryCommand"))) {
473 this->MemoryTester = this->CTest->GetCTestConfiguration("DrMemoryCommand");
474 this->MemoryTesterStyle = cmCTestMemCheckHandler::DRMEMORY;
475 } else if (cmSystemTools::FileExists(
476 this->CTest->GetCTestConfiguration("BoundsCheckerCommand"))) {
477 this->MemoryTester =
478 this->CTest->GetCTestConfiguration("BoundsCheckerCommand");
479 this->MemoryTesterStyle = cmCTestMemCheckHandler::BOUNDS_CHECKER;
480 } else if (cmSystemTools::FileExists(
481 this->CTest->GetCTestConfiguration("CudaSanitizerCommand"))) {
482 this->MemoryTester =
483 this->CTest->GetCTestConfiguration("CudaSanitizerCommand");
484 this->MemoryTesterStyle = cmCTestMemCheckHandler::CUDA_SANITIZER;
485 }
486 if (this->CTest->GetCTestConfiguration("MemoryCheckType") ==
487 "AddressSanitizer") {
488 this->MemoryTester = cmSystemTools::GetCMakeCommand();
489 this->MemoryTesterStyle = cmCTestMemCheckHandler::ADDRESS_SANITIZER;
490 this->LogWithPID = true; // even if we give the log file the pid is added
491 }

Callers 1

PreProcessHandlerMethod · 0.95

Calls 15

moveFunction · 0.85
GetCTestConfigurationMethod · 0.80
GetBinaryDirMethod · 0.80
emplace_backMethod · 0.80
push_backMethod · 0.80
eraseMethod · 0.80
c_strMethod · 0.80
FileExistsFunction · 0.50
findFunction · 0.50
clearMethod · 0.45
findMethod · 0.45

Tested by

no test coverage detected