cmCTestBuildHandler.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  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 cmCTestBuildHandler_h
  14. #define cmCTestBuildHandler_h
  15. #include "cmCTestGenericHandler.h"
  16. #include "cmListFileCache.h"
  17. #include <cmsys/RegularExpression.hxx>
  18. class cmMakefile;
  19. /** \class cmCTestBuildHandler
  20. * \brief A class that handles ctest -S invocations
  21. *
  22. */
  23. class cmCTestBuildHandler : public cmCTestGenericHandler
  24. {
  25. public:
  26. cmTypeMacro(cmCTestBuildHandler, cmCTestGenericHandler);
  27. /*
  28. * The main entry point for this class
  29. */
  30. int ProcessHandler();
  31. cmCTestBuildHandler();
  32. void PopulateCustomVectors(cmMakefile *mf);
  33. /**
  34. * Initialize handler
  35. */
  36. virtual void Initialize();
  37. private:
  38. //! Run command specialized for make and configure. Returns process status
  39. // and retVal is return value or exception.
  40. int RunMakeCommand(const char* command,
  41. int* retVal, const char* dir, int timeout,
  42. std::ofstream& ofs);
  43. enum {
  44. b_REGULAR_LINE,
  45. b_WARNING_LINE,
  46. b_ERROR_LINE
  47. };
  48. class cmCTestCompileErrorWarningRex
  49. {
  50. public:
  51. cmCTestCompileErrorWarningRex() {}
  52. int m_FileIndex;
  53. int m_LineIndex;
  54. cmsys::RegularExpression m_RegularExpression;
  55. };
  56. struct cmCTestBuildErrorWarning
  57. {
  58. bool m_Error;
  59. int m_LogLine;
  60. std::string m_Text;
  61. std::string m_SourceFile;
  62. std::string m_SourceFileTail;
  63. int m_LineNumber;
  64. std::string m_PreContext;
  65. std::string m_PostContext;
  66. };
  67. // generate the XML output
  68. void GenerateDartBuildOutput(std::ostream& os,
  69. std::vector<cmCTestBuildErrorWarning>,
  70. double elapsed_time);
  71. std::string m_StartBuild;
  72. std::string m_EndBuild;
  73. std::vector<cmStdString> m_CustomErrorMatches;
  74. std::vector<cmStdString> m_CustomErrorExceptions;
  75. std::vector<cmStdString> m_CustomWarningMatches;
  76. std::vector<cmStdString> m_CustomWarningExceptions;
  77. std::vector<cmCTestCompileErrorWarningRex> m_ErrorWarningFileLineRegex;
  78. std::vector<cmsys::RegularExpression> m_ErrorMatchRegex;
  79. std::vector<cmsys::RegularExpression> m_ErrorExceptionRegex;
  80. std::vector<cmsys::RegularExpression> m_WarningMatchRegex;
  81. std::vector<cmsys::RegularExpression> m_WarningExceptionRegex;
  82. void ProcessBuffer(const char* data, int length, size_t& tick, size_t tick_len,
  83. std::ofstream& ofs);
  84. int ProcessSingleLine(const char* data);
  85. typedef std::deque<char> t_BuildProcessingQueueType;
  86. t_BuildProcessingQueueType m_BuildProcessingQueue;
  87. t_BuildProcessingQueueType::iterator m_BuildProcessingQueueLocation;
  88. size_t m_BuildOutputLogSize;
  89. std::vector<char> m_CurrentProcessingLine;
  90. cmStdString m_SimplifySourceDir;
  91. cmStdString m_SimplifyBuildDir;
  92. size_t m_OutputLineCounter;
  93. typedef std::vector<cmCTestBuildErrorWarning> t_ErrorsAndWarningsVector;
  94. t_ErrorsAndWarningsVector m_ErrorsAndWarnings;
  95. t_ErrorsAndWarningsVector::iterator m_LastErrorOrWarning;
  96. size_t m_PostContextCount;
  97. size_t m_MaxPreContext;
  98. size_t m_MaxPostContext;
  99. std::deque<cmStdString> m_PreContext;
  100. int m_TotalErrors;
  101. int m_TotalWarnings;
  102. char m_LastTickChar;
  103. bool m_ErrorQuotaReached;
  104. bool m_WarningQuotaReached;
  105. int m_MaxErrors;
  106. int m_MaxWarnings;
  107. };
  108. #endif