Commit 7acfc4dc authored by Andy Cedilnik's avatar Andy Cedilnik
Browse files

ENH: Start adding support for CTest testfiles

parent eca18a2e
......@@ -798,14 +798,24 @@ std::string cmCTestTestHandler::FindTheExecutable(const char *exe)
//----------------------------------------------------------------------
void cmCTestTestHandler::GetListOfTests(tm_ListOfTests* testlist)
{
// does the DartTestfile.txt exist ?
if(!cmSystemTools::FileExists("DartTestfile.txt"))
const char* testFilename = 0;
if( cmSystemTools::FileExists("CTestTestfile.cmake") )
{
// does the CTestTestfile.cmake exist ?
testFilename = "CTestTestfile.cmake";
}
else if( cmSystemTools::FileExists("DartTestfile.txt") )
{
// does the DartTestfile.txt exist ?
testFilename = "DartTestfile.txt";
}
else
{
return;
}
// parse the file
std::ifstream fin("DartTestfile.txt");
std::ifstream fin(testFilename);
if(!fin)
{
return;
......@@ -815,7 +825,7 @@ void cmCTestTestHandler::GetListOfTests(tm_ListOfTests* testlist)
cmsys::RegularExpression ereg(this->m_ExcludeRegExp.c_str());
cmListFileCache cache;
cmListFile* listFile = cache.GetFileCache("DartTestfile.txt", false);
cmListFile* listFile = cache.GetFileCache(testFilename, false);
for(std::vector<cmListFileFunction>::const_iterator f =
listFile->m_Functions.begin(); f != listFile->m_Functions.end(); ++f)
{
......
......@@ -44,7 +44,14 @@ void cmAddTestCommand::FinalPass()
std::string fname;
fname = m_Makefile->GetStartOutputDirectory();
fname += "/";
fname += "DartTestfile.txt";
if ( m_Makefile->IsOn("DART_ROOT") )
{
fname += "DartTestfile.txt";
}
else
{
fname += "CTestTestfile.cmake";
}
// If the file doesn't exist, then ENABLE_TESTING hasn't been run
......
......@@ -234,6 +234,7 @@ cmCTest::cmCTest()
m_InteractiveDebugMode = true;
m_TimeOut = 0;
m_CompressXMLFiles = false;
m_CTestConfigFile = "";
int cc;
for ( cc=0; cc < cmCTest::LAST_TEST; cc ++ )
{
......@@ -370,7 +371,15 @@ int cmCTest::Initialize(const char* binary_dir)
bool cmCTest::UpdateCTestConfiguration()
{
std::string fileName = m_BinaryDir + "/DartConfiguration.tcl";
std::string fileName = m_CTestConfigFile;
if ( fileName.empty() )
{
fileName = m_BinaryDir + "/DartConfiguration.tcl";
if ( !cmSystemTools::FileExists(fileName.c_str()) )
{
fileName = m_BinaryDir + "/CTestConfiguration.tcl";
}
}
if ( !cmSystemTools::FileExists(fileName.c_str()) )
{
std::cerr << "Cannot find file: " << fileName.c_str() << std::endl;
......@@ -1221,6 +1230,12 @@ int cmCTest::Run(std::vector<std::string>const& args, std::string* output)
for(unsigned int i=1; i < args.size(); ++i)
{
std::string arg = args[i];
if(arg.find("--dart-config",0) == 0 && i < args.size() - 1)
{
i++;
this->m_CTestConfigFile= args[i];
}
if(arg.find("-C",0) == 0 && i < args.size() - 1)
{
i++;
......
......@@ -229,6 +229,7 @@ private:
//! Map of configuration properties
typedef std::map<cmStdString, cmStdString> tm_DartConfigurationMap;
std::string m_CTestConfigFile;
tm_DartConfigurationMap m_DartConfiguration;
int m_Tests[LAST_TEST];
......
......@@ -37,7 +37,14 @@ void cmEnableTestingCommand::CreateDartTestfileForMakefile(cmMakefile *mf)
std::string fname;
fname = mf->GetStartOutputDirectory();
fname += "/";
fname += "DartTestfile.txt";
if ( m_Makefile->IsOn("DART_ROOT") )
{
fname += "DartTestfile.txt";
}
else
{
fname += "CTestTestfile.cmake";
}
cmSystemTools::MakeDirectory(mf->GetStartOutputDirectory());
......
......@@ -138,6 +138,10 @@ static const cmDocumentationEntry cmDocumentationOptions[] =
{"--test-command", "The test to run with the --build-and-test option.", "" },
{"--tomorrow-tag", "Nightly or experimental starts with next day tag.",
"This is useful if the build will not finish in one day." },
{"--ctest-config", "The configuration file used to initialize CTest state when submitting dashboards.",
"This option tells CTest to use different initialization file instead of "
"DartConfiguration.tcl. This way multiple initialization files can be used "
"for example to submit to multiple dashboards." },
{0,0,0}
};
......@@ -166,7 +170,8 @@ int main (int argc, char *argv[])
// If there is a testing input file, check for documentation options
// only if there are actually arguments. We want running without
// arguments to run tests.
if(argc > 1 || !cmSystemTools::FileExists("DartTestfile.txt"))
if(argc > 1 || !cmSystemTools::FileExists("DartTestfile.txt") &&
!cmSystemTools::FileExists("CTestTestfile.cmake"))
{
if(argc == 1)
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment