cmCTestBuildHandler.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  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 FileIndex;
  53. int LineIndex;
  54. cmsys::RegularExpression RegularExpression;
  55. };
  56. struct cmCTestBuildErrorWarning
  57. {
  58. bool Error;
  59. int LogLine;
  60. std::string Text;
  61. std::string SourceFile;
  62. std::string SourceFileTail;
  63. int LineNumber;
  64. std::string PreContext;
  65. std::string PostContext;
  66. };
  67. // generate the XML output
  68. void GenerateDartBuildOutput(std::ostream& os,
  69. std::vector<cmCTestBuildErrorWarning>,
  70. double elapsed_time);
  71. std::string StartBuild;
  72. std::string EndBuild;
  73. double StartBuildTime;
  74. double EndBuildTime;
  75. std::vector<cmStdString> CustomErrorMatches;
  76. std::vector<cmStdString> CustomErrorExceptions;
  77. std::vector<cmStdString> CustomWarningMatches;
  78. std::vector<cmStdString> CustomWarningExceptions;
  79. std::vector<cmCTestCompileErrorWarningRex> ErrorWarningFileLineRegex;
  80. std::vector<cmsys::RegularExpression> ErrorMatchRegex;
  81. std::vector<cmsys::RegularExpression> ErrorExceptionRegex;
  82. std::vector<cmsys::RegularExpression> WarningMatchRegex;
  83. std::vector<cmsys::RegularExpression> WarningExceptionRegex;
  84. typedef std::deque<char> t_BuildProcessingQueueType;
  85. void ProcessBuffer(const char* data, int length, size_t& tick,
  86. size_t tick_len, std::ofstream& ofs, t_BuildProcessingQueueType* queue);
  87. int ProcessSingleLine(const char* data);
  88. t_BuildProcessingQueueType BuildProcessingQueue;
  89. t_BuildProcessingQueueType BuildProcessingErrorQueue;
  90. size_t BuildOutputLogSize;
  91. std::vector<char> CurrentProcessingLine;
  92. cmStdString SimplifySourceDir;
  93. cmStdString SimplifyBuildDir;
  94. size_t OutputLineCounter;
  95. typedef std::vector<cmCTestBuildErrorWarning> t_ErrorsAndWarningsVector;
  96. t_ErrorsAndWarningsVector ErrorsAndWarnings;
  97. t_ErrorsAndWarningsVector::iterator LastErrorOrWarning;
  98. size_t PostContextCount;
  99. size_t MaxPreContext;
  100. size_t MaxPostContext;
  101. std::deque<cmStdString> PreContext;
  102. int TotalErrors;
  103. int TotalWarnings;
  104. char LastTickChar;
  105. bool ErrorQuotaReached;
  106. bool WarningQuotaReached;
  107. int MaxErrors;
  108. int MaxWarnings;
  109. };
  110. #endif