ENH: Report file names relative to source dir
This teaches cmCTestLaunch to report source files that lie under the top source directory relative to the top.
This commit is contained in:
parent
4f369610f5
commit
7435355ec8
|
@ -752,7 +752,7 @@ private:
|
|||
cmCTestBuildHandler* Handler;
|
||||
cmCTest* CTest;
|
||||
|
||||
void WriteScrapeMatchers();
|
||||
void WriteLauncherConfig();
|
||||
void WriteScrapeMatchers(const char* purpose,
|
||||
std::vector<std::string> const& matchers);
|
||||
};
|
||||
|
@ -784,7 +784,7 @@ cmCTestBuildHandler::LaunchHelper::LaunchHelper(cmCTestBuildHandler* handler):
|
|||
{
|
||||
// Enable launcher fragments.
|
||||
cmSystemTools::MakeDirectory(launchDir.c_str());
|
||||
this->WriteScrapeMatchers();
|
||||
this->WriteLauncherConfig();
|
||||
std::string launchEnv = "CTEST_LAUNCH_LOGS=";
|
||||
launchEnv += launchDir;
|
||||
cmSystemTools::PutEnv(launchEnv.c_str());
|
||||
|
@ -808,12 +808,19 @@ cmCTestBuildHandler::LaunchHelper::~LaunchHelper()
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void cmCTestBuildHandler::LaunchHelper::WriteScrapeMatchers()
|
||||
void cmCTestBuildHandler::LaunchHelper::WriteLauncherConfig()
|
||||
{
|
||||
this->WriteScrapeMatchers("Warning",
|
||||
this->Handler->ReallyCustomWarningMatches);
|
||||
this->WriteScrapeMatchers("WarningSuppress",
|
||||
this->Handler->ReallyCustomWarningExceptions);
|
||||
|
||||
// Give some testing configuration information to the launcher.
|
||||
std::string fname = this->Handler->CTestLaunchDir;
|
||||
fname += "/CTestLaunchConfig.cmake";
|
||||
cmGeneratedFileStream fout(fname.c_str());
|
||||
std::string srcdir = this->CTest->GetCTestConfiguration("SourceDirectory");
|
||||
fout << "set(CTEST_SOURCE_DIRECTORY \"" << srcdir << "\")\n";
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
|
|
@ -292,6 +292,7 @@ int cmCTestLaunch::Run()
|
|||
return this->ExitCode;
|
||||
}
|
||||
|
||||
this->LoadConfig();
|
||||
this->WriteXML();
|
||||
|
||||
return this->ExitCode;
|
||||
|
@ -414,8 +415,21 @@ void cmCTestLaunch::WriteXMLAction(std::ostream& fxml)
|
|||
// SourceFile
|
||||
if(!this->OptionSource.empty())
|
||||
{
|
||||
std::string source = this->OptionSource;
|
||||
cmSystemTools::ConvertToUnixSlashes(source);
|
||||
|
||||
// If file is in source tree use its relative location.
|
||||
if(cmSystemTools::FileIsFullPath(this->SourceDir.c_str()) &&
|
||||
cmSystemTools::FileIsFullPath(source.c_str()) &&
|
||||
cmSystemTools::IsSubDirectory(source.c_str(),
|
||||
this->SourceDir.c_str()))
|
||||
{
|
||||
source = cmSystemTools::RelativePath(this->SourceDir.c_str(),
|
||||
source.c_str());
|
||||
}
|
||||
|
||||
fxml << "\t\t\t<SourceFile>"
|
||||
<< cmXMLSafe(this->OptionSource)
|
||||
<< cmXMLSafe(source)
|
||||
<< "</SourceFile>\n";
|
||||
}
|
||||
|
||||
|
@ -678,3 +692,26 @@ int cmCTestLaunch::Main(int argc, const char* const argv[])
|
|||
cmCTestLaunch self(argc, argv);
|
||||
return self.Run();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
#include "cmGlobalGenerator.h"
|
||||
#include "cmLocalGenerator.h"
|
||||
#include "cmMakefile.h"
|
||||
#include "cmake.h"
|
||||
#include <cmsys/auto_ptr.hxx>
|
||||
void cmCTestLaunch::LoadConfig()
|
||||
{
|
||||
cmake cm;
|
||||
cmGlobalGenerator gg;
|
||||
gg.SetCMakeInstance(&cm);
|
||||
cmsys::auto_ptr<cmLocalGenerator> lg(gg.CreateLocalGenerator());
|
||||
cmMakefile* mf = lg->GetMakefile();
|
||||
std::string fname = this->LogDir;
|
||||
fname += "CTestLaunchConfig.cmake";
|
||||
if(cmSystemTools::FileExists(fname.c_str()) &&
|
||||
mf->ReadListFile(0, fname.c_str()))
|
||||
{
|
||||
this->SourceDir = mf->GetSafeDefinition("CTEST_SOURCE_DIRECTORY");
|
||||
cmSystemTools::ConvertToUnixSlashes(this->SourceDir);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -100,6 +100,10 @@ private:
|
|||
void WriteXMLResult(std::ostream& fxml);
|
||||
void WriteXMLLabels(std::ostream& fxml);
|
||||
void DumpFileToXML(std::ostream& fxml, std::string const& fname);
|
||||
|
||||
// Configuration
|
||||
void LoadConfig();
|
||||
std::string SourceDir;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue