cmCTestMemCheckHandler.h 2.8 KB

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