1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmCTestBuildHandler.h,v $
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>
29 /** \class cmCTestBuildHandler
30 * \brief A class that handles ctest -S invocations
33 class cmCTestBuildHandler
: public cmCTestGenericHandler
36 cmTypeMacro(cmCTestBuildHandler
, cmCTestGenericHandler
);
39 * The main entry point for this class
43 cmCTestBuildHandler();
45 void PopulateCustomVectors(cmMakefile
*mf
);
50 virtual void Initialize();
52 int GetTotalErrors() { return this->TotalErrors
;}
53 int GetTotalWarnings() { return this->TotalWarnings
;}
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
,
67 class cmCTestCompileErrorWarningRex
70 cmCTestCompileErrorWarningRex() {}
73 cmsys::RegularExpression RegularExpression
;
76 struct cmCTestBuildErrorWarning
81 std::string SourceFile
;
82 std::string SourceFileTail
;
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
;
99 double StartBuildTime
;
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
;
141 bool ErrorQuotaReached
;
142 bool WarningQuotaReached
;
148 std::string CTestLaunchDir
;
150 friend class LaunchHelper
;
151 class FragmentCompare
;