cmCTestMemCheckHandler.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  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. 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. #ifndef cmCTestMemCheckHandler_h
  14. #define cmCTestMemCheckHandler_h
  15. #include "cmCTestTestHandler.h"
  16. #include "cmListFileCache.h"
  17. class cmMakefile;
  18. /** \class cmCTestMemCheckHandler
  19. * \brief A class that handles ctest -S invocations
  20. *
  21. */
  22. class cmCTestMemCheckHandler : public cmCTestTestHandler
  23. {
  24. friend class cmCTestRunTest;
  25. public:
  26. cmTypeMacro(cmCTestMemCheckHandler, cmCTestTestHandler);
  27. void PopulateCustomVectors(cmMakefile *mf);
  28. cmCTestMemCheckHandler();
  29. void Initialize();
  30. protected:
  31. virtual int PreProcessHandler();
  32. virtual int PostProcessHandler();
  33. virtual void GenerateTestCommand(std::vector<std::string>& args);
  34. private:
  35. enum { // Memory checkers
  36. UNKNOWN = 0,
  37. VALGRIND,
  38. PURIFY,
  39. BOUNDS_CHECKER
  40. };
  41. public:
  42. enum { // Memory faults
  43. ABR = 0,
  44. ABW,
  45. ABWL,
  46. COR,
  47. EXU,
  48. FFM,
  49. FIM,
  50. FMM,
  51. FMR,
  52. FMW,
  53. FUM,
  54. IPR,
  55. IPW,
  56. MAF,
  57. MLK,
  58. MPK,
  59. NPR,
  60. ODS,
  61. PAR,
  62. PLK,
  63. UMC,
  64. UMR,
  65. NO_MEMORY_FAULT
  66. };
  67. private:
  68. enum { // Program statuses
  69. NOT_RUN = 0,
  70. TIMEOUT,
  71. SEGFAULT,
  72. ILLEGAL,
  73. INTERRUPT,
  74. NUMERICAL,
  75. OTHER_FAULT,
  76. FAILED,
  77. BAD_COMMAND,
  78. COMPLETED
  79. };
  80. std::string BoundsCheckerDPBDFile;
  81. std::string BoundsCheckerXMLFile;
  82. std::string MemoryTester;
  83. std::vector<cmStdString> MemoryTesterOptionsParsed;
  84. std::string MemoryTesterOptions;
  85. int MemoryTesterStyle;
  86. std::string MemoryTesterOutputFile;
  87. int MemoryTesterGlobalResults[NO_MEMORY_FAULT];
  88. ///! Initialize memory checking subsystem.
  89. bool InitializeMemoryChecking();
  90. /**
  91. * Generate the Dart compatible output
  92. */
  93. void GenerateDartOutput(std::ostream& os);
  94. std::vector<cmStdString> CustomPreMemCheck;
  95. std::vector<cmStdString> CustomPostMemCheck;
  96. //! Parse Valgrind/Purify/Bounds Checker result out of the output
  97. //string. After running, log holds the output and results hold the
  98. //different memmory errors.
  99. bool ProcessMemCheckOutput(const std::string& str,
  100. std::string& log, int* results);
  101. bool ProcessMemCheckValgrindOutput(const std::string& str,
  102. std::string& log, int* results);
  103. bool ProcessMemCheckPurifyOutput(const std::string& str,
  104. std::string& log, int* results);
  105. bool ProcessMemCheckBoundsCheckerOutput(const std::string& str,
  106. std::string& log, int* results);
  107. void PostProcessPurifyTest(cmCTestTestResult& res);
  108. void PostProcessBoundsCheckerTest(cmCTestTestResult& res);
  109. };
  110. #endif