ENH: keep cleaning up Tcl/Tk modules
[cmake.git] / Source / CTest / cmCTestBuildHandler.h
bloba79df1f53e986dca3a8c417cfdc7ba83c154da58
1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmCTestBuildHandler.h,v $
5 Language: C++
6 Date: $Date: 2006-03-10 20:03:08 $
7 Version: $Revision: 1.12 $
9 Copyright (c) 2002 Kitware, Inc. All rights reserved.
10 See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
12 This software is distributed WITHOUT ANY WARRANTY; without even
13 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 PURPOSE. See the above copyright notices for more information.
16 =========================================================================*/
18 #ifndef cmCTestBuildHandler_h
19 #define cmCTestBuildHandler_h
22 #include "cmCTestGenericHandler.h"
23 #include "cmListFileCache.h"
25 #include <cmsys/RegularExpression.hxx>
27 class cmMakefile;
29 /** \class cmCTestBuildHandler
30 * \brief A class that handles ctest -S invocations
33 class cmCTestBuildHandler : public cmCTestGenericHandler
35 public:
36 cmTypeMacro(cmCTestBuildHandler, cmCTestGenericHandler);
39 * The main entry point for this class
41 int ProcessHandler();
43 cmCTestBuildHandler();
45 void PopulateCustomVectors(cmMakefile *mf);
47 /**
48 * Initialize handler
50 virtual void Initialize();
52 private:
53 //! Run command specialized for make and configure. Returns process status
54 // and retVal is return value or exception.
55 int RunMakeCommand(const char* command,
56 int* retVal, const char* dir, int timeout,
57 std::ofstream& ofs);
59 enum {
60 b_REGULAR_LINE,
61 b_WARNING_LINE,
62 b_ERROR_LINE
65 class cmCTestCompileErrorWarningRex
67 public:
68 cmCTestCompileErrorWarningRex() {}
69 int FileIndex;
70 int LineIndex;
71 cmsys::RegularExpression RegularExpression;
74 struct cmCTestBuildErrorWarning
76 bool Error;
77 int LogLine;
78 std::string Text;
79 std::string SourceFile;
80 std::string SourceFileTail;
81 int LineNumber;
82 std::string PreContext;
83 std::string PostContext;
86 // generate the XML output
87 void GenerateDartBuildOutput(std::ostream& os,
88 std::vector<cmCTestBuildErrorWarning>,
89 double elapsed_time);
92 std::string StartBuild;
93 std::string EndBuild;
95 std::vector<cmStdString> CustomErrorMatches;
96 std::vector<cmStdString> CustomErrorExceptions;
97 std::vector<cmStdString> CustomWarningMatches;
98 std::vector<cmStdString> CustomWarningExceptions;
99 std::vector<cmCTestCompileErrorWarningRex> ErrorWarningFileLineRegex;
101 std::vector<cmsys::RegularExpression> ErrorMatchRegex;
102 std::vector<cmsys::RegularExpression> ErrorExceptionRegex;
103 std::vector<cmsys::RegularExpression> WarningMatchRegex;
104 std::vector<cmsys::RegularExpression> WarningExceptionRegex;
106 typedef std::deque<char> t_BuildProcessingQueueType;
108 void ProcessBuffer(const char* data, int length, size_t& tick,
109 size_t tick_len, std::ofstream& ofs, t_BuildProcessingQueueType* queue);
110 int ProcessSingleLine(const char* data);
112 t_BuildProcessingQueueType BuildProcessingQueue;
113 t_BuildProcessingQueueType BuildProcessingErrorQueue;
114 size_t BuildOutputLogSize;
115 std::vector<char> CurrentProcessingLine;
117 cmStdString SimplifySourceDir;
118 cmStdString SimplifyBuildDir;
119 size_t OutputLineCounter;
120 typedef std::vector<cmCTestBuildErrorWarning> t_ErrorsAndWarningsVector;
121 t_ErrorsAndWarningsVector ErrorsAndWarnings;
122 t_ErrorsAndWarningsVector::iterator LastErrorOrWarning;
123 size_t PostContextCount;
124 size_t MaxPreContext;
125 size_t MaxPostContext;
126 std::deque<cmStdString> PreContext;
128 int TotalErrors;
129 int TotalWarnings;
130 char LastTickChar;
132 bool ErrorQuotaReached;
133 bool WarningQuotaReached;
135 int MaxErrors;
136 int MaxWarnings;
139 #endif