Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Kitware
GitHub Repository: Kitware/CMake
Path: blob/master/Source/CTest/cmCTestLaunchReporter.h
5000 views
1
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
2
file LICENSE.rst or https://cmake.org/licensing for details. */
3
#pragma once
4
5
#include "cmConfigure.h" // IWYU pragma: keep
6
7
#include <set>
8
#include <string>
9
#include <vector>
10
11
#include "cmUVProcessChain.h"
12
13
namespace cmsys {
14
class RegularExpression;
15
}
16
17
class cmXMLElement;
18
19
/** \class cmCTestLaunchReporter
20
* \brief Generate CTest XML output for the 'ctest --launch' tool.
21
*/
22
class cmCTestLaunchReporter
23
{
24
public:
25
// Initialize the launcher from its command line.
26
cmCTestLaunchReporter();
27
~cmCTestLaunchReporter();
28
29
cmCTestLaunchReporter(cmCTestLaunchReporter const&) = delete;
30
cmCTestLaunchReporter& operator=(cmCTestLaunchReporter const&) = delete;
31
32
// Methods to check the result of the real command.
33
bool IsError() const;
34
35
// Launcher options specified before the real command.
36
std::string OptionOutput;
37
std::string OptionSource;
38
std::string OptionLanguage;
39
std::string OptionTargetLabels;
40
std::string OptionTargetName;
41
std::string OptionTargetType;
42
std::string OptionCurrentBuildDir;
43
std::string OptionBuildDir;
44
std::string OptionFilterPrefix;
45
std::string OptionCommandType;
46
std::string OptionRole;
47
std::string OptionConfig;
48
std::string OptionObjectDir;
49
50
// The real command line appearing after launcher arguments.
51
std::string CWD;
52
53
// The real command line after response file expansion.
54
std::vector<std::string> RealArgs;
55
56
// A hash of the real command line is unique and unlikely to collide.
57
std::string LogHash;
58
void ComputeFileNames();
59
60
bool Passthru;
61
cmUVProcessChain::Status Status;
62
int ExitCode;
63
64
// Temporary log files for stdout and stderr of real command.
65
std::string LogDir;
66
std::string LogOut;
67
std::string LogErr;
68
69
// Labels associated with the build rule.
70
std::set<std::string> Labels;
71
void LoadLabels();
72
bool SourceMatches(std::string const& lhs, std::string const& rhs);
73
74
// Regular expressions to match warnings and their exceptions.
75
std::vector<cmsys::RegularExpression> RegexWarning;
76
std::vector<cmsys::RegularExpression> RegexWarningSuppress;
77
bool Match(std::string const& line,
78
std::vector<cmsys::RegularExpression>& regexps);
79
bool MatchesFilterPrefix(std::string const& line) const;
80
81
// Methods to generate the xml fragment.
82
void WriteXML();
83
void WriteXMLAction(cmXMLElement&) const;
84
void WriteXMLCommand(cmXMLElement&);
85
void WriteXMLResult(cmXMLElement&);
86
void WriteXMLLabels(cmXMLElement&);
87
void DumpFileToXML(cmXMLElement&, char const* tag, std::string const& fname);
88
89
// Configuration
90
std::string SourceDir;
91
};
92
93