cmCTestMemCheckHandler.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  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. public:
  25. cmTypeMacro(cmCTestMemCheckHandler, cmCTestTestHandler);
  26. void PopulateCustomVectors(cmMakefile *mf);
  27. cmCTestMemCheckHandler();
  28. void Initialize();
  29. protected:
  30. virtual int PreProcessHandler();
  31. virtual int PostProcessHandler();
  32. virtual void GenerateTestCommand(std::vector<const char*>& args);
  33. private:
  34. enum { // Memory checkers
  35. UNKNOWN = 0,
  36. VALGRIND,
  37. PURIFY,
  38. BOUNDS_CHECKER
  39. };
  40. enum { // Memory faults
  41. ABR = 0,
  42. ABW,
  43. ABWL,
  44. COR,
  45. EXU,
  46. FFM,
  47. FIM,
  48. FMM,
  49. FMR,
  50. FMW,
  51. FUM,
  52. IPR,
  53. IPW,
  54. MAF,
  55. MLK,
  56. MPK,
  57. NPR,
  58. ODS,
  59. PAR,
  60. PLK,
  61. UMC,
  62. UMR,
  63. NO_MEMORY_FAULT
  64. };
  65. enum { // Program statuses
  66. NOT_RUN = 0,
  67. TIMEOUT,
  68. SEGFAULT,
  69. ILLEGAL,
  70. INTERRUPT,
  71. NUMERICAL,
  72. OTHER_FAULT,
  73. FAILED,
  74. BAD_COMMAND,
  75. COMPLETED
  76. };
  77. std::string m_MemoryTester;
  78. std::vector<cmStdString> m_MemoryTesterOptionsParsed;
  79. std::string m_MemoryTesterOptions;
  80. int m_MemoryTesterStyle;
  81. std::string m_MemoryTesterOutputFile;
  82. int m_MemoryTesterGlobalResults[NO_MEMORY_FAULT];
  83. ///! Initialize memory checking subsystem.
  84. bool InitializeMemoryChecking();
  85. /**
  86. * Generate the Dart compatible output
  87. */
  88. void GenerateDartOutput(std::ostream& os);
  89. std::vector<cmStdString> m_CustomPreMemCheck;
  90. std::vector<cmStdString> m_CustomPostMemCheck;
  91. //! Parse Valgrind/Purify/Bounds Checker result out of the output
  92. //string. After running, log holds the output and results hold the
  93. //different memmory errors.
  94. bool ProcessMemCheckOutput(const std::string& str,
  95. std::string& log, int* results);
  96. bool ProcessMemCheckValgrindOutput(const std::string& str,
  97. std::string& log, int* results);
  98. bool ProcessMemCheckPurifyOutput(const std::string& str,
  99. std::string& log, int* results);
  100. };
  101. #endif