2009-09-28 19:43:28 +04:00
|
|
|
/*============================================================================
|
|
|
|
CMake - Cross Platform Makefile Generator
|
|
|
|
Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
|
2009-02-11 19:31:25 +03:00
|
|
|
|
2009-09-28 19:43:28 +04:00
|
|
|
Distributed under the OSI-approved BSD License (the "License");
|
|
|
|
see accompanying file Copyright.txt for details.
|
2009-02-11 19:31:25 +03:00
|
|
|
|
2009-09-28 19:43:28 +04:00
|
|
|
This software is distributed WITHOUT ANY WARRANTY; without even the
|
|
|
|
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
See the License for more information.
|
|
|
|
============================================================================*/
|
2009-02-11 19:31:25 +03:00
|
|
|
#ifndef cmCTestLaunch_h
|
|
|
|
#define cmCTestLaunch_h
|
|
|
|
|
|
|
|
#include "cmStandardIncludes.h"
|
|
|
|
#include <cmsys/RegularExpression.hxx>
|
|
|
|
|
|
|
|
/** \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[]);
|
2009-02-11 19:31:25 +03:00
|
|
|
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;
|
2013-12-02 02:16:06 +04:00
|
|
|
std::string OptionFilterPrefix;
|
2009-02-11 19:31:25 +03:00
|
|
|
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<cmStdString> 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);
|
|
|
|
|
|
|
|
// Methods to generate the xml fragment.
|
|
|
|
void WriteXML();
|
|
|
|
void WriteXMLAction(std::ostream& fxml);
|
|
|
|
void WriteXMLCommand(std::ostream& fxml);
|
|
|
|
void WriteXMLResult(std::ostream& fxml);
|
|
|
|
void WriteXMLLabels(std::ostream& fxml);
|
|
|
|
void DumpFileToXML(std::ostream& fxml, std::string const& fname);
|
2009-02-12 21:00:22 +03:00
|
|
|
|
|
|
|
// Configuration
|
|
|
|
void LoadConfig();
|
|
|
|
std::string SourceDir;
|
2009-02-11 19:31:25 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|