blob: 79a7712aa55b959805f311be8f6c672cf0f5f6c0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
|
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
#ifndef cmCTestLaunch_h
#define cmCTestLaunch_h
#include "cmConfigure.h" // IWYU pragma: keep
#include <set>
#include <string>
#include <vector>
#include "cmsys/RegularExpression.hxx"
class cmXMLElement;
/** \class cmCTestLaunch
* \brief Launcher for make rules to report results for ctest
*
* This implements the 'ctest --launch' tool.
*/
class cmCTestLaunch
{
public:
/** Entry point from ctest executable main(). */
static int Main(int argc, const char* const argv[]);
private:
// Initialize the launcher from its command line.
cmCTestLaunch(int argc, const char* const* argv);
~cmCTestLaunch();
cmCTestLaunch(const cmCTestLaunch&) = delete;
cmCTestLaunch& operator=(const cmCTestLaunch&) = delete;
// Run the real command.
int Run();
void RunChild();
// Methods to check the result of the real command.
bool IsError() const;
bool CheckResults();
// Launcher options specified before the real command.
std::string OptionOutput;
std::string OptionSource;
std::string OptionLanguage;
std::string OptionTargetName;
std::string OptionTargetType;
std::string OptionBuildDir;
std::string OptionFilterPrefix;
bool ParseArguments(int argc, const char* const* argv);
// The real command line appearing after launcher arguments.
int RealArgC;
const char* const* RealArgV;
std::string CWD;
// The real command line after response file expansion.
std::vector<std::string> RealArgs;
void HandleRealArg(const char* arg);
// A hash of the real command line is unique and unlikely to collide.
std::string LogHash;
void ComputeFileNames();
bool Passthru;
struct cmsysProcess_s* Process;
int ExitCode;
// Temporary log files for stdout and stderr of real command.
std::string LogDir;
std::string LogOut;
std::string LogErr;
bool HaveOut;
bool HaveErr;
// Labels associated with the build rule.
std::set<std::string> Labels;
void LoadLabels();
bool SourceMatches(std::string const& lhs, std::string const& rhs);
// Regular expressions to match warnings and their exceptions.
bool ScrapeRulesLoaded;
std::vector<cmsys::RegularExpression> RegexWarning;
std::vector<cmsys::RegularExpression> RegexWarningSuppress;
void LoadScrapeRules();
void LoadScrapeRules(const char* purpose,
std::vector<cmsys::RegularExpression>& regexps);
bool ScrapeLog(std::string const& fname);
bool Match(std::string const& line,
std::vector<cmsys::RegularExpression>& regexps);
bool MatchesFilterPrefix(std::string const& line) const;
// Methods to generate the xml fragment.
void WriteXML();
void WriteXMLAction(cmXMLElement&);
void WriteXMLCommand(cmXMLElement&);
void WriteXMLResult(cmXMLElement&);
void WriteXMLLabels(cmXMLElement&);
void DumpFileToXML(cmXMLElement&, const char* tag, std::string const& fname);
// Configuration
void LoadConfig();
std::string SourceDir;
};
#endif
|