Updated formatting of documentation plus a little reorganization.
[cmake.git] / Source / CTest / cmCTestBuildHandler.h
blob431698ca79d1814162d788ab676e6bc2d8185d5d
1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmCTestBuildHandler.h,v $
5 Language: C++
6 Date: $Date: 2009-02-11 20:18:08 $
7 Version: $Revision: 1.16 $
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 int GetTotalErrors() { return this->TotalErrors;}
53 int GetTotalWarnings() { return this->TotalWarnings;}
54 private:
55 //! Run command specialized for make and configure. Returns process status
56 // and retVal is return value or exception.
57 int RunMakeCommand(const char* command,
58 int* retVal, const char* dir, int timeout,
59 std::ofstream& ofs);
61 enum {
62 b_REGULAR_LINE,
63 b_WARNING_LINE,
64 b_ERROR_LINE
67 class cmCTestCompileErrorWarningRex
69 public:
70 cmCTestCompileErrorWarningRex() {}
71 int FileIndex;
72 int LineIndex;
73 cmsys::RegularExpression RegularExpression;
76 struct cmCTestBuildErrorWarning
78 bool Error;
79 int LogLine;
80 std::string Text;
81 std::string SourceFile;
82 std::string SourceFileTail;
83 int LineNumber;
84 std::string PreContext;
85 std::string PostContext;
88 // generate the XML output
89 void GenerateXMLHeader(std::ostream& os);
90 void GenerateXMLLaunched(std::ostream& os);
91 void GenerateXMLLogScraped(std::ostream& os);
92 void GenerateXMLFooter(std::ostream& os, double elapsed_build_time);
93 void GenerateXMLLaunchedFragment(std::ostream& os, const char* fname);
94 bool IsLaunchedErrorFile(const char* fname);
95 bool IsLaunchedWarningFile(const char* fname);
97 std::string StartBuild;
98 std::string EndBuild;
99 double StartBuildTime;
100 double EndBuildTime;
102 std::vector<cmStdString> CustomErrorMatches;
103 std::vector<cmStdString> CustomErrorExceptions;
104 std::vector<cmStdString> CustomWarningMatches;
105 std::vector<cmStdString> CustomWarningExceptions;
106 std::vector<std::string> ReallyCustomWarningMatches;
107 std::vector<std::string> ReallyCustomWarningExceptions;
108 std::vector<cmCTestCompileErrorWarningRex> ErrorWarningFileLineRegex;
110 std::vector<cmsys::RegularExpression> ErrorMatchRegex;
111 std::vector<cmsys::RegularExpression> ErrorExceptionRegex;
112 std::vector<cmsys::RegularExpression> WarningMatchRegex;
113 std::vector<cmsys::RegularExpression> WarningExceptionRegex;
115 typedef std::deque<char> t_BuildProcessingQueueType;
117 void ProcessBuffer(const char* data, int length, size_t& tick,
118 size_t tick_len, std::ofstream& ofs, t_BuildProcessingQueueType* queue);
119 int ProcessSingleLine(const char* data);
121 t_BuildProcessingQueueType BuildProcessingQueue;
122 t_BuildProcessingQueueType BuildProcessingErrorQueue;
123 size_t BuildOutputLogSize;
124 std::vector<char> CurrentProcessingLine;
126 cmStdString SimplifySourceDir;
127 cmStdString SimplifyBuildDir;
128 size_t OutputLineCounter;
129 typedef std::vector<cmCTestBuildErrorWarning> t_ErrorsAndWarningsVector;
130 t_ErrorsAndWarningsVector ErrorsAndWarnings;
131 t_ErrorsAndWarningsVector::iterator LastErrorOrWarning;
132 size_t PostContextCount;
133 size_t MaxPreContext;
134 size_t MaxPostContext;
135 std::deque<cmStdString> PreContext;
137 int TotalErrors;
138 int TotalWarnings;
139 char LastTickChar;
141 bool ErrorQuotaReached;
142 bool WarningQuotaReached;
144 int MaxErrors;
145 int MaxWarnings;
147 bool UseCTestLaunch;
148 std::string CTestLaunchDir;
149 class LaunchHelper;
150 friend class LaunchHelper;
151 class FragmentCompare;
154 #endif