CMake/Source/CTest/cmCTestLaunch.h

104 lines
2.9 KiB
C
Raw Normal View History

Simplify CMake per-source license notices Per-source copyright/license notice headers that spell out copyright holder names and years are hard to maintain and often out-of-date or plain wrong. Precise contributor information is already maintained automatically by the version control tool. Ultimately it is the receiver of a file who is responsible for determining its licensing status, and per-source notices are merely a convenience. Therefore it is simpler and more accurate for each source to have a generic notice of the license name and references to more detailed information on copyright holders and full license terms. Our `Copyright.txt` file now contains a list of Contributors whose names appeared source-level copyright notices. It also references version control history for more precise information. Therefore we no longer need to spell out the list of Contributors in each source file notice. Replace CMake per-source copyright/license notice headers with a short description of the license and links to `Copyright.txt` and online information available from "https://cmake.org/licensing". The online URL also handles cases of modules being copied out of our source into other projects, so we can drop our notices about replacing links with full license text. Run the `Utilities/Scripts/filter-notices.bash` script to perform the majority of the replacements mechanically. Manually fix up shebang lines and trailing newlines in a few files. Manually update the notices in a few files that the script does not handle.
2016-09-27 22:01:08 +03:00
/* 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 <cmsys/RegularExpression.hxx>
#include <set>
#include <string>
#include <vector>
2015-05-24 21:32:33 +03:00
class cmXMLWriter;
/** \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(). */
2011-03-20 16:22:39 +03:00
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();
// 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();
2015-05-24 21:32:33 +03:00
void WriteXMLAction(cmXMLWriter& xml);
void WriteXMLCommand(cmXMLWriter& xml);
void WriteXMLResult(cmXMLWriter& xml);
void WriteXMLLabels(cmXMLWriter& xml);
void DumpFileToXML(cmXMLWriter& xml, std::string const& fname);
// Configuration
void LoadConfig();
std::string SourceDir;
};
#endif