cmCTestMemCheckHandler.cxx 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653
  1. /*=========================================================================
  2. Program: CMake - Cross-Platform Makefile Generator
  3. Module: $RCSfile$
  4. Language: C++
  5. Date: $Date$
  6. Version: $Revision$
  7. Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
  8. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
  9. This software is distributed WITHOUT ANY WARRANTY; without even
  10. the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  11. PURPOSE. See the above copyright notices for more information.
  12. =========================================================================*/
  13. #include "cmCTestMemCheckHandler.h"
  14. #include "cmCTest.h"
  15. #include "cmake.h"
  16. #include "cmGeneratedFileStream.h"
  17. #include <cmsys/Process.h>
  18. #include <cmsys/RegularExpression.hxx>
  19. #include <cmsys/Base64.h>
  20. #include "cmMakefile.h"
  21. #include <stdlib.h>
  22. #include <math.h>
  23. #include <float.h>
  24. //----------------------------------------------------------------------
  25. static const char* cmCTestMemCheckResultStrings[] = {
  26. "ABR",
  27. "ABW",
  28. "ABWL",
  29. "COR",
  30. "EXU",
  31. "FFM",
  32. "FIM",
  33. "FMM",
  34. "FMR",
  35. "FMW",
  36. "FUM",
  37. "IPR",
  38. "IPW",
  39. "MAF",
  40. "MLK",
  41. "MPK",
  42. "NPR",
  43. "ODS",
  44. "PAR",
  45. "PLK",
  46. "UMC",
  47. "UMR",
  48. 0
  49. };
  50. //----------------------------------------------------------------------
  51. static const char* cmCTestMemCheckResultLongStrings[] = {
  52. "Threading Problem",
  53. "ABW",
  54. "ABWL",
  55. "COR",
  56. "EXU",
  57. "FFM",
  58. "FIM",
  59. "Mismatched deallocation",
  60. "FMR",
  61. "FMW",
  62. "FUM",
  63. "IPR",
  64. "IPW",
  65. "MAF",
  66. "Memory Leak",
  67. "Potential Memory Leak",
  68. "NPR",
  69. "ODS",
  70. "Invalid syscall param",
  71. "PLK",
  72. "Uninitialized Memory Conditional",
  73. "Uninitialized Memory Read",
  74. 0
  75. };
  76. //----------------------------------------------------------------------
  77. cmCTestMemCheckHandler::cmCTestMemCheckHandler()
  78. {
  79. this->MemCheck = true;
  80. this->CustomMaximumPassedTestOutputSize = 0;
  81. this->CustomMaximumFailedTestOutputSize = 0;
  82. }
  83. //----------------------------------------------------------------------
  84. void cmCTestMemCheckHandler::Initialize()
  85. {
  86. this->Superclass::Initialize();
  87. this->MemoryTester = "";
  88. this->MemoryTesterOptionsParsed.clear();
  89. this->MemoryTesterOptions = "";
  90. this->MemoryTesterStyle = UNKNOWN;
  91. this->MemoryTesterOutputFile = "";
  92. int cc;
  93. for ( cc = 0; cc < NO_MEMORY_FAULT; cc ++ )
  94. {
  95. this->MemoryTesterGlobalResults[cc] = 0;
  96. }
  97. }
  98. //----------------------------------------------------------------------
  99. int cmCTestMemCheckHandler::PreProcessHandler()
  100. {
  101. if ( !this->InitializeMemoryChecking() )
  102. {
  103. return 0;
  104. }
  105. if ( !this->ExecuteCommands(this->CustomPreMemCheck) )
  106. {
  107. cmCTestLog(this->CTest, ERROR_MESSAGE,
  108. "Problem executing pre-memcheck command(s)." << std::endl);
  109. return 0;
  110. }
  111. return 1;
  112. }
  113. //----------------------------------------------------------------------
  114. int cmCTestMemCheckHandler::PostProcessHandler()
  115. {
  116. if ( !this->ExecuteCommands(this->CustomPostMemCheck) )
  117. {
  118. cmCTestLog(this->CTest, ERROR_MESSAGE,
  119. "Problem executing post-memcheck command(s)." << std::endl);
  120. return 0;
  121. }
  122. return 1;
  123. }
  124. //----------------------------------------------------------------------
  125. void cmCTestMemCheckHandler::GenerateTestCommand(
  126. std::vector<const char*>& args)
  127. {
  128. std::vector<cmStdString>::size_type pp;
  129. args.push_back(this->MemoryTester.c_str());
  130. std::string memcheckcommand = "";
  131. memcheckcommand = this->MemoryTester;
  132. for ( pp = 0; pp < this->MemoryTesterOptionsParsed.size(); pp ++ )
  133. {
  134. args.push_back(this->MemoryTesterOptionsParsed[pp].c_str());
  135. memcheckcommand += " ";
  136. memcheckcommand += cmSystemTools::EscapeSpaces(
  137. this->MemoryTesterOptionsParsed[pp].c_str());
  138. }
  139. cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Memory check command: "
  140. << memcheckcommand << std::endl);
  141. }
  142. //----------------------------------------------------------------------
  143. void cmCTestMemCheckHandler::PopulateCustomVectors(cmMakefile *mf)
  144. {
  145. this->cmCTestTestHandler::PopulateCustomVectors(mf);
  146. this->CTest->PopulateCustomVector(mf, "CTEST_CUSTOM_PRE_MEMCHECK",
  147. this->CustomPreMemCheck);
  148. this->CTest->PopulateCustomVector(mf, "CTEST_CUSTOM_POST_MEMCHECK",
  149. this->CustomPostMemCheck);
  150. this->CTest->PopulateCustomVector(mf,
  151. "CTEST_CUSTOM_MEMCHECK_IGNORE",
  152. this->CustomTestsIgnore);
  153. }
  154. //----------------------------------------------------------------------
  155. void cmCTestMemCheckHandler::GenerateDartOutput(std::ostream& os)
  156. {
  157. if ( !this->CTest->GetProduceXML() )
  158. {
  159. return;
  160. }
  161. this->CTest->StartXML(os);
  162. os << "<DynamicAnalysis Checker=\"";
  163. switch ( this->MemoryTesterStyle )
  164. {
  165. case cmCTestMemCheckHandler::VALGRIND:
  166. os << "Valgrind";
  167. break;
  168. case cmCTestMemCheckHandler::PURIFY:
  169. os << "Purify";
  170. break;
  171. case cmCTestMemCheckHandler::BOUNDS_CHECKER:
  172. os << "BoundsChecker";
  173. break;
  174. default:
  175. os << "Unknown";
  176. }
  177. os << "\">" << std::endl;
  178. os << "\t<StartDateTime>" << this->StartTest << "</StartDateTime>\n"
  179. << "\t<TestList>\n";
  180. cmCTestMemCheckHandler::TestResultsVector::size_type cc;
  181. for ( cc = 0; cc < this->TestResults.size(); cc ++ )
  182. {
  183. cmCTestTestResult *result = &this->TestResults[cc];
  184. std::string testPath = result->Path + "/" + result->Name;
  185. os << "\t\t<Test>" << cmCTest::MakeXMLSafe(
  186. this->CTest->GetShortPathToFile(testPath.c_str()))
  187. << "</Test>" << std::endl;
  188. }
  189. os << "\t</TestList>\n";
  190. cmCTestLog(this->CTest, HANDLER_OUTPUT,
  191. "-- Processing memory checking output: ");
  192. size_t total = this->TestResults.size();
  193. size_t step = total / 10;
  194. size_t current = 0;
  195. for ( cc = 0; cc < this->TestResults.size(); cc ++ )
  196. {
  197. cmCTestTestResult *result = &this->TestResults[cc];
  198. std::string memcheckstr;
  199. int memcheckresults[cmCTestMemCheckHandler::NO_MEMORY_FAULT];
  200. int kk;
  201. bool res = this->ProcessMemCheckOutput(result->Output, memcheckstr,
  202. memcheckresults);
  203. if ( res && result->Status == cmCTestMemCheckHandler::COMPLETED )
  204. {
  205. continue;
  206. }
  207. this->CleanTestOutput(memcheckstr,
  208. static_cast<size_t>(this->CustomMaximumFailedTestOutputSize));
  209. os << "\t<Test Status=\"";
  210. if ( result->Status == cmCTestMemCheckHandler::COMPLETED )
  211. {
  212. os << "passed";
  213. }
  214. else if ( result->Status == cmCTestMemCheckHandler::NOT_RUN )
  215. {
  216. os << "notrun";
  217. }
  218. else
  219. {
  220. os << "failed";
  221. }
  222. std::string testPath = result->Path + "/" + result->Name;
  223. os << "\">\n"
  224. << "\t\t<Name>" << cmCTest::MakeXMLSafe(result->Name) << "</Name>\n"
  225. << "\t\t<Path>" << cmCTest::MakeXMLSafe(
  226. this->CTest->GetShortPathToFile(result->Path.c_str())) << "</Path>\n"
  227. << "\t\t<FullName>" << cmCTest::MakeXMLSafe(
  228. this->CTest->GetShortPathToFile(testPath.c_str())) << "</FullName>\n"
  229. << "\t\t<FullCommandLine>"
  230. << cmCTest::MakeXMLSafe(result->FullCommandLine)
  231. << "</FullCommandLine>\n"
  232. << "\t\t<Results>" << std::endl;
  233. for ( kk = 0; cmCTestMemCheckResultLongStrings[kk]; kk ++ )
  234. {
  235. if ( memcheckresults[kk] )
  236. {
  237. os << "\t\t\t<Defect type=\"" << cmCTestMemCheckResultLongStrings[kk]
  238. << "\">"
  239. << memcheckresults[kk]
  240. << "</Defect>" << std::endl;
  241. }
  242. this->MemoryTesterGlobalResults[kk] += memcheckresults[kk];
  243. }
  244. os
  245. << "\t\t</Results>\n"
  246. << "\t<Log>\n" << memcheckstr << std::endl
  247. << "\t</Log>\n"
  248. << "\t</Test>" << std::endl;
  249. if ( current < cc )
  250. {
  251. cmCTestLog(this->CTest, HANDLER_OUTPUT, "#" << std::flush);
  252. current += step;
  253. }
  254. }
  255. cmCTestLog(this->CTest, HANDLER_OUTPUT, std::endl);
  256. cmCTestLog(this->CTest, HANDLER_OUTPUT, "Memory checking results:"
  257. << std::endl);
  258. os << "\t<DefectList>" << std::endl;
  259. for ( cc = 0; cmCTestMemCheckResultStrings[cc]; cc ++ )
  260. {
  261. if ( this->MemoryTesterGlobalResults[cc] )
  262. {
  263. #ifdef cerr
  264. # undef cerr
  265. #endif
  266. std::cerr.width(35);
  267. #define cerr no_cerr
  268. cmCTestLog(this->CTest, HANDLER_OUTPUT,
  269. cmCTestMemCheckResultLongStrings[cc] << " - "
  270. << this->MemoryTesterGlobalResults[cc] << std::endl);
  271. os << "\t\t<Defect Type=\"" << cmCTestMemCheckResultLongStrings[cc]
  272. << "\"/>" << std::endl;
  273. }
  274. }
  275. os << "\t</DefectList>" << std::endl;
  276. os << "\t<EndDateTime>" << this->EndTest << "</EndDateTime>" << std::endl;
  277. os << "<ElapsedMinutes>"
  278. << static_cast<int>(this->ElapsedTestingTime/6)/10.0
  279. << "</ElapsedMinutes>\n";
  280. os << "</DynamicAnalysis>" << std::endl;
  281. this->CTest->EndXML(os);
  282. }
  283. //----------------------------------------------------------------------
  284. bool cmCTestMemCheckHandler::InitializeMemoryChecking()
  285. {
  286. // Setup the command
  287. if ( cmSystemTools::FileExists(this->CTest->GetCTestConfiguration(
  288. "MemoryCheckCommand").c_str()) )
  289. {
  290. this->MemoryTester
  291. = cmSystemTools::ConvertToOutputPath(this->CTest->GetCTestConfiguration(
  292. "MemoryCheckCommand").c_str());
  293. }
  294. else if ( cmSystemTools::FileExists(this->CTest->GetCTestConfiguration(
  295. "PurifyCommand").c_str()) )
  296. {
  297. this->MemoryTester
  298. = cmSystemTools::ConvertToOutputPath(this->CTest->GetCTestConfiguration(
  299. "PurifyCommand").c_str());
  300. }
  301. else if ( cmSystemTools::FileExists(this->CTest->GetCTestConfiguration(
  302. "ValgrindCommand").c_str()) )
  303. {
  304. this->MemoryTester
  305. = cmSystemTools::ConvertToOutputPath(this->CTest->GetCTestConfiguration(
  306. "ValgrindCommand").c_str());
  307. }
  308. else
  309. {
  310. cmCTestLog(this->CTest, ERROR_MESSAGE,
  311. "Memory checker (MemoryCheckCommand) "
  312. "not set, or cannot find the specified program."
  313. << std::endl);
  314. return false;
  315. }
  316. if ( this->MemoryTester[0] == '\"' &&
  317. this->MemoryTester[this->MemoryTester.size()-1] == '\"' )
  318. {
  319. this->MemoryTester
  320. = this->MemoryTester.substr(1, this->MemoryTester.size()-2);
  321. }
  322. // Setup the options
  323. if ( this->CTest->GetCTestConfiguration(
  324. "MemoryCheckCommandOptions").size() )
  325. {
  326. this->MemoryTesterOptions = this->CTest->GetCTestConfiguration(
  327. "MemoryCheckCommandOptions");
  328. }
  329. else if ( this->CTest->GetCTestConfiguration(
  330. "ValgrindCommandOptions").size() )
  331. {
  332. this->MemoryTesterOptions = this->CTest->GetCTestConfiguration(
  333. "ValgrindCommandOptions");
  334. }
  335. this->MemoryTesterOutputFile
  336. = this->CTest->GetBinaryDir() + "/Testing/Temporary/MemoryChecker.log";
  337. this->MemoryTesterOutputFile
  338. = cmSystemTools::EscapeSpaces(this->MemoryTesterOutputFile.c_str());
  339. if ( this->MemoryTester.find("valgrind") != std::string::npos )
  340. {
  341. this->MemoryTesterStyle = cmCTestMemCheckHandler::VALGRIND;
  342. if ( !this->MemoryTesterOptions.size() )
  343. {
  344. this->MemoryTesterOptions = "-q --tool=memcheck --leak-check=yes "
  345. "--show-reachable=yes --workaround-gcc296-bugs=yes --num-callers=100";
  346. }
  347. if ( this->CTest->GetCTestConfiguration(
  348. "MemoryCheckSuppressionFile").size() )
  349. {
  350. if ( !cmSystemTools::FileExists(this->CTest->GetCTestConfiguration(
  351. "MemoryCheckSuppressionFile").c_str()) )
  352. {
  353. cmCTestLog(this->CTest, ERROR_MESSAGE,
  354. "Cannot find memory checker suppression file: "
  355. << this->CTest->GetCTestConfiguration(
  356. "MemoryCheckSuppressionFile").c_str() << std::endl);
  357. return false;
  358. }
  359. this->MemoryTesterOptions += " --suppressions=" +
  360. cmSystemTools::EscapeSpaces(this->CTest->GetCTestConfiguration(
  361. "MemoryCheckSuppressionFile").c_str()) + "";
  362. }
  363. }
  364. else if ( this->MemoryTester.find("purify") != std::string::npos )
  365. {
  366. this->MemoryTesterStyle = cmCTestMemCheckHandler::PURIFY;
  367. #ifdef _WIN32
  368. this->MemoryTesterOptions += " /SAVETEXTDATA=" +
  369. this->MemoryTesterOutputFile;
  370. #else
  371. this->MemoryTesterOptions += " -log-file=" + this->MemoryTesterOutputFile;
  372. #endif
  373. }
  374. else if ( this->MemoryTester.find("boundschecker") != std::string::npos )
  375. {
  376. this->MemoryTesterStyle = cmCTestMemCheckHandler::BOUNDS_CHECKER;
  377. cmCTestLog(this->CTest, ERROR_MESSAGE,
  378. "Bounds checker not yet implemented" << std::endl);
  379. return false;
  380. }
  381. else
  382. {
  383. cmCTestLog(this->CTest, ERROR_MESSAGE,
  384. "Do not understand memory checker: " << this->MemoryTester.c_str()
  385. << std::endl);
  386. return false;
  387. }
  388. this->MemoryTesterOptionsParsed
  389. = cmSystemTools::ParseArguments(this->MemoryTesterOptions.c_str());
  390. std::vector<cmStdString>::size_type cc;
  391. for ( cc = 0; cmCTestMemCheckResultStrings[cc]; cc ++ )
  392. {
  393. this->MemoryTesterGlobalResults[cc] = 0;
  394. }
  395. return true;
  396. }
  397. //----------------------------------------------------------------------
  398. bool cmCTestMemCheckHandler::ProcessMemCheckOutput(const std::string& str,
  399. std::string& log, int* results)
  400. {
  401. std::string::size_type cc;
  402. for ( cc = 0; cc < cmCTestMemCheckHandler::NO_MEMORY_FAULT; cc ++ )
  403. {
  404. results[cc] = 0;
  405. }
  406. if ( this->MemoryTesterStyle == cmCTestMemCheckHandler::VALGRIND )
  407. {
  408. return this->ProcessMemCheckValgrindOutput(str, log, results);
  409. }
  410. else if ( this->MemoryTesterStyle == cmCTestMemCheckHandler::PURIFY )
  411. {
  412. return this->ProcessMemCheckPurifyOutput(str, log, results);
  413. }
  414. else if ( this->MemoryTesterStyle ==
  415. cmCTestMemCheckHandler::BOUNDS_CHECKER )
  416. {
  417. log.append("\nMemory checking style used was: ");
  418. log.append("Bounds Checker");
  419. }
  420. else
  421. {
  422. log.append("\nMemory checking style used was: ");
  423. log.append("None that I know");
  424. log = str;
  425. }
  426. return true;
  427. }
  428. //----------------------------------------------------------------------
  429. bool cmCTestMemCheckHandler::ProcessMemCheckPurifyOutput(
  430. const std::string&, std::string& log,
  431. int* results)
  432. {
  433. if ( !cmSystemTools::FileExists(this->MemoryTesterOutputFile.c_str()) )
  434. {
  435. log = "Cannot find Purify output file: " + this->MemoryTesterOutputFile;
  436. cmCTestLog(this->CTest, ERROR_MESSAGE, log.c_str() << std::endl);
  437. return false;
  438. }
  439. std::ifstream ifs(this->MemoryTesterOutputFile.c_str());
  440. if ( !ifs )
  441. {
  442. log = "Cannot read Purify output file: " + this->MemoryTesterOutputFile;
  443. cmCTestLog(this->CTest, ERROR_MESSAGE, log.c_str() << std::endl);
  444. return false;
  445. }
  446. cmOStringStream ostr;
  447. log = "";
  448. cmsys::RegularExpression pfW("^\\[[WEI]\\] ([A-Z][A-Z][A-Z][A-Z]*): ");
  449. int defects = 0;
  450. std::string line;
  451. while ( cmSystemTools::GetLineFromStream(ifs, line) )
  452. {
  453. int failure = cmCTestMemCheckHandler::NO_MEMORY_FAULT;
  454. if ( pfW.find(line) )
  455. {
  456. int cc;
  457. for ( cc = 0; cc < cmCTestMemCheckHandler::NO_MEMORY_FAULT; cc ++ )
  458. {
  459. if ( pfW.match(1) == cmCTestMemCheckResultStrings[cc] )
  460. {
  461. failure = cc;
  462. break;
  463. }
  464. }
  465. if ( cc == cmCTestMemCheckHandler::NO_MEMORY_FAULT )
  466. {
  467. cmCTestLog(this->CTest, ERROR_MESSAGE, "Unknown Purify memory fault: "
  468. << pfW.match(1) << std::endl);
  469. ostr << "*** Unknown Purify memory fault: " << pfW.match(1)
  470. << std::endl;
  471. }
  472. }
  473. if ( failure != NO_MEMORY_FAULT )
  474. {
  475. ostr << "<b>" << cmCTestMemCheckResultStrings[failure] << "</b> ";
  476. results[failure] ++;
  477. defects ++;
  478. }
  479. ostr << cmCTest::MakeXMLSafe(line) << std::endl;
  480. }
  481. log = ostr.str();
  482. if ( defects )
  483. {
  484. return false;
  485. }
  486. return true;
  487. }
  488. //----------------------------------------------------------------------
  489. bool cmCTestMemCheckHandler::ProcessMemCheckValgrindOutput(
  490. const std::string& str, std::string& log,
  491. int* results)
  492. {
  493. std::vector<cmStdString> lines;
  494. cmSystemTools::Split(str.c_str(), lines);
  495. std::string::size_type cc;
  496. cmOStringStream ostr;
  497. log = "";
  498. int defects = 0;
  499. cmsys::RegularExpression valgrindLine("^==[0-9][0-9]*==");
  500. cmsys::RegularExpression vgFIM(
  501. "== .*Invalid free\\(\\) / delete / delete\\[\\]");
  502. cmsys::RegularExpression vgFMM(
  503. "== .*Mismatched free\\(\\) / delete / delete \\[\\]");
  504. cmsys::RegularExpression vgMLK(
  505. "== .*[0-9][0-9]* bytes in [0-9][0-9]* blocks are definitely lost"
  506. " in loss record [0-9][0-9]* of [0-9]");
  507. cmsys::RegularExpression vgPAR(
  508. "== .*Syscall param .* contains unaddressable byte\\(s\\)");
  509. cmsys::RegularExpression vgMPK1(
  510. "== .*[0-9][0-9]* bytes in [0-9][0-9]* blocks are possibly lost in"
  511. " loss record [0-9][0-9]* of [0-9]");
  512. cmsys::RegularExpression vgMPK2(
  513. "== .*[0-9][0-9]* bytes in [0-9][0-9]* blocks are still reachable"
  514. " in loss record [0-9][0-9]* of [0-9]");
  515. cmsys::RegularExpression vgUMC(
  516. "== .*Conditional jump or move depends on uninitialised value\\(s\\)");
  517. cmsys::RegularExpression vgUMR1(
  518. "== .*Use of uninitialised value of size [0-9][0-9]*");
  519. cmsys::RegularExpression vgUMR2("== .*Invalid read of size [0-9][0-9]*");
  520. cmsys::RegularExpression vgUMR3("== .*Jump to the invalid address ");
  521. cmsys::RegularExpression vgUMR4("== .*Syscall param .* contains "
  522. "uninitialised or unaddressable byte\\(s\\)");
  523. cmsys::RegularExpression vgIPW("== .*Invalid write of size [0-9]");
  524. cmsys::RegularExpression vgABR("== .*pthread_mutex_unlock: mutex is "
  525. "locked by a different thread");
  526. double sttime = cmSystemTools::GetTime();
  527. cmCTestLog(this->CTest, DEBUG, "Start test: " << lines.size() << std::endl);
  528. for ( cc = 0; cc < lines.size(); cc ++ )
  529. {
  530. if ( valgrindLine.find(lines[cc]) )
  531. {
  532. int failure = cmCTestMemCheckHandler::NO_MEMORY_FAULT;
  533. if ( vgFIM.find(lines[cc]) )
  534. {
  535. failure = cmCTestMemCheckHandler::FIM;
  536. }
  537. else if ( vgFMM.find(lines[cc]) )
  538. {
  539. failure = cmCTestMemCheckHandler::FMM;
  540. }
  541. else if ( vgMLK.find(lines[cc]) )
  542. {
  543. failure = cmCTestMemCheckHandler::MLK;
  544. }
  545. else if ( vgPAR.find(lines[cc]) )
  546. {
  547. failure = cmCTestMemCheckHandler::PAR;
  548. }
  549. else if ( vgMPK1.find(lines[cc]) )
  550. {
  551. failure = cmCTestMemCheckHandler::MPK;
  552. }
  553. else if ( vgMPK2.find(lines[cc]) )
  554. {
  555. failure = cmCTestMemCheckHandler::MPK;
  556. }
  557. else if ( vgUMC.find(lines[cc]) )
  558. {
  559. failure = cmCTestMemCheckHandler::UMC;
  560. }
  561. else if ( vgUMR1.find(lines[cc]) )
  562. {
  563. failure = cmCTestMemCheckHandler::UMR;
  564. }
  565. else if ( vgUMR2.find(lines[cc]) )
  566. {
  567. failure = cmCTestMemCheckHandler::UMR;
  568. }
  569. else if ( vgUMR3.find(lines[cc]) )
  570. {
  571. failure = cmCTestMemCheckHandler::UMR;
  572. }
  573. else if ( vgUMR4.find(lines[cc]) )
  574. {
  575. failure = cmCTestMemCheckHandler::UMR;
  576. }
  577. else if ( vgIPW.find(lines[cc]) )
  578. {
  579. failure = cmCTestMemCheckHandler::IPW;
  580. }
  581. else if ( vgABR.find(lines[cc]) )
  582. {
  583. failure = cmCTestMemCheckHandler::ABR;
  584. }
  585. if ( failure != cmCTestMemCheckHandler::NO_MEMORY_FAULT )
  586. {
  587. ostr << "<b>" << cmCTestMemCheckResultStrings[failure] << "</b> ";
  588. results[failure] ++;
  589. defects ++;
  590. }
  591. ostr << cmCTest::MakeXMLSafe(lines[cc]) << std::endl;
  592. }
  593. }
  594. cmCTestLog(this->CTest, DEBUG, "End test (elapsed: "
  595. << (cmSystemTools::GetTime() - sttime) << std::endl);
  596. log = ostr.str();
  597. if ( defects )
  598. {
  599. return false;
  600. }
  601. return true;
  602. }