2009-09-28 19:43:28 +04:00
|
|
|
/*============================================================================
|
|
|
|
CMake - Cross Platform Makefile Generator
|
|
|
|
Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
|
2004-09-09 16:41:05 +04: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.
|
2004-09-09 16:41:05 +04: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.
|
|
|
|
============================================================================*/
|
2004-09-09 16:41:05 +04:00
|
|
|
|
|
|
|
#include "cmCTestTestHandler.h"
|
2008-07-03 17:31:33 +04:00
|
|
|
#include "cmCTestMultiProcessHandler.h"
|
2009-09-10 19:16:08 +04:00
|
|
|
#include "cmCTestBatchTestHandler.h"
|
2004-09-09 16:41:05 +04:00
|
|
|
#include "cmCTest.h"
|
2009-08-19 16:58:36 +04:00
|
|
|
#include "cmCTestRunTest.h"
|
2004-09-09 16:41:05 +04:00
|
|
|
#include "cmake.h"
|
2005-01-27 18:15:01 +03:00
|
|
|
#include "cmGeneratedFileStream.h"
|
2004-09-09 16:41:05 +04:00
|
|
|
#include <cmsys/Process.h>
|
|
|
|
#include <cmsys/RegularExpression.hxx>
|
|
|
|
#include <cmsys/Base64.h>
|
2013-09-24 22:20:38 +04:00
|
|
|
#include <cmsys/Directory.hxx>
|
2014-01-04 09:47:13 +04:00
|
|
|
#include <cmsys/FStream.hxx>
|
2004-09-09 16:41:05 +04:00
|
|
|
#include "cmMakefile.h"
|
2005-06-07 17:06:38 +04:00
|
|
|
#include "cmGlobalGenerator.h"
|
|
|
|
#include "cmLocalGenerator.h"
|
|
|
|
#include "cmCommand.h"
|
2005-09-07 07:31:41 +04:00
|
|
|
#include "cmSystemTools.h"
|
2009-02-06 00:31:37 +03:00
|
|
|
#include "cmXMLSafe.h"
|
2011-01-04 21:20:49 +03:00
|
|
|
#include "cm_utf8.h"
|
2004-09-09 16:41:05 +04:00
|
|
|
|
2006-03-09 19:17:10 +03:00
|
|
|
#include <stdlib.h>
|
2004-09-09 18:52:51 +04:00
|
|
|
#include <math.h>
|
|
|
|
#include <float.h>
|
|
|
|
|
2011-08-03 18:24:59 +04:00
|
|
|
#include <set>
|
2005-06-07 17:06:38 +04:00
|
|
|
|
2008-01-19 23:09:36 +03:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
class cmCTestSubdirCommand : public cmCommand
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
* This is a virtual constructor for the command.
|
|
|
|
*/
|
|
|
|
virtual cmCommand* Clone()
|
|
|
|
{
|
|
|
|
cmCTestSubdirCommand* c = new cmCTestSubdirCommand;
|
|
|
|
c->TestHandler = this->TestHandler;
|
|
|
|
return c;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This is called when the command is first encountered in
|
|
|
|
* the CMakeLists.txt file.
|
|
|
|
*/
|
2008-01-23 18:28:26 +03:00
|
|
|
virtual bool InitialPass(std::vector<std::string> const& args,
|
|
|
|
cmExecutionStatus &);
|
2008-01-19 23:09:36 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The name of the command as specified in CMakeList.txt.
|
|
|
|
*/
|
2014-02-25 05:19:17 +04:00
|
|
|
virtual std::string GetName() const { return "subdirs";}
|
2008-01-19 23:09:36 +03:00
|
|
|
|
|
|
|
cmTypeMacro(cmCTestSubdirCommand, cmCommand);
|
|
|
|
|
|
|
|
cmCTestTestHandler* TestHandler;
|
|
|
|
};
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2008-01-23 18:28:26 +03:00
|
|
|
bool cmCTestSubdirCommand
|
|
|
|
::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &)
|
2008-01-19 23:09:36 +03:00
|
|
|
{
|
|
|
|
if(args.size() < 1 )
|
|
|
|
{
|
|
|
|
this->SetError("called with incorrect number of arguments");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
std::vector<std::string>::const_iterator it;
|
|
|
|
std::string cwd = cmSystemTools::GetCurrentWorkingDirectory();
|
|
|
|
for ( it = args.begin(); it != args.end(); ++ it )
|
|
|
|
{
|
2009-11-10 18:40:24 +03:00
|
|
|
std::string fname;
|
2008-01-19 23:09:36 +03:00
|
|
|
|
2009-11-10 18:40:24 +03:00
|
|
|
if(cmSystemTools::FileIsFullPath(it->c_str()))
|
2009-11-09 22:07:36 +03:00
|
|
|
{
|
|
|
|
fname = *it;
|
|
|
|
}
|
2009-11-10 18:40:24 +03:00
|
|
|
else
|
|
|
|
{
|
|
|
|
fname = cwd;
|
|
|
|
fname += "/";
|
|
|
|
fname += *it;
|
|
|
|
}
|
2009-11-09 22:07:36 +03:00
|
|
|
|
2014-10-15 16:54:05 +04:00
|
|
|
if ( !cmSystemTools::FileIsDirectory(fname) )
|
2008-01-19 23:09:36 +03:00
|
|
|
{
|
|
|
|
// No subdirectory? So what...
|
|
|
|
continue;
|
|
|
|
}
|
2014-10-15 16:54:05 +04:00
|
|
|
cmSystemTools::ChangeDirectory(fname);
|
2008-01-19 23:09:36 +03:00
|
|
|
const char* testFilename;
|
|
|
|
if( cmSystemTools::FileExists("CTestTestfile.cmake") )
|
|
|
|
{
|
|
|
|
// does the CTestTestfile.cmake exist ?
|
|
|
|
testFilename = "CTestTestfile.cmake";
|
|
|
|
}
|
2011-03-11 16:04:58 +03:00
|
|
|
else if( cmSystemTools::FileExists("DartTestfile.txt") )
|
2008-01-31 19:43:44 +03:00
|
|
|
{
|
|
|
|
// does the DartTestfile.txt exist ?
|
|
|
|
testFilename = "DartTestfile.txt";
|
|
|
|
}
|
2008-01-19 23:09:36 +03:00
|
|
|
else
|
|
|
|
{
|
|
|
|
// No CTestTestfile? Who cares...
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
fname += "/";
|
|
|
|
fname += testFilename;
|
2011-03-11 16:04:58 +03:00
|
|
|
bool readit =
|
2008-01-19 23:09:36 +03:00
|
|
|
this->Makefile->ReadListFile(this->Makefile->GetCurrentListFile(),
|
|
|
|
fname.c_str());
|
2014-10-15 16:54:05 +04:00
|
|
|
cmSystemTools::ChangeDirectory(cwd);
|
2008-01-19 23:09:36 +03:00
|
|
|
if(!readit)
|
|
|
|
{
|
|
|
|
std::string m = "Could not find include file: ";
|
|
|
|
m += fname;
|
2014-03-11 03:04:11 +04:00
|
|
|
this->SetError(m);
|
2008-01-19 23:09:36 +03:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
2014-10-15 16:54:05 +04:00
|
|
|
cmSystemTools::ChangeDirectory(cwd);
|
2008-01-19 23:09:36 +03:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2005-06-07 17:06:38 +04:00
|
|
|
//----------------------------------------------------------------------
|
2008-01-18 18:25:25 +03:00
|
|
|
class cmCTestAddSubdirectoryCommand : public cmCommand
|
2005-06-07 17:06:38 +04:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
* This is a virtual constructor for the command.
|
|
|
|
*/
|
2006-03-09 19:17:10 +03:00
|
|
|
virtual cmCommand* Clone()
|
2005-06-07 17:06:38 +04:00
|
|
|
{
|
2008-01-18 18:25:25 +03:00
|
|
|
cmCTestAddSubdirectoryCommand* c = new cmCTestAddSubdirectoryCommand;
|
2006-03-10 23:03:09 +03:00
|
|
|
c->TestHandler = this->TestHandler;
|
2005-06-07 17:06:38 +04:00
|
|
|
return c;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This is called when the command is first encountered in
|
|
|
|
* the CMakeLists.txt file.
|
|
|
|
*/
|
2008-01-23 18:28:26 +03:00
|
|
|
virtual bool InitialPass(std::vector<std::string> const& args,
|
|
|
|
cmExecutionStatus &);
|
2005-06-07 17:06:38 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The name of the command as specified in CMakeList.txt.
|
|
|
|
*/
|
2014-02-25 05:19:17 +04:00
|
|
|
virtual std::string GetName() const { return "add_subdirectory";}
|
2005-06-07 17:06:38 +04:00
|
|
|
|
2008-01-18 18:25:25 +03:00
|
|
|
cmTypeMacro(cmCTestAddSubdirectoryCommand, cmCommand);
|
2005-06-07 17:06:38 +04:00
|
|
|
|
2006-03-10 23:03:09 +03:00
|
|
|
cmCTestTestHandler* TestHandler;
|
2005-06-07 17:06:38 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2008-01-18 18:25:25 +03:00
|
|
|
bool cmCTestAddSubdirectoryCommand
|
2008-01-23 18:28:26 +03:00
|
|
|
::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &)
|
2005-06-07 17:06:38 +04:00
|
|
|
{
|
|
|
|
if(args.size() < 1 )
|
|
|
|
{
|
|
|
|
this->SetError("called with incorrect number of arguments");
|
|
|
|
return false;
|
|
|
|
}
|
2008-01-18 18:25:25 +03:00
|
|
|
|
2006-03-09 19:17:10 +03:00
|
|
|
std::string cwd = cmSystemTools::GetCurrentWorkingDirectory();
|
2014-10-15 16:54:05 +04:00
|
|
|
cmSystemTools::ChangeDirectory(cwd);
|
2008-01-18 18:25:25 +03:00
|
|
|
std::string fname = cwd;
|
|
|
|
fname += "/";
|
|
|
|
fname += args[1];
|
2006-03-09 19:17:10 +03:00
|
|
|
|
2008-01-18 18:25:25 +03:00
|
|
|
if ( !cmSystemTools::FileExists(fname.c_str()) )
|
|
|
|
{
|
|
|
|
// No subdirectory? So what...
|
|
|
|
return true;
|
|
|
|
}
|
2014-10-15 16:54:05 +04:00
|
|
|
cmSystemTools::ChangeDirectory(fname);
|
2008-01-18 18:25:25 +03:00
|
|
|
const char* testFilename;
|
|
|
|
if( cmSystemTools::FileExists("CTestTestfile.cmake") )
|
|
|
|
{
|
|
|
|
// does the CTestTestfile.cmake exist ?
|
|
|
|
testFilename = "CTestTestfile.cmake";
|
|
|
|
}
|
2008-01-31 19:43:44 +03:00
|
|
|
else if( cmSystemTools::FileExists("DartTestfile.txt") )
|
|
|
|
{
|
|
|
|
// does the DartTestfile.txt exist ?
|
|
|
|
testFilename = "DartTestfile.txt";
|
|
|
|
}
|
2008-01-18 18:25:25 +03:00
|
|
|
else
|
|
|
|
{
|
|
|
|
// No CTestTestfile? Who cares...
|
2014-10-15 16:54:05 +04:00
|
|
|
cmSystemTools::ChangeDirectory(cwd);
|
2008-01-18 18:25:25 +03:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
fname += "/";
|
|
|
|
fname += testFilename;
|
2011-03-11 16:04:58 +03:00
|
|
|
bool readit =
|
2008-01-18 18:25:25 +03:00
|
|
|
this->Makefile->ReadListFile(this->Makefile->GetCurrentListFile(),
|
|
|
|
fname.c_str());
|
2014-10-15 16:54:05 +04:00
|
|
|
cmSystemTools::ChangeDirectory(cwd);
|
2008-01-18 18:25:25 +03:00
|
|
|
if(!readit)
|
|
|
|
{
|
|
|
|
std::string m = "Could not find include file: ";
|
|
|
|
m += fname;
|
2014-03-11 03:04:11 +04:00
|
|
|
this->SetError(m);
|
2008-01-18 18:25:25 +03:00
|
|
|
return false;
|
2005-06-07 17:06:38 +04:00
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
class cmCTestAddTestCommand : public cmCommand
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
* This is a virtual constructor for the command.
|
|
|
|
*/
|
2006-03-09 19:17:10 +03:00
|
|
|
virtual cmCommand* Clone()
|
2005-06-07 17:06:38 +04:00
|
|
|
{
|
|
|
|
cmCTestAddTestCommand* c = new cmCTestAddTestCommand;
|
2006-03-10 23:03:09 +03:00
|
|
|
c->TestHandler = this->TestHandler;
|
2005-06-07 17:06:38 +04:00
|
|
|
return c;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This is called when the command is first encountered in
|
|
|
|
* the CMakeLists.txt file.
|
|
|
|
*/
|
2008-01-23 18:28:26 +03:00
|
|
|
virtual bool InitialPass(std::vector<std::string> const&,
|
|
|
|
cmExecutionStatus &);
|
2005-06-07 17:06:38 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The name of the command as specified in CMakeList.txt.
|
|
|
|
*/
|
2014-02-25 05:19:17 +04:00
|
|
|
virtual std::string GetName() const { return "add_test";}
|
2005-06-07 17:06:38 +04:00
|
|
|
|
|
|
|
cmTypeMacro(cmCTestAddTestCommand, cmCommand);
|
|
|
|
|
2006-03-10 23:03:09 +03:00
|
|
|
cmCTestTestHandler* TestHandler;
|
2005-06-07 17:06:38 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2008-01-23 18:28:26 +03:00
|
|
|
bool cmCTestAddTestCommand
|
|
|
|
::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &)
|
2005-06-07 17:06:38 +04:00
|
|
|
{
|
|
|
|
if ( args.size() < 2 )
|
|
|
|
{
|
|
|
|
this->SetError("called with incorrect number of arguments");
|
|
|
|
return false;
|
|
|
|
}
|
2009-12-10 23:37:04 +03:00
|
|
|
return this->TestHandler->AddTest(args);
|
2005-06-07 17:06:38 +04:00
|
|
|
}
|
|
|
|
|
2005-09-07 07:31:41 +04:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
class cmCTestSetTestsPropertiesCommand : public cmCommand
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
* This is a virtual constructor for the command.
|
|
|
|
*/
|
2006-03-09 19:17:10 +03:00
|
|
|
virtual cmCommand* Clone()
|
2005-09-07 07:31:41 +04:00
|
|
|
{
|
2006-03-09 19:17:10 +03:00
|
|
|
cmCTestSetTestsPropertiesCommand* c
|
|
|
|
= new cmCTestSetTestsPropertiesCommand;
|
2006-03-10 23:03:09 +03:00
|
|
|
c->TestHandler = this->TestHandler;
|
2005-09-07 07:31:41 +04:00
|
|
|
return c;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This is called when the command is first encountered in
|
|
|
|
* the CMakeLists.txt file.
|
2008-01-23 18:28:26 +03:00
|
|
|
*/
|
|
|
|
virtual bool InitialPass(std::vector<std::string> const&,
|
|
|
|
cmExecutionStatus &);
|
2005-09-07 07:31:41 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The name of the command as specified in CMakeList.txt.
|
|
|
|
*/
|
2014-02-25 05:19:17 +04:00
|
|
|
virtual std::string GetName() const { return "set_tests_properties";}
|
2005-09-07 07:31:41 +04:00
|
|
|
|
|
|
|
cmTypeMacro(cmCTestSetTestsPropertiesCommand, cmCommand);
|
|
|
|
|
2006-03-10 23:03:09 +03:00
|
|
|
cmCTestTestHandler* TestHandler;
|
2005-09-07 07:31:41 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2008-01-23 18:28:26 +03:00
|
|
|
bool cmCTestSetTestsPropertiesCommand
|
|
|
|
::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &)
|
2005-09-07 07:31:41 +04:00
|
|
|
{
|
2006-03-10 23:03:09 +03:00
|
|
|
return this->TestHandler->SetTestsProperties(args);
|
2005-09-07 07:31:41 +04:00
|
|
|
}
|
|
|
|
|
2005-01-27 23:54:47 +03:00
|
|
|
//----------------------------------------------------------------------
|
2004-09-09 16:41:05 +04:00
|
|
|
// get the next number in a string with numbers separated by ,
|
|
|
|
// pos is the start of the search and pos2 is the end of the search
|
2006-03-09 19:17:10 +03:00
|
|
|
// pos becomes pos2 after a call to GetNextNumber.
|
2004-09-09 16:41:05 +04:00
|
|
|
// -1 is returned at the end of the list.
|
2006-03-09 19:17:10 +03:00
|
|
|
inline int GetNextNumber(std::string const& in,
|
2004-09-09 16:41:05 +04:00
|
|
|
int& val,
|
|
|
|
std::string::size_type& pos,
|
|
|
|
std::string::size_type& pos2)
|
|
|
|
{
|
|
|
|
pos2 = in.find(',', pos);
|
|
|
|
if(pos2 != in.npos)
|
|
|
|
{
|
|
|
|
if(pos2-pos == 0)
|
|
|
|
{
|
|
|
|
val = -1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
val = atoi(in.substr(pos, pos2-pos).c_str());
|
|
|
|
}
|
|
|
|
pos = pos2+1;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if(in.size()-pos == 0)
|
|
|
|
{
|
|
|
|
val = -1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
val = atoi(in.substr(pos, in.size()-pos).c_str());
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-01-27 23:54:47 +03:00
|
|
|
//----------------------------------------------------------------------
|
2004-09-09 16:41:05 +04:00
|
|
|
// get the next number in a string with numbers separated by ,
|
|
|
|
// pos is the start of the search and pos2 is the end of the search
|
2006-03-09 19:17:10 +03:00
|
|
|
// pos becomes pos2 after a call to GetNextNumber.
|
2004-09-09 16:41:05 +04:00
|
|
|
// -1 is returned at the end of the list.
|
2006-03-09 19:17:10 +03:00
|
|
|
inline int GetNextRealNumber(std::string const& in,
|
2004-09-09 16:41:05 +04:00
|
|
|
double& val,
|
|
|
|
std::string::size_type& pos,
|
|
|
|
std::string::size_type& pos2)
|
|
|
|
{
|
|
|
|
pos2 = in.find(',', pos);
|
|
|
|
if(pos2 != in.npos)
|
|
|
|
{
|
|
|
|
if(pos2-pos == 0)
|
|
|
|
{
|
|
|
|
val = -1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
val = atof(in.substr(pos, pos2-pos).c_str());
|
|
|
|
}
|
|
|
|
pos = pos2+1;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if(in.size()-pos == 0)
|
|
|
|
{
|
|
|
|
val = -1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
val = atof(in.substr(pos, in.size()-pos).c_str());
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-03-09 19:17:10 +03:00
|
|
|
|
2004-09-09 16:41:05 +04:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
cmCTestTestHandler::cmCTestTestHandler()
|
|
|
|
{
|
2006-03-10 23:03:09 +03:00
|
|
|
this->UseUnion = false;
|
2006-03-09 19:17:10 +03:00
|
|
|
|
2009-02-10 22:24:24 +03:00
|
|
|
this->UseIncludeLabelRegExpFlag = false;
|
|
|
|
this->UseExcludeLabelRegExpFlag = false;
|
2006-03-10 23:03:09 +03:00
|
|
|
this->UseIncludeRegExpFlag = false;
|
|
|
|
this->UseExcludeRegExpFlag = false;
|
|
|
|
this->UseExcludeRegExpFirst = false;
|
2005-01-26 19:13:12 +03:00
|
|
|
|
2006-03-10 23:03:09 +03:00
|
|
|
this->CustomMaximumPassedTestOutputSize = 1 * 1024;
|
|
|
|
this->CustomMaximumFailedTestOutputSize = 300 * 1024;
|
2006-03-09 19:17:10 +03:00
|
|
|
|
2006-03-10 23:03:09 +03:00
|
|
|
this->MemCheck = false;
|
2005-07-03 06:30:37 +04:00
|
|
|
|
2006-03-10 23:03:09 +03:00
|
|
|
this->LogFile = 0;
|
2005-08-18 21:50:16 +04:00
|
|
|
|
2009-01-15 18:32:56 +03:00
|
|
|
// regex to detect <DartMeasurement>...</DartMeasurement>
|
|
|
|
this->DartStuff.compile(
|
|
|
|
"(<DartMeasurement.*/DartMeasurement[a-zA-Z]*>)");
|
|
|
|
// regex to detect each individual <DartMeasurement>...</DartMeasurement>
|
|
|
|
this->DartStuff1.compile(
|
|
|
|
"(<DartMeasurement[^<]*</DartMeasurement[a-zA-Z]*>)");
|
2004-09-09 16:41:05 +04:00
|
|
|
}
|
|
|
|
|
2005-06-17 21:04:56 +04:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void cmCTestTestHandler::Initialize()
|
|
|
|
{
|
2005-06-23 21:04:18 +04:00
|
|
|
this->Superclass::Initialize();
|
|
|
|
|
2006-03-10 23:03:09 +03:00
|
|
|
this->ElapsedTestingTime = -1;
|
2005-06-17 21:04:56 +04:00
|
|
|
|
2006-03-10 23:03:09 +03:00
|
|
|
this->TestResults.clear();
|
2005-06-17 21:04:56 +04:00
|
|
|
|
2006-03-10 23:03:09 +03:00
|
|
|
this->CustomTestsIgnore.clear();
|
|
|
|
this->StartTest = "";
|
|
|
|
this->EndTest = "";
|
2005-06-17 21:04:56 +04:00
|
|
|
|
2006-03-10 23:03:09 +03:00
|
|
|
this->CustomPreTest.clear();
|
|
|
|
this->CustomPostTest.clear();
|
|
|
|
this->CustomMaximumPassedTestOutputSize = 1 * 1024;
|
|
|
|
this->CustomMaximumFailedTestOutputSize = 300 * 1024;
|
2005-06-17 21:04:56 +04:00
|
|
|
|
2006-03-10 23:03:09 +03:00
|
|
|
this->TestsToRun.clear();
|
2005-06-17 21:04:56 +04:00
|
|
|
|
2010-12-18 01:18:20 +03:00
|
|
|
this->UseIncludeLabelRegExpFlag = false;
|
|
|
|
this->UseExcludeLabelRegExpFlag = false;
|
2006-03-10 23:03:09 +03:00
|
|
|
this->UseIncludeRegExpFlag = false;
|
|
|
|
this->UseExcludeRegExpFlag = false;
|
|
|
|
this->UseExcludeRegExpFirst = false;
|
2009-02-10 22:24:24 +03:00
|
|
|
this->IncludeLabelRegularExpression = "";
|
|
|
|
this->ExcludeLabelRegularExpression = "";
|
2006-03-10 23:03:09 +03:00
|
|
|
this->IncludeRegExp = "";
|
|
|
|
this->ExcludeRegExp = "";
|
2005-06-17 21:04:56 +04:00
|
|
|
|
|
|
|
TestsToRunString = "";
|
2006-03-10 23:03:09 +03:00
|
|
|
this->UseUnion = false;
|
|
|
|
this->TestList.clear();
|
2005-06-17 21:04:56 +04:00
|
|
|
}
|
|
|
|
|
2004-09-09 16:41:05 +04:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void cmCTestTestHandler::PopulateCustomVectors(cmMakefile *mf)
|
|
|
|
{
|
2006-03-29 21:01:24 +04:00
|
|
|
this->CTest->PopulateCustomVector(mf, "CTEST_CUSTOM_PRE_TEST",
|
2006-03-10 23:03:09 +03:00
|
|
|
this->CustomPreTest);
|
2006-03-29 21:01:24 +04:00
|
|
|
this->CTest->PopulateCustomVector(mf, "CTEST_CUSTOM_POST_TEST",
|
2006-03-10 23:03:09 +03:00
|
|
|
this->CustomPostTest);
|
2006-03-29 21:01:24 +04:00
|
|
|
this->CTest->PopulateCustomVector(mf,
|
2006-03-09 19:17:10 +03:00
|
|
|
"CTEST_CUSTOM_TESTS_IGNORE",
|
2006-03-10 23:03:09 +03:00
|
|
|
this->CustomTestsIgnore);
|
2006-03-29 21:01:24 +04:00
|
|
|
this->CTest->PopulateCustomInteger(mf,
|
2006-03-09 19:17:10 +03:00
|
|
|
"CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE",
|
2006-03-10 23:03:09 +03:00
|
|
|
this->CustomMaximumPassedTestOutputSize);
|
2006-03-29 21:01:24 +04:00
|
|
|
this->CTest->PopulateCustomInteger(mf,
|
2006-03-09 19:17:10 +03:00
|
|
|
"CTEST_CUSTOM_MAXIMUM_FAILED_TEST_OUTPUT_SIZE",
|
2006-03-10 23:03:09 +03:00
|
|
|
this->CustomMaximumFailedTestOutputSize);
|
2004-09-09 16:41:05 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2005-01-27 23:54:47 +03:00
|
|
|
int cmCTestTestHandler::PreProcessHandler()
|
2004-09-09 16:41:05 +04:00
|
|
|
{
|
2006-03-10 23:03:09 +03:00
|
|
|
if ( !this->ExecuteCommands(this->CustomPreTest) )
|
2004-09-09 16:41:05 +04:00
|
|
|
{
|
2006-03-10 23:03:09 +03:00
|
|
|
cmCTestLog(this->CTest, ERROR_MESSAGE,
|
2006-03-09 19:17:10 +03:00
|
|
|
"Problem executing pre-test command(s)." << std::endl);
|
2005-01-27 23:54:47 +03:00
|
|
|
return 0;
|
2004-09-09 16:41:05 +04:00
|
|
|
}
|
2005-01-27 23:54:47 +03:00
|
|
|
return 1;
|
|
|
|
}
|
2004-09-09 16:41:05 +04:00
|
|
|
|
2005-01-27 23:54:47 +03:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
int cmCTestTestHandler::PostProcessHandler()
|
|
|
|
{
|
2006-03-10 23:03:09 +03:00
|
|
|
if ( !this->ExecuteCommands(this->CustomPostTest) )
|
2004-09-09 16:41:05 +04:00
|
|
|
{
|
2006-03-10 23:03:09 +03:00
|
|
|
cmCTestLog(this->CTest, ERROR_MESSAGE,
|
2006-03-09 19:17:10 +03:00
|
|
|
"Problem executing post-test command(s)." << std::endl);
|
2005-01-27 23:54:47 +03:00
|
|
|
return 0;
|
2004-09-09 16:41:05 +04:00
|
|
|
}
|
2005-01-27 23:54:47 +03:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
//clearly it would be nice if this were broken up into a few smaller
|
|
|
|
//functions and commented...
|
|
|
|
int cmCTestTestHandler::ProcessHandler()
|
|
|
|
{
|
2005-02-18 00:11:10 +03:00
|
|
|
// Update internal data structure from generic one
|
|
|
|
this->SetTestsToRunInformation(this->GetOption("TestsToRunInformation"));
|
2009-10-29 22:30:12 +03:00
|
|
|
this->SetUseUnion(cmSystemTools::IsOn(this->GetOption("UseUnion")));
|
|
|
|
if(cmSystemTools::IsOn(this->GetOption("ScheduleRandom")))
|
|
|
|
{
|
|
|
|
this->CTest->SetScheduleType("Random");
|
|
|
|
}
|
2009-09-02 20:35:42 +04:00
|
|
|
if(this->GetOption("ParallelLevel"))
|
|
|
|
{
|
|
|
|
this->CTest->SetParallelLevel(atoi(this->GetOption("ParallelLevel")));
|
|
|
|
}
|
2009-10-29 22:30:12 +03:00
|
|
|
|
2005-02-18 00:11:10 +03:00
|
|
|
const char* val;
|
2009-02-10 22:24:24 +03:00
|
|
|
val = this->GetOption("LabelRegularExpression");
|
|
|
|
if ( val )
|
|
|
|
{
|
|
|
|
this->UseIncludeLabelRegExpFlag = true;
|
|
|
|
this->IncludeLabelRegExp = val;
|
|
|
|
}
|
|
|
|
val = this->GetOption("ExcludeLabelRegularExpression");
|
|
|
|
if ( val )
|
|
|
|
{
|
|
|
|
this->UseExcludeLabelRegExpFlag = true;
|
2014-06-06 12:28:18 +04:00
|
|
|
this->ExcludeLabelRegExp = val;
|
2009-02-10 22:24:24 +03:00
|
|
|
}
|
2005-02-18 00:11:10 +03:00
|
|
|
val = this->GetOption("IncludeRegularExpression");
|
|
|
|
if ( val )
|
|
|
|
{
|
|
|
|
this->UseIncludeRegExp();
|
|
|
|
this->SetIncludeRegExp(val);
|
|
|
|
}
|
|
|
|
val = this->GetOption("ExcludeRegularExpression");
|
|
|
|
if ( val )
|
|
|
|
{
|
|
|
|
this->UseExcludeRegExp();
|
|
|
|
this->SetExcludeRegExp(val);
|
|
|
|
}
|
2013-09-24 22:20:38 +04:00
|
|
|
this->SetRerunFailed(cmSystemTools::IsOn(this->GetOption("RerunFailed")));
|
2011-03-11 16:04:58 +03:00
|
|
|
|
2006-03-10 23:03:09 +03:00
|
|
|
this->TestResults.clear();
|
2009-08-27 18:37:30 +04:00
|
|
|
|
|
|
|
cmCTestLog(this->CTest, HANDLER_OUTPUT,
|
|
|
|
(this->MemCheck ? "Memory check" : "Test")
|
|
|
|
<< " project " << cmSystemTools::GetCurrentWorkingDirectory()
|
|
|
|
<< std::endl);
|
2005-01-27 23:54:47 +03:00
|
|
|
if ( ! this->PreProcessHandler() )
|
2004-09-09 16:41:05 +04:00
|
|
|
{
|
2005-01-27 23:54:47 +03:00
|
|
|
return -1;
|
2004-09-09 16:41:05 +04:00
|
|
|
}
|
|
|
|
|
2005-08-18 21:50:16 +04:00
|
|
|
cmGeneratedFileStream mLogFile;
|
2006-03-16 19:29:12 +03:00
|
|
|
this->StartLogFile((this->MemCheck ? "DynamicAnalysis" : "Test"), mLogFile);
|
2006-03-10 23:03:09 +03:00
|
|
|
this->LogFile = &mLogFile;
|
2005-08-18 21:50:16 +04:00
|
|
|
|
2014-02-10 09:21:34 +04:00
|
|
|
std::vector<std::string> passed;
|
|
|
|
std::vector<std::string> failed;
|
2004-09-09 16:41:05 +04:00
|
|
|
int total;
|
2009-08-26 20:09:06 +04:00
|
|
|
|
|
|
|
//start the real time clock
|
|
|
|
double clock_start, clock_finish;
|
|
|
|
clock_start = cmSystemTools::GetTime();
|
|
|
|
|
2005-01-27 23:54:47 +03:00
|
|
|
this->ProcessDirectory(passed, failed);
|
2004-09-09 16:41:05 +04:00
|
|
|
|
2009-08-26 20:09:06 +04:00
|
|
|
clock_finish = cmSystemTools::GetTime();
|
|
|
|
|
2004-09-09 16:41:05 +04:00
|
|
|
total = int(passed.size()) + int(failed.size());
|
|
|
|
|
|
|
|
if (total == 0)
|
|
|
|
{
|
2010-08-31 18:41:23 +04:00
|
|
|
if ( !this->CTest->GetShowOnly() && !this->CTest->ShouldPrintLabels() )
|
2004-09-09 16:41:05 +04:00
|
|
|
{
|
2006-03-10 23:03:09 +03:00
|
|
|
cmCTestLog(this->CTest, ERROR_MESSAGE, "No tests were found!!!"
|
2006-03-09 19:17:10 +03:00
|
|
|
<< std::endl);
|
2004-09-09 16:41:05 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-03-10 23:03:09 +03:00
|
|
|
if (this->HandlerVerbose && passed.size() &&
|
|
|
|
(this->UseIncludeRegExpFlag || this->UseExcludeRegExpFlag))
|
2004-09-09 16:41:05 +04:00
|
|
|
{
|
2006-03-10 23:03:09 +03:00
|
|
|
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, std::endl
|
2006-03-09 19:17:10 +03:00
|
|
|
<< "The following tests passed:" << std::endl);
|
2014-02-10 09:21:34 +04:00
|
|
|
for(std::vector<std::string>::iterator j = passed.begin();
|
2004-09-09 16:41:05 +04:00
|
|
|
j != passed.end(); ++j)
|
2006-03-09 19:17:10 +03:00
|
|
|
{
|
2006-03-10 23:03:09 +03:00
|
|
|
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "\t" << *j
|
|
|
|
<< std::endl);
|
2004-09-09 16:41:05 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-10-02 23:30:01 +04:00
|
|
|
float percent = float(passed.size()) * 100.0f / float(total);
|
2004-09-09 16:41:05 +04:00
|
|
|
if ( failed.size() > 0 && percent > 99)
|
|
|
|
{
|
|
|
|
percent = 99;
|
|
|
|
}
|
2009-10-02 23:30:01 +04:00
|
|
|
|
2009-08-27 18:37:30 +04:00
|
|
|
cmCTestLog(this->CTest, HANDLER_OUTPUT, std::endl
|
|
|
|
<< static_cast<int>(percent + .5) << "% tests passed, "
|
2009-10-02 23:30:01 +04:00
|
|
|
<< failed.size() << " tests failed out of "
|
|
|
|
<< total << std::endl);
|
2009-09-11 21:34:35 +04:00
|
|
|
if(this->CTest->GetLabelSummary())
|
2008-07-03 17:31:33 +04:00
|
|
|
{
|
2009-09-11 21:34:35 +04:00
|
|
|
this->PrintLabelSummary();
|
2008-07-03 17:31:33 +04:00
|
|
|
}
|
2009-08-27 18:37:30 +04:00
|
|
|
char realBuf[1024];
|
|
|
|
sprintf(realBuf, "%6.2f sec", (double)(clock_finish - clock_start));
|
|
|
|
cmCTestLog(this->CTest, HANDLER_OUTPUT, "\nTotal Test time (real) = "
|
|
|
|
<< realBuf << "\n" );
|
|
|
|
|
2006-03-09 19:17:10 +03:00
|
|
|
if (failed.size())
|
2004-09-09 16:41:05 +04:00
|
|
|
{
|
2005-01-27 18:15:01 +03:00
|
|
|
cmGeneratedFileStream ofs;
|
2009-10-05 20:47:09 +04:00
|
|
|
cmCTestLog(this->CTest, HANDLER_OUTPUT, std::endl
|
2009-08-27 18:37:30 +04:00
|
|
|
<< "The following tests FAILED:" << std::endl);
|
|
|
|
this->StartLogFile("TestsFailed", ofs);
|
2011-03-11 16:04:58 +03:00
|
|
|
|
2011-08-03 18:24:59 +04:00
|
|
|
typedef std::set<cmCTestTestHandler::cmCTestTestResult,
|
|
|
|
cmCTestTestResultLess> SetOfTests;
|
2011-08-03 19:37:59 +04:00
|
|
|
SetOfTests resultsSet(this->TestResults.begin(),
|
|
|
|
this->TestResults.end());
|
2011-08-03 18:24:59 +04:00
|
|
|
|
|
|
|
for(SetOfTests::iterator ftit = resultsSet.begin();
|
|
|
|
ftit != resultsSet.end(); ++ftit)
|
2004-09-09 16:41:05 +04:00
|
|
|
{
|
2009-08-27 18:37:30 +04:00
|
|
|
if ( ftit->Status != cmCTestTestHandler::COMPLETED )
|
2004-09-09 16:41:05 +04:00
|
|
|
{
|
2009-08-27 18:37:30 +04:00
|
|
|
ofs << ftit->TestCount << ":" << ftit->Name << std::endl;
|
|
|
|
cmCTestLog(this->CTest, HANDLER_OUTPUT, "\t" << std::setw(3)
|
2011-03-11 16:04:58 +03:00
|
|
|
<< ftit->TestCount << " - "
|
2014-03-11 16:35:32 +04:00
|
|
|
<< ftit->Name << " ("
|
2011-03-11 16:04:58 +03:00
|
|
|
<< this->GetTestStatus(ftit->Status) << ")"
|
2009-08-27 18:37:30 +04:00
|
|
|
<< std::endl);
|
2004-09-09 16:41:05 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-03-10 23:03:09 +03:00
|
|
|
if ( this->CTest->GetProduceXML() )
|
2004-09-09 16:41:05 +04:00
|
|
|
{
|
2005-01-27 18:15:01 +03:00
|
|
|
cmGeneratedFileStream xmlfile;
|
2006-03-10 23:03:09 +03:00
|
|
|
if( !this->StartResultingXML(
|
2009-01-12 18:37:55 +03:00
|
|
|
(this->MemCheck ? cmCTest::PartMemCheck : cmCTest::PartTest),
|
2006-03-10 23:03:09 +03:00
|
|
|
(this->MemCheck ? "DynamicAnalysis" : "Test"), xmlfile) )
|
2004-09-09 16:41:05 +04:00
|
|
|
{
|
2006-03-10 23:03:09 +03:00
|
|
|
cmCTestLog(this->CTest, ERROR_MESSAGE, "Cannot create "
|
|
|
|
<< (this->MemCheck ? "memory check" : "testing")
|
2005-06-01 01:32:40 +04:00
|
|
|
<< " XML file" << std::endl);
|
2006-03-10 23:03:09 +03:00
|
|
|
this->LogFile = 0;
|
2004-09-09 16:41:05 +04:00
|
|
|
return 1;
|
|
|
|
}
|
2005-01-27 23:54:47 +03:00
|
|
|
this->GenerateDartOutput(xmlfile);
|
2004-09-09 16:41:05 +04:00
|
|
|
}
|
|
|
|
|
2005-01-27 23:54:47 +03:00
|
|
|
if ( ! this->PostProcessHandler() )
|
2004-09-09 16:41:05 +04:00
|
|
|
{
|
2006-03-10 23:03:09 +03:00
|
|
|
this->LogFile = 0;
|
2005-01-27 23:54:47 +03:00
|
|
|
return -1;
|
2004-09-09 16:41:05 +04:00
|
|
|
}
|
2005-01-27 23:54:47 +03:00
|
|
|
|
|
|
|
if ( !failed.empty() )
|
2004-09-09 16:41:05 +04:00
|
|
|
{
|
2006-03-10 23:03:09 +03:00
|
|
|
this->LogFile = 0;
|
2005-01-27 23:54:47 +03:00
|
|
|
return -1;
|
2004-09-09 16:41:05 +04:00
|
|
|
}
|
2006-03-10 23:03:09 +03:00
|
|
|
this->LogFile = 0;
|
2005-01-27 23:54:47 +03:00
|
|
|
return 0;
|
2004-09-09 16:41:05 +04:00
|
|
|
}
|
|
|
|
|
2009-08-19 17:24:55 +04:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void cmCTestTestHandler::PrintLabelSummary()
|
|
|
|
{
|
|
|
|
cmCTestTestHandler::ListOfTests::iterator it = this->TestList.begin();
|
|
|
|
cmCTestTestHandler::TestResultsVector::iterator ri =
|
|
|
|
this->TestResults.begin();
|
2014-02-10 09:21:34 +04:00
|
|
|
std::map<std::string, double> labelTimes;
|
|
|
|
std::set<std::string> labels;
|
2009-08-19 17:24:55 +04:00
|
|
|
// initialize maps
|
2009-09-11 21:34:35 +04:00
|
|
|
std::string::size_type maxlen = 0;
|
2009-08-19 17:24:55 +04:00
|
|
|
for(; it != this->TestList.end(); ++it)
|
|
|
|
{
|
|
|
|
cmCTestTestProperties& p = *it;
|
|
|
|
if(p.Labels.size() != 0)
|
|
|
|
{
|
|
|
|
for(std::vector<std::string>::iterator l = p.Labels.begin();
|
|
|
|
l != p.Labels.end(); ++l)
|
|
|
|
{
|
2009-09-11 21:34:35 +04:00
|
|
|
if((*l).size() > maxlen)
|
|
|
|
{
|
|
|
|
maxlen = (*l).size();
|
|
|
|
}
|
2009-08-19 17:24:55 +04:00
|
|
|
labels.insert(*l);
|
|
|
|
labelTimes[*l] = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ri = this->TestResults.begin();
|
|
|
|
// fill maps
|
2009-12-03 00:37:43 +03:00
|
|
|
for(; ri != this->TestResults.end(); ++ri)
|
2009-08-19 17:24:55 +04:00
|
|
|
{
|
2011-03-11 16:04:58 +03:00
|
|
|
cmCTestTestResult &result = *ri;
|
2009-12-03 00:37:43 +03:00
|
|
|
cmCTestTestProperties& p = *result.Properties;
|
2009-08-19 17:24:55 +04:00
|
|
|
if(p.Labels.size() != 0)
|
|
|
|
{
|
|
|
|
for(std::vector<std::string>::iterator l = p.Labels.begin();
|
|
|
|
l != p.Labels.end(); ++l)
|
2011-03-11 16:04:58 +03:00
|
|
|
{
|
2009-08-19 17:24:55 +04:00
|
|
|
labelTimes[*l] += result.ExecutionTime;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2011-03-11 16:04:58 +03:00
|
|
|
// now print times
|
2009-09-11 21:34:35 +04:00
|
|
|
if(labels.size())
|
|
|
|
{
|
|
|
|
cmCTestLog(this->CTest, HANDLER_OUTPUT, "\nLabel Time Summary:");
|
|
|
|
}
|
2014-02-10 09:21:34 +04:00
|
|
|
for(std::set<std::string>::const_iterator i = labels.begin();
|
2009-08-19 17:24:55 +04:00
|
|
|
i != labels.end(); ++i)
|
|
|
|
{
|
2009-09-11 21:34:35 +04:00
|
|
|
std::string label = *i;
|
|
|
|
label.resize(maxlen +3, ' ');
|
|
|
|
char buf[1024];
|
|
|
|
sprintf(buf, "%6.2f sec", labelTimes[*i]);
|
|
|
|
cmCTestLog(this->CTest, HANDLER_OUTPUT, "\n"
|
|
|
|
<< label << " = " << buf );
|
2009-08-19 17:24:55 +04:00
|
|
|
if ( this->LogFile )
|
2009-09-11 21:34:35 +04:00
|
|
|
{
|
|
|
|
*this->LogFile << "\n" << *i << " = "
|
|
|
|
<< buf << "\n";
|
|
|
|
}
|
2009-08-19 17:24:55 +04:00
|
|
|
}
|
2009-09-11 21:34:35 +04:00
|
|
|
if(labels.size())
|
2011-03-11 16:04:58 +03:00
|
|
|
{
|
2009-09-11 21:34:35 +04:00
|
|
|
if(this->LogFile)
|
|
|
|
{
|
|
|
|
*this->LogFile << "\n";
|
|
|
|
}
|
|
|
|
cmCTestLog(this->CTest, HANDLER_OUTPUT, "\n");
|
|
|
|
}
|
|
|
|
|
2009-08-19 17:24:55 +04:00
|
|
|
}
|
2008-11-26 22:38:43 +03:00
|
|
|
|
2009-02-10 22:24:24 +03:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void cmCTestTestHandler::CheckLabelFilterInclude(cmCTestTestProperties& it)
|
|
|
|
{
|
|
|
|
// if not using Labels to filter then return
|
|
|
|
if (!this->UseIncludeLabelRegExpFlag )
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
// if there are no labels and we are filtering by labels
|
|
|
|
// then exclude the test as it does not have the label
|
|
|
|
if(it.Labels.size() == 0 )
|
|
|
|
{
|
|
|
|
it.IsInBasedOnREOptions = false;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
// check to see if the label regular expression matches
|
|
|
|
bool found = false; // assume it does not match
|
|
|
|
// loop over all labels and look for match
|
|
|
|
for(std::vector<std::string>::iterator l = it.Labels.begin();
|
|
|
|
l != it.Labels.end(); ++l)
|
|
|
|
{
|
|
|
|
if(this->IncludeLabelRegularExpression.find(*l))
|
|
|
|
{
|
|
|
|
found = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// if no match was found, exclude the test
|
|
|
|
if(!found)
|
|
|
|
{
|
|
|
|
it.IsInBasedOnREOptions = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void cmCTestTestHandler::CheckLabelFilterExclude(cmCTestTestProperties& it)
|
|
|
|
{
|
|
|
|
// if not using Labels to filter then return
|
|
|
|
if (!this->UseExcludeLabelRegExpFlag )
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
// if there are no labels and we are excluding by labels
|
|
|
|
// then do nothing as a no label can not be a match
|
|
|
|
if(it.Labels.size() == 0 )
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
// check to see if the label regular expression matches
|
|
|
|
bool found = false; // assume it does not match
|
|
|
|
// loop over all labels and look for match
|
|
|
|
for(std::vector<std::string>::iterator l = it.Labels.begin();
|
|
|
|
l != it.Labels.end(); ++l)
|
|
|
|
{
|
|
|
|
if(this->ExcludeLabelRegularExpression.find(*l))
|
|
|
|
{
|
|
|
|
found = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// if match was found, exclude the test
|
|
|
|
if(found)
|
|
|
|
{
|
|
|
|
it.IsInBasedOnREOptions = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void cmCTestTestHandler::CheckLabelFilter(cmCTestTestProperties& it)
|
|
|
|
{
|
|
|
|
this->CheckLabelFilterInclude(it);
|
|
|
|
this->CheckLabelFilterExclude(it);
|
|
|
|
}
|
|
|
|
|
2005-01-27 23:54:47 +03:00
|
|
|
//----------------------------------------------------------------------
|
2008-07-03 17:31:33 +04:00
|
|
|
void cmCTestTestHandler::ComputeTestList()
|
2004-09-09 16:41:05 +04:00
|
|
|
{
|
2008-07-03 17:31:33 +04:00
|
|
|
this->TestList.clear(); // clear list of test
|
2009-08-27 18:37:30 +04:00
|
|
|
this->GetListOfTests();
|
2013-09-24 22:20:38 +04:00
|
|
|
|
|
|
|
if (this->RerunFailed)
|
|
|
|
{
|
|
|
|
this->ComputeTestListForRerunFailed();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2006-03-10 23:03:09 +03:00
|
|
|
cmCTestTestHandler::ListOfTests::size_type tmsize = this->TestList.size();
|
2004-11-13 17:55:31 +03:00
|
|
|
// how many tests are in based on RegExp?
|
|
|
|
int inREcnt = 0;
|
2006-03-10 23:03:09 +03:00
|
|
|
cmCTestTestHandler::ListOfTests::iterator it;
|
|
|
|
for ( it = this->TestList.begin(); it != this->TestList.end(); it ++ )
|
2004-11-13 17:55:31 +03:00
|
|
|
{
|
2009-02-10 22:24:24 +03:00
|
|
|
this->CheckLabelFilter(*it);
|
2006-03-10 23:03:09 +03:00
|
|
|
if (it->IsInBasedOnREOptions)
|
2004-11-13 17:55:31 +03:00
|
|
|
{
|
|
|
|
inREcnt ++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// expand the test list based on the union flag
|
2006-03-10 23:03:09 +03:00
|
|
|
if (this->UseUnion)
|
2004-11-13 17:55:31 +03:00
|
|
|
{
|
|
|
|
this->ExpandTestsToRunInformation((int)tmsize);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
this->ExpandTestsToRunInformation(inREcnt);
|
|
|
|
}
|
2008-07-03 17:31:33 +04:00
|
|
|
// Now create a final list of tests to run
|
2004-09-09 16:41:05 +04:00
|
|
|
int cnt = 0;
|
2004-11-13 17:55:31 +03:00
|
|
|
inREcnt = 0;
|
2011-03-11 16:04:58 +03:00
|
|
|
std::string last_directory = "";
|
2008-07-03 17:31:33 +04:00
|
|
|
ListOfTests finalList;
|
2006-03-10 23:03:09 +03:00
|
|
|
for ( it = this->TestList.begin(); it != this->TestList.end(); it ++ )
|
2004-09-09 16:41:05 +04:00
|
|
|
{
|
|
|
|
cnt ++;
|
2006-03-10 23:03:09 +03:00
|
|
|
if (it->IsInBasedOnREOptions)
|
2004-11-13 17:55:31 +03:00
|
|
|
{
|
|
|
|
inREcnt++;
|
|
|
|
}
|
2006-10-19 18:45:19 +04:00
|
|
|
|
2006-03-10 23:03:09 +03:00
|
|
|
if (this->UseUnion)
|
2004-09-09 16:41:05 +04:00
|
|
|
{
|
2004-11-13 17:55:31 +03:00
|
|
|
// if it is not in the list and not in the regexp then skip
|
2006-03-10 23:03:09 +03:00
|
|
|
if ((this->TestsToRun.size() &&
|
|
|
|
std::find(this->TestsToRun.begin(), this->TestsToRun.end(), cnt)
|
|
|
|
== this->TestsToRun.end()) && !it->IsInBasedOnREOptions)
|
2004-11-13 17:55:31 +03:00
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
2004-09-09 16:41:05 +04:00
|
|
|
}
|
2004-11-13 17:55:31 +03:00
|
|
|
else
|
|
|
|
{
|
|
|
|
// is this test in the list of tests to run? If not then skip it
|
2006-03-10 23:03:09 +03:00
|
|
|
if ((this->TestsToRun.size() &&
|
|
|
|
std::find(this->TestsToRun.begin(),
|
2007-01-25 19:16:16 +03:00
|
|
|
this->TestsToRun.end(), inREcnt)
|
2006-03-10 23:03:09 +03:00
|
|
|
== this->TestsToRun.end()) || !it->IsInBasedOnREOptions)
|
2004-11-13 17:55:31 +03:00
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
2008-07-03 17:31:33 +04:00
|
|
|
it->Index = cnt; // save the index into the test list for this test
|
|
|
|
finalList.push_back(*it);
|
|
|
|
}
|
|
|
|
// Save the total number of tests before exclusions
|
|
|
|
this->TotalNumberOfTests = this->TestList.size();
|
|
|
|
// Set the TestList to the final list of all test
|
|
|
|
this->TestList = finalList;
|
2013-09-24 22:20:38 +04:00
|
|
|
|
|
|
|
this->UpdateMaxTestNameWidth();
|
|
|
|
}
|
|
|
|
|
|
|
|
void cmCTestTestHandler::ComputeTestListForRerunFailed()
|
|
|
|
{
|
|
|
|
this->ExpandTestsToRunInformationForRerunFailed();
|
|
|
|
|
|
|
|
cmCTestTestHandler::ListOfTests::iterator it;
|
|
|
|
ListOfTests finalList;
|
|
|
|
int cnt = 0;
|
|
|
|
for ( it = this->TestList.begin(); it != this->TestList.end(); it ++ )
|
|
|
|
{
|
|
|
|
cnt ++;
|
|
|
|
|
|
|
|
// if this test is not in our list of tests to run, then skip it.
|
|
|
|
if ((this->TestsToRun.size() &&
|
|
|
|
std::find(this->TestsToRun.begin(), this->TestsToRun.end(), cnt)
|
|
|
|
== this->TestsToRun.end()))
|
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
it->Index = cnt;
|
|
|
|
finalList.push_back(*it);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Save the total number of tests before exclusions
|
|
|
|
this->TotalNumberOfTests = this->TestList.size();
|
|
|
|
|
|
|
|
// Set the TestList to the list of failed tests to rerun
|
|
|
|
this->TestList = finalList;
|
|
|
|
|
|
|
|
this->UpdateMaxTestNameWidth();
|
|
|
|
}
|
|
|
|
|
|
|
|
void cmCTestTestHandler::UpdateMaxTestNameWidth()
|
|
|
|
{
|
2009-07-17 18:06:38 +04:00
|
|
|
std::string::size_type max = this->CTest->GetMaxTestNameWidth();
|
2013-09-24 22:20:38 +04:00
|
|
|
for ( cmCTestTestHandler::ListOfTests::iterator it = this->TestList.begin();
|
|
|
|
it != this->TestList.end(); it ++ )
|
2009-07-17 18:06:38 +04:00
|
|
|
{
|
|
|
|
cmCTestTestProperties& p = *it;
|
|
|
|
if(max < p.Name.size())
|
|
|
|
{
|
|
|
|
max = p.Name.size();
|
|
|
|
}
|
|
|
|
}
|
2011-03-11 16:04:58 +03:00
|
|
|
if(static_cast<std::string::size_type>(this->CTest->GetMaxTestNameWidth())
|
2009-07-17 18:06:38 +04:00
|
|
|
!= max)
|
|
|
|
{
|
2009-07-19 21:40:38 +04:00
|
|
|
this->CTest->SetMaxTestNameWidth(static_cast<int>(max));
|
2009-07-17 18:06:38 +04:00
|
|
|
}
|
2008-07-03 17:31:33 +04:00
|
|
|
}
|
2011-03-11 16:04:58 +03:00
|
|
|
|
2008-07-03 17:31:33 +04:00
|
|
|
bool cmCTestTestHandler::GetValue(const char* tag,
|
|
|
|
int& value,
|
2014-01-04 09:47:13 +04:00
|
|
|
std::istream& fin)
|
2008-07-03 17:31:33 +04:00
|
|
|
{
|
|
|
|
std::string line;
|
2008-07-04 18:10:30 +04:00
|
|
|
bool ret = true;
|
2008-07-03 17:31:33 +04:00
|
|
|
cmSystemTools::GetLineFromStream(fin, line);
|
|
|
|
if(line == tag)
|
|
|
|
{
|
|
|
|
fin >> value;
|
2008-07-04 18:10:30 +04:00
|
|
|
ret = cmSystemTools::GetLineFromStream(fin, line); // read blank line
|
2008-07-03 17:31:33 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
cmCTestLog(this->CTest, ERROR_MESSAGE,
|
|
|
|
"parse error: missing tag: "
|
|
|
|
<< tag << " found [" << line << "]" << std::endl);
|
2008-07-04 18:10:30 +04:00
|
|
|
ret = false;
|
2008-07-03 17:31:33 +04:00
|
|
|
}
|
2008-07-04 18:10:30 +04:00
|
|
|
return ret;
|
2008-07-03 17:31:33 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
bool cmCTestTestHandler::GetValue(const char* tag,
|
|
|
|
double& value,
|
2014-01-04 09:47:13 +04:00
|
|
|
std::istream& fin)
|
2008-07-03 17:31:33 +04:00
|
|
|
{
|
|
|
|
std::string line;
|
|
|
|
cmSystemTools::GetLineFromStream(fin, line);
|
2008-07-04 18:10:30 +04:00
|
|
|
bool ret = true;
|
2008-07-03 17:31:33 +04:00
|
|
|
if(line == tag)
|
|
|
|
{
|
|
|
|
fin >> value;
|
2008-07-04 18:10:30 +04:00
|
|
|
ret = cmSystemTools::GetLineFromStream(fin, line); // read blank line
|
2008-07-03 17:31:33 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
cmCTestLog(this->CTest, ERROR_MESSAGE,
|
|
|
|
"parse error: missing tag: "
|
|
|
|
<< tag << " found [" << line << "]" << std::endl);
|
2008-07-04 18:10:30 +04:00
|
|
|
ret = false;
|
2008-07-03 17:31:33 +04:00
|
|
|
}
|
2008-07-04 18:10:30 +04:00
|
|
|
return ret;
|
2008-07-03 17:31:33 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
bool cmCTestTestHandler::GetValue(const char* tag,
|
|
|
|
bool& value,
|
2014-01-04 09:47:13 +04:00
|
|
|
std::istream& fin)
|
2008-07-03 17:31:33 +04:00
|
|
|
{
|
|
|
|
std::string line;
|
|
|
|
cmSystemTools::GetLineFromStream(fin, line);
|
2008-07-04 18:10:30 +04:00
|
|
|
bool ret = true;
|
2008-07-03 17:31:33 +04:00
|
|
|
if(line == tag)
|
|
|
|
{
|
2008-09-16 01:53:28 +04:00
|
|
|
#ifdef __HAIKU__
|
|
|
|
int tmp = 0;
|
|
|
|
fin >> tmp;
|
|
|
|
value = false;
|
|
|
|
if(tmp)
|
|
|
|
{
|
|
|
|
value = true;
|
|
|
|
}
|
|
|
|
#else
|
2008-07-03 17:31:33 +04:00
|
|
|
fin >> value;
|
2008-09-16 01:53:28 +04:00
|
|
|
#endif
|
2008-07-04 18:10:30 +04:00
|
|
|
ret = cmSystemTools::GetLineFromStream(fin, line); // read blank line
|
2008-07-03 17:31:33 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
cmCTestLog(this->CTest, ERROR_MESSAGE,
|
|
|
|
"parse error: missing tag: "
|
|
|
|
<< tag << " found [" << line << "]" << std::endl);
|
2008-07-04 18:10:30 +04:00
|
|
|
ret = false;
|
2008-07-03 17:31:33 +04:00
|
|
|
}
|
2008-07-04 18:10:30 +04:00
|
|
|
return ret;
|
2008-07-03 17:31:33 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
bool cmCTestTestHandler::GetValue(const char* tag,
|
|
|
|
size_t& value,
|
2014-01-04 09:47:13 +04:00
|
|
|
std::istream& fin)
|
2008-07-03 17:31:33 +04:00
|
|
|
{
|
|
|
|
std::string line;
|
|
|
|
cmSystemTools::GetLineFromStream(fin, line);
|
2008-07-04 18:10:30 +04:00
|
|
|
bool ret = true;
|
2008-07-03 17:31:33 +04:00
|
|
|
if(line == tag)
|
|
|
|
{
|
|
|
|
fin >> value;
|
2008-07-04 18:10:30 +04:00
|
|
|
ret = cmSystemTools::GetLineFromStream(fin, line); // read blank line
|
2008-07-03 17:31:33 +04:00
|
|
|
}
|
|
|
|
else
|
2011-03-11 16:04:58 +03:00
|
|
|
{
|
2008-07-03 17:31:33 +04:00
|
|
|
cmCTestLog(this->CTest, ERROR_MESSAGE,
|
|
|
|
"parse error: missing tag: "
|
2014-03-11 16:35:32 +04:00
|
|
|
<< tag << " found [" << line << "]" << std::endl);
|
2008-07-04 18:10:30 +04:00
|
|
|
ret = false;
|
2008-07-03 17:31:33 +04:00
|
|
|
}
|
2008-07-04 18:10:30 +04:00
|
|
|
return ret;
|
2008-07-03 17:31:33 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
bool cmCTestTestHandler::GetValue(const char* tag,
|
|
|
|
std::string& value,
|
2014-01-04 09:47:13 +04:00
|
|
|
std::istream& fin)
|
2008-07-03 17:31:33 +04:00
|
|
|
{
|
|
|
|
std::string line;
|
|
|
|
cmSystemTools::GetLineFromStream(fin, line);
|
2008-07-04 18:10:30 +04:00
|
|
|
bool ret = true;
|
2008-07-03 17:31:33 +04:00
|
|
|
if(line == tag)
|
|
|
|
{
|
2008-07-04 18:10:30 +04:00
|
|
|
ret = cmSystemTools::GetLineFromStream(fin, value);
|
2008-07-03 17:31:33 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
cmCTestLog(this->CTest, ERROR_MESSAGE,
|
|
|
|
"parse error: missing tag: "
|
|
|
|
<< tag << " found [" << line << "]" << std::endl);
|
2008-07-04 18:10:30 +04:00
|
|
|
ret = false;
|
2008-07-03 17:31:33 +04:00
|
|
|
}
|
2008-07-04 18:10:30 +04:00
|
|
|
return ret;
|
2008-07-03 17:31:33 +04:00
|
|
|
}
|
|
|
|
|
2009-08-27 18:37:30 +04:00
|
|
|
//---------------------------------------------------------------------
|
2014-02-10 09:21:34 +04:00
|
|
|
void cmCTestTestHandler::ProcessDirectory(std::vector<std::string> &passed,
|
|
|
|
std::vector<std::string> &failed)
|
2008-07-03 17:31:33 +04:00
|
|
|
{
|
|
|
|
this->ComputeTestList();
|
2009-08-31 18:28:39 +04:00
|
|
|
this->StartTest = this->CTest->CurrentTime();
|
|
|
|
this->StartTestTime = static_cast<unsigned int>(cmSystemTools::GetTime());
|
|
|
|
double elapsed_time_start = cmSystemTools::GetTime();
|
2009-08-27 18:37:30 +04:00
|
|
|
|
2009-09-10 19:16:08 +04:00
|
|
|
cmCTestMultiProcessHandler* parallel = this->CTest->GetBatchJobs() ?
|
|
|
|
new cmCTestBatchTestHandler : new cmCTestMultiProcessHandler;
|
|
|
|
parallel->SetCTest(this->CTest);
|
|
|
|
parallel->SetParallelLevel(this->CTest->GetParallelLevel());
|
|
|
|
parallel->SetTestHandler(this);
|
2009-08-26 20:09:06 +04:00
|
|
|
|
|
|
|
*this->LogFile << "Start testing: "
|
|
|
|
<< this->CTest->CurrentTime() << std::endl
|
|
|
|
<< "----------------------------------------------------------"
|
|
|
|
<< std::endl;
|
|
|
|
|
2008-07-04 18:28:22 +04:00
|
|
|
cmCTestMultiProcessHandler::TestMap tests;
|
2009-08-26 20:09:06 +04:00
|
|
|
cmCTestMultiProcessHandler::PropertiesMap properties;
|
2011-03-11 16:04:58 +03:00
|
|
|
|
2009-10-29 22:30:12 +03:00
|
|
|
bool randomSchedule = this->CTest->GetScheduleType() == "Random";
|
|
|
|
if(randomSchedule)
|
2010-06-15 18:29:35 +04:00
|
|
|
{
|
2009-10-29 22:30:12 +03:00
|
|
|
srand((unsigned)time(0));
|
2010-06-15 18:29:35 +04:00
|
|
|
}
|
2009-10-29 22:30:12 +03:00
|
|
|
|
2008-07-03 17:31:33 +04:00
|
|
|
for (ListOfTests::iterator it = this->TestList.begin();
|
2009-09-10 19:16:08 +04:00
|
|
|
it != this->TestList.end(); ++it)
|
2011-03-11 16:04:58 +03:00
|
|
|
{
|
2008-07-03 17:31:33 +04:00
|
|
|
cmCTestTestProperties& p = *it;
|
2009-09-04 18:16:06 +04:00
|
|
|
cmCTestMultiProcessHandler::TestSet depends;
|
|
|
|
|
2009-10-29 22:30:12 +03:00
|
|
|
if(randomSchedule)
|
|
|
|
{
|
2010-06-27 19:22:05 +04:00
|
|
|
p.Cost = static_cast<float>(rand());
|
2009-10-29 22:30:12 +03:00
|
|
|
}
|
|
|
|
|
2009-12-08 18:26:43 +03:00
|
|
|
if(p.Timeout == 0 && this->CTest->GetGlobalTimeout() != 0)
|
2009-12-01 00:08:11 +03:00
|
|
|
{
|
|
|
|
p.Timeout = this->CTest->GetGlobalTimeout();
|
|
|
|
}
|
|
|
|
|
2008-07-03 17:31:33 +04:00
|
|
|
if(p.Depends.size())
|
|
|
|
{
|
|
|
|
for(std::vector<std::string>::iterator i = p.Depends.begin();
|
2009-09-10 19:16:08 +04:00
|
|
|
i != p.Depends.end(); ++i)
|
2008-07-03 17:31:33 +04:00
|
|
|
{
|
|
|
|
for(ListOfTests::iterator it2 = this->TestList.begin();
|
2009-09-10 19:16:08 +04:00
|
|
|
it2 != this->TestList.end(); ++it2)
|
2008-07-03 17:31:33 +04:00
|
|
|
{
|
|
|
|
if(it2->Name == *i)
|
|
|
|
{
|
|
|
|
depends.insert(it2->Index);
|
|
|
|
break; // break out of test loop as name can only match 1
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
tests[it->Index] = depends;
|
2009-08-26 20:09:06 +04:00
|
|
|
properties[it->Index] = &*it;
|
2008-07-03 17:31:33 +04:00
|
|
|
}
|
2009-09-10 19:16:08 +04:00
|
|
|
parallel->SetTests(tests, properties);
|
|
|
|
parallel->SetPassFailVectors(&passed, &failed);
|
2008-07-03 17:31:33 +04:00
|
|
|
this->TestResults.clear();
|
2009-09-10 19:16:08 +04:00
|
|
|
parallel->SetTestResults(&this->TestResults);
|
2010-08-31 18:41:23 +04:00
|
|
|
|
|
|
|
if(this->CTest->ShouldPrintLabels())
|
|
|
|
{
|
|
|
|
parallel->PrintLabels();
|
|
|
|
}
|
|
|
|
else if(this->CTest->GetShowOnly())
|
2009-08-28 19:08:39 +04:00
|
|
|
{
|
2009-09-10 19:16:08 +04:00
|
|
|
parallel->PrintTestList();
|
2009-08-28 19:08:39 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-09-10 19:16:08 +04:00
|
|
|
parallel->RunTests();
|
2009-08-28 19:08:39 +04:00
|
|
|
}
|
2009-09-10 19:16:08 +04:00
|
|
|
delete parallel;
|
2009-08-31 18:28:39 +04:00
|
|
|
this->EndTest = this->CTest->CurrentTime();
|
|
|
|
this->EndTestTime = static_cast<unsigned int>(cmSystemTools::GetTime());
|
|
|
|
this->ElapsedTestingTime = cmSystemTools::GetTime() - elapsed_time_start;
|
2009-08-26 20:09:06 +04:00
|
|
|
*this->LogFile << "End testing: "
|
|
|
|
<< this->CTest->CurrentTime() << std::endl;
|
2004-09-09 16:41:05 +04:00
|
|
|
}
|
|
|
|
|
2005-01-27 23:54:47 +03:00
|
|
|
//----------------------------------------------------------------------
|
2013-08-08 00:25:48 +04:00
|
|
|
void cmCTestTestHandler::GenerateTestCommand(std::vector<std::string>&, int)
|
2004-09-09 16:41:05 +04:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2005-01-27 23:54:47 +03:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void cmCTestTestHandler::GenerateDartOutput(std::ostream& os)
|
2004-09-09 16:41:05 +04:00
|
|
|
{
|
2006-03-10 23:03:09 +03:00
|
|
|
if ( !this->CTest->GetProduceXML() )
|
2004-09-09 16:41:05 +04:00
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2009-01-12 17:11:29 +03:00
|
|
|
this->CTest->StartXML(os, this->AppendXML);
|
2004-09-09 16:41:05 +04:00
|
|
|
os << "<Testing>\n"
|
2006-03-10 23:03:09 +03:00
|
|
|
<< "\t<StartDateTime>" << this->StartTest << "</StartDateTime>\n"
|
2008-01-30 19:17:36 +03:00
|
|
|
<< "\t<StartTestTime>" << this->StartTestTime << "</StartTestTime>\n"
|
2004-09-09 16:41:05 +04:00
|
|
|
<< "\t<TestList>\n";
|
2006-03-10 23:03:09 +03:00
|
|
|
cmCTestTestHandler::TestResultsVector::size_type cc;
|
|
|
|
for ( cc = 0; cc < this->TestResults.size(); cc ++ )
|
2004-09-09 16:41:05 +04:00
|
|
|
{
|
2006-03-10 23:03:09 +03:00
|
|
|
cmCTestTestResult *result = &this->TestResults[cc];
|
|
|
|
std::string testPath = result->Path + "/" + result->Name;
|
2009-02-06 00:31:37 +03:00
|
|
|
os << "\t\t<Test>" << cmXMLSafe(
|
2006-03-10 23:03:09 +03:00
|
|
|
this->CTest->GetShortPathToFile(testPath.c_str()))
|
2004-09-09 16:41:05 +04:00
|
|
|
<< "</Test>" << std::endl;
|
|
|
|
}
|
|
|
|
os << "\t</TestList>\n";
|
2006-03-10 23:03:09 +03:00
|
|
|
for ( cc = 0; cc < this->TestResults.size(); cc ++ )
|
2004-09-09 16:41:05 +04:00
|
|
|
{
|
2006-03-10 23:03:09 +03:00
|
|
|
cmCTestTestResult *result = &this->TestResults[cc];
|
2009-02-02 21:24:26 +03:00
|
|
|
this->WriteTestResultHeader(os, result);
|
|
|
|
os << "\t\t<Results>" << std::endl;
|
2006-03-10 23:03:09 +03:00
|
|
|
if ( result->Status != cmCTestTestHandler::NOT_RUN )
|
2004-09-09 16:41:05 +04:00
|
|
|
{
|
2006-03-10 23:03:09 +03:00
|
|
|
if ( result->Status != cmCTestTestHandler::COMPLETED ||
|
|
|
|
result->ReturnValue )
|
2004-09-09 16:41:05 +04:00
|
|
|
{
|
2006-03-09 19:17:10 +03:00
|
|
|
os << "\t\t\t<NamedMeasurement type=\"text/string\" "
|
|
|
|
"name=\"Exit Code\"><Value>"
|
2009-02-06 00:31:37 +03:00
|
|
|
<< cmXMLSafe(this->GetTestStatus(result->Status))
|
2009-01-22 15:16:05 +03:00
|
|
|
<< "</Value>"
|
2006-03-09 19:17:10 +03:00
|
|
|
"</NamedMeasurement>\n"
|
|
|
|
<< "\t\t\t<NamedMeasurement type=\"text/string\" "
|
|
|
|
"name=\"Exit Value\"><Value>"
|
2009-01-22 15:16:05 +03:00
|
|
|
<< result->ReturnValue
|
|
|
|
<< "</Value></NamedMeasurement>"
|
2006-03-09 19:17:10 +03:00
|
|
|
<< std::endl;
|
2004-09-09 16:41:05 +04:00
|
|
|
}
|
2006-03-10 23:03:09 +03:00
|
|
|
os << result->RegressionImages;
|
2004-09-09 16:41:05 +04:00
|
|
|
os << "\t\t\t<NamedMeasurement type=\"numeric/double\" "
|
|
|
|
<< "name=\"Execution Time\"><Value>"
|
2009-01-22 15:16:05 +03:00
|
|
|
<< result->ExecutionTime
|
|
|
|
<< "</Value></NamedMeasurement>\n";
|
2009-02-25 01:23:51 +03:00
|
|
|
if(result->Reason.size())
|
2011-03-11 16:04:58 +03:00
|
|
|
{
|
2009-02-25 01:23:51 +03:00
|
|
|
const char* reasonType = "Pass Reason";
|
|
|
|
if(result->Status != cmCTestTestHandler::COMPLETED &&
|
|
|
|
result->Status != cmCTestTestHandler::NOT_RUN)
|
|
|
|
{
|
|
|
|
reasonType = "Fail Reason";
|
|
|
|
}
|
|
|
|
os << "\t\t\t<NamedMeasurement type=\"text/string\" "
|
|
|
|
<< "name=\"" << reasonType << "\"><Value>"
|
|
|
|
<< cmXMLSafe(result->Reason)
|
|
|
|
<< "</Value></NamedMeasurement>\n";
|
|
|
|
}
|
2006-03-09 19:17:10 +03:00
|
|
|
os
|
2004-09-09 16:41:05 +04:00
|
|
|
<< "\t\t\t<NamedMeasurement type=\"text/string\" "
|
|
|
|
<< "name=\"Completion Status\"><Value>"
|
2009-02-06 00:31:37 +03:00
|
|
|
<< cmXMLSafe(result->CompletionStatus)
|
2009-01-22 15:16:05 +03:00
|
|
|
<< "</Value></NamedMeasurement>\n";
|
2004-09-09 16:41:05 +04:00
|
|
|
}
|
2006-10-13 17:30:33 +04:00
|
|
|
os
|
|
|
|
<< "\t\t\t<NamedMeasurement type=\"text/string\" "
|
|
|
|
<< "name=\"Command Line\"><Value>"
|
2009-02-06 00:31:37 +03:00
|
|
|
<< cmXMLSafe(result->FullCommandLine)
|
2009-01-22 15:16:05 +03:00
|
|
|
<< "</Value></NamedMeasurement>\n";
|
2014-02-10 09:21:34 +04:00
|
|
|
std::map<std::string,std::string>::iterator measureIt;
|
2006-10-13 17:30:33 +04:00
|
|
|
for ( measureIt = result->Properties->Measurements.begin();
|
|
|
|
measureIt != result->Properties->Measurements.end();
|
|
|
|
++ measureIt )
|
|
|
|
{
|
|
|
|
os
|
|
|
|
<< "\t\t\t<NamedMeasurement type=\"text/string\" "
|
2014-03-11 16:35:32 +04:00
|
|
|
<< "name=\"" << measureIt->first << "\"><Value>"
|
2009-02-06 00:31:37 +03:00
|
|
|
<< cmXMLSafe(measureIt->second)
|
2009-01-22 15:16:05 +03:00
|
|
|
<< "</Value></NamedMeasurement>\n";
|
2006-10-13 17:30:33 +04:00
|
|
|
}
|
2006-03-09 19:17:10 +03:00
|
|
|
os
|
2004-09-09 16:41:05 +04:00
|
|
|
<< "\t\t\t<Measurement>\n"
|
2009-12-17 19:14:49 +03:00
|
|
|
<< "\t\t\t\t<Value"
|
2011-03-11 16:04:58 +03:00
|
|
|
<< (result->CompressOutput ?
|
2009-12-17 19:14:49 +03:00
|
|
|
" encoding=\"base64\" compression=\"gzip\">"
|
|
|
|
: ">");
|
2009-02-06 00:31:37 +03:00
|
|
|
os << cmXMLSafe(result->Output);
|
2004-09-09 16:41:05 +04:00
|
|
|
os
|
|
|
|
<< "</Value>\n"
|
|
|
|
<< "\t\t\t</Measurement>\n"
|
2009-01-07 18:41:37 +03:00
|
|
|
<< "\t\t</Results>\n";
|
2009-12-15 20:07:15 +03:00
|
|
|
|
|
|
|
this->AttachFiles(os, result);
|
2009-02-02 21:24:26 +03:00
|
|
|
this->WriteTestResultFooter(os, result);
|
2004-09-09 16:41:05 +04:00
|
|
|
}
|
|
|
|
|
2006-03-10 23:03:09 +03:00
|
|
|
os << "\t<EndDateTime>" << this->EndTest << "</EndDateTime>\n"
|
2008-01-30 19:17:36 +03:00
|
|
|
<< "\t<EndTestTime>" << this->EndTestTime << "</EndTestTime>\n"
|
2006-03-09 19:17:10 +03:00
|
|
|
<< "<ElapsedMinutes>"
|
2006-03-10 23:03:09 +03:00
|
|
|
<< static_cast<int>(this->ElapsedTestingTime/6)/10.0
|
2004-09-09 16:41:05 +04:00
|
|
|
<< "</ElapsedMinutes>"
|
|
|
|
<< "</Testing>" << std::endl;
|
2006-03-10 23:03:09 +03:00
|
|
|
this->CTest->EndXML(os);
|
2004-09-09 16:41:05 +04:00
|
|
|
}
|
|
|
|
|
2009-02-02 21:24:26 +03:00
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
void cmCTestTestHandler::WriteTestResultHeader(std::ostream& os,
|
|
|
|
cmCTestTestResult* result)
|
|
|
|
{
|
|
|
|
os << "\t<Test Status=\"";
|
|
|
|
if ( result->Status == cmCTestTestHandler::COMPLETED )
|
|
|
|
{
|
|
|
|
os << "passed";
|
|
|
|
}
|
|
|
|
else if ( result->Status == cmCTestTestHandler::NOT_RUN )
|
|
|
|
{
|
|
|
|
os << "notrun";
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
os << "failed";
|
|
|
|
}
|
|
|
|
std::string testPath = result->Path + "/" + result->Name;
|
|
|
|
os << "\">\n"
|
2009-02-06 00:31:37 +03:00
|
|
|
<< "\t\t<Name>" << cmXMLSafe(result->Name) << "</Name>\n"
|
|
|
|
<< "\t\t<Path>" << cmXMLSafe(
|
2009-02-02 21:24:26 +03:00
|
|
|
this->CTest->GetShortPathToFile(result->Path.c_str())) << "</Path>\n"
|
2009-02-06 00:31:37 +03:00
|
|
|
<< "\t\t<FullName>" << cmXMLSafe(
|
2009-02-02 21:24:26 +03:00
|
|
|
this->CTest->GetShortPathToFile(testPath.c_str())) << "</FullName>\n"
|
|
|
|
<< "\t\t<FullCommandLine>"
|
2009-02-06 00:31:37 +03:00
|
|
|
<< cmXMLSafe(result->FullCommandLine)
|
2009-02-02 21:24:26 +03:00
|
|
|
<< "</FullCommandLine>\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
void cmCTestTestHandler::WriteTestResultFooter(std::ostream& os,
|
|
|
|
cmCTestTestResult* result)
|
|
|
|
{
|
|
|
|
if(!result->Properties->Labels.empty())
|
|
|
|
{
|
|
|
|
os << "\t\t<Labels>\n";
|
|
|
|
std::vector<std::string> const& labels = result->Properties->Labels;
|
|
|
|
for(std::vector<std::string>::const_iterator li = labels.begin();
|
|
|
|
li != labels.end(); ++li)
|
|
|
|
{
|
2009-02-06 00:31:37 +03:00
|
|
|
os << "\t\t\t<Label>" << cmXMLSafe(*li) << "</Label>\n";
|
2009-02-02 21:24:26 +03:00
|
|
|
}
|
|
|
|
os << "\t\t</Labels>\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
os
|
|
|
|
<< "\t</Test>" << std::endl;
|
|
|
|
}
|
|
|
|
|
2009-12-15 22:24:24 +03:00
|
|
|
//----------------------------------------------------------------------
|
2009-12-15 20:07:15 +03:00
|
|
|
void cmCTestTestHandler::AttachFiles(std::ostream& os,
|
|
|
|
cmCTestTestResult* result)
|
|
|
|
{
|
2009-12-16 22:50:16 +03:00
|
|
|
if(result->Status != cmCTestTestHandler::COMPLETED
|
|
|
|
&& result->Properties->AttachOnFail.size())
|
|
|
|
{
|
|
|
|
result->Properties->AttachedFiles.insert(
|
|
|
|
result->Properties->AttachedFiles.end(),
|
|
|
|
result->Properties->AttachOnFail.begin(),
|
|
|
|
result->Properties->AttachOnFail.end());
|
|
|
|
}
|
2011-03-11 16:04:58 +03:00
|
|
|
for(std::vector<std::string>::const_iterator file =
|
2009-12-15 22:24:24 +03:00
|
|
|
result->Properties->AttachedFiles.begin();
|
|
|
|
file != result->Properties->AttachedFiles.end(); ++file)
|
|
|
|
{
|
2011-02-18 20:11:51 +03:00
|
|
|
std::string base64 = this->CTest->Base64GzipEncodeFile(*file);
|
2009-12-15 22:24:24 +03:00
|
|
|
std::string fname = cmSystemTools::GetFilenameName(*file);
|
|
|
|
os << "\t\t<NamedMeasurement name=\"Attached File\" encoding=\"base64\" "
|
|
|
|
"compression=\"tar/gzip\" filename=\"" << fname << "\" type=\"file\">"
|
|
|
|
"\n\t\t\t<Value>\n\t\t\t"
|
2009-12-16 22:50:16 +03:00
|
|
|
<< base64
|
|
|
|
<< "\n\t\t\t</Value>\n\t\t</NamedMeasurement>\n";
|
|
|
|
}
|
2009-12-15 20:07:15 +03:00
|
|
|
}
|
|
|
|
|
2005-01-27 23:54:47 +03:00
|
|
|
//----------------------------------------------------------------------
|
2014-02-10 09:21:34 +04:00
|
|
|
int cmCTestTestHandler::ExecuteCommands(std::vector<std::string>& vec)
|
2004-09-09 16:41:05 +04:00
|
|
|
{
|
2014-02-10 09:21:34 +04:00
|
|
|
std::vector<std::string>::iterator it;
|
2004-09-09 16:41:05 +04:00
|
|
|
for ( it = vec.begin(); it != vec.end(); ++it )
|
|
|
|
{
|
|
|
|
int retVal = 0;
|
2013-07-27 23:40:25 +04:00
|
|
|
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Run command: " << *it
|
2006-03-09 19:17:10 +03:00
|
|
|
<< std::endl);
|
2013-07-27 23:40:25 +04:00
|
|
|
if ( !cmSystemTools::RunSingleCommand(it->c_str(), 0, &retVal, 0,
|
2011-07-26 11:26:18 +04:00
|
|
|
cmSystemTools::OUTPUT_MERGE
|
2006-03-10 23:03:09 +03:00
|
|
|
/*this->Verbose*/) || retVal != 0 )
|
2004-09-09 16:41:05 +04:00
|
|
|
{
|
2006-03-10 23:03:09 +03:00
|
|
|
cmCTestLog(this->CTest, ERROR_MESSAGE, "Problem running command: "
|
|
|
|
<< *it << std::endl);
|
2004-09-09 16:41:05 +04:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-01-27 23:54:47 +03:00
|
|
|
//----------------------------------------------------------------------
|
2005-08-09 21:12:03 +04:00
|
|
|
// Find the appropriate executable to run for a test
|
2004-09-09 16:41:05 +04:00
|
|
|
std::string cmCTestTestHandler::FindTheExecutable(const char *exe)
|
|
|
|
{
|
2007-03-19 20:04:10 +03:00
|
|
|
std::string resConfig;
|
|
|
|
std::vector<std::string> extraPaths;
|
|
|
|
std::vector<std::string> failedPaths;
|
2011-06-10 17:29:30 +04:00
|
|
|
if(strcmp(exe, "NOT_AVAILABLE") == 0)
|
|
|
|
{
|
|
|
|
return exe;
|
|
|
|
}
|
2007-03-19 20:04:10 +03:00
|
|
|
return cmCTestTestHandler::FindExecutable(this->CTest,
|
|
|
|
exe, resConfig,
|
|
|
|
extraPaths,
|
|
|
|
failedPaths);
|
|
|
|
}
|
2004-09-09 16:41:05 +04:00
|
|
|
|
2008-05-30 17:14:25 +04:00
|
|
|
// add additional configurations to the search path
|
2007-03-19 20:04:10 +03:00
|
|
|
void cmCTestTestHandler
|
2011-03-11 16:04:58 +03:00
|
|
|
::AddConfigurations(cmCTest *ctest,
|
2007-03-19 20:04:10 +03:00
|
|
|
std::vector<std::string> &attempted,
|
|
|
|
std::vector<std::string> &attemptedConfigs,
|
|
|
|
std::string filepath,
|
|
|
|
std::string &filename)
|
2009-12-16 22:50:16 +03:00
|
|
|
{
|
2007-03-19 20:04:10 +03:00
|
|
|
std::string tempPath;
|
|
|
|
|
2011-03-11 16:04:58 +03:00
|
|
|
if (filepath.size() &&
|
2008-05-30 17:14:25 +04:00
|
|
|
filepath[filepath.size()-1] != '/')
|
2004-09-09 16:41:05 +04:00
|
|
|
{
|
2007-03-19 20:04:10 +03:00
|
|
|
filepath += "/";
|
2004-09-09 16:41:05 +04:00
|
|
|
}
|
2007-03-19 20:04:10 +03:00
|
|
|
tempPath = filepath + filename;
|
|
|
|
attempted.push_back(tempPath);
|
|
|
|
attemptedConfigs.push_back("");
|
2011-03-11 16:04:58 +03:00
|
|
|
|
2007-03-19 20:04:10 +03:00
|
|
|
if(ctest->GetConfigType().size())
|
2004-09-09 16:41:05 +04:00
|
|
|
{
|
2007-03-19 20:04:10 +03:00
|
|
|
tempPath = filepath;
|
|
|
|
tempPath += ctest->GetConfigType();
|
|
|
|
tempPath += "/";
|
|
|
|
tempPath += filename;
|
|
|
|
attempted.push_back(tempPath);
|
|
|
|
attemptedConfigs.push_back(ctest->GetConfigType());
|
2012-11-07 20:13:09 +04:00
|
|
|
// If the file is an OSX bundle then the configtype
|
2007-03-19 20:04:10 +03:00
|
|
|
// will be at the start of the path
|
|
|
|
tempPath = ctest->GetConfigType();
|
|
|
|
tempPath += "/";
|
|
|
|
tempPath += filepath;
|
|
|
|
tempPath += filename;
|
|
|
|
attempted.push_back(tempPath);
|
|
|
|
attemptedConfigs.push_back(ctest->GetConfigType());
|
2004-09-09 16:41:05 +04:00
|
|
|
}
|
2007-03-19 20:04:10 +03:00
|
|
|
else
|
2004-09-09 16:41:05 +04:00
|
|
|
{
|
2012-11-07 20:13:09 +04:00
|
|
|
// no config specified - try some options...
|
2007-03-19 20:04:10 +03:00
|
|
|
tempPath = filepath;
|
|
|
|
tempPath += "Release/";
|
|
|
|
tempPath += filename;
|
|
|
|
attempted.push_back(tempPath);
|
|
|
|
attemptedConfigs.push_back("Release");
|
|
|
|
tempPath = filepath;
|
|
|
|
tempPath += "Debug/";
|
|
|
|
tempPath += filename;
|
|
|
|
attempted.push_back(tempPath);
|
|
|
|
attemptedConfigs.push_back("Debug");
|
|
|
|
tempPath = filepath;
|
|
|
|
tempPath += "MinSizeRel/";
|
|
|
|
tempPath += filename;
|
|
|
|
attempted.push_back(tempPath);
|
|
|
|
attemptedConfigs.push_back("MinSizeRel");
|
|
|
|
tempPath = filepath;
|
|
|
|
tempPath += "RelWithDebInfo/";
|
|
|
|
tempPath += filename;
|
2011-03-11 16:04:58 +03:00
|
|
|
attempted.push_back(tempPath);
|
2007-03-19 20:04:10 +03:00
|
|
|
attemptedConfigs.push_back("RelWithDebInfo");
|
2007-09-11 19:21:36 +04:00
|
|
|
tempPath = filepath;
|
|
|
|
tempPath += "Deployment/";
|
|
|
|
tempPath += filename;
|
|
|
|
attempted.push_back(tempPath);
|
|
|
|
attemptedConfigs.push_back("Deployment");
|
|
|
|
tempPath = filepath;
|
|
|
|
tempPath += "Development/";
|
|
|
|
tempPath += filename;
|
|
|
|
attempted.push_back(tempPath);
|
|
|
|
attemptedConfigs.push_back("Deployment");
|
2007-03-19 20:04:10 +03:00
|
|
|
}
|
|
|
|
}
|
2005-08-30 21:58:46 +04:00
|
|
|
|
|
|
|
|
2007-03-19 20:04:10 +03:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// Find the appropriate executable to run for a test
|
|
|
|
std::string cmCTestTestHandler
|
|
|
|
::FindExecutable(cmCTest *ctest,
|
|
|
|
const char *testCommand,
|
|
|
|
std::string &resultingConfig,
|
|
|
|
std::vector<std::string> &extraPaths,
|
|
|
|
std::vector<std::string> &failed)
|
|
|
|
{
|
|
|
|
// now run the compiled test if we can find it
|
|
|
|
std::vector<std::string> attempted;
|
|
|
|
std::vector<std::string> attemptedConfigs;
|
|
|
|
std::string tempPath;
|
|
|
|
std::string filepath =
|
|
|
|
cmSystemTools::GetFilenamePath(testCommand);
|
|
|
|
std::string filename =
|
|
|
|
cmSystemTools::GetFilenameName(testCommand);
|
|
|
|
|
|
|
|
cmCTestTestHandler::AddConfigurations(ctest, attempted,
|
|
|
|
attemptedConfigs,
|
|
|
|
filepath,filename);
|
|
|
|
|
2008-10-01 17:04:27 +04:00
|
|
|
// even if a fullpath was specified also try it relative to the current
|
|
|
|
// directory
|
2008-05-30 17:14:25 +04:00
|
|
|
if (filepath.size() && filepath[0] == '/')
|
|
|
|
{
|
|
|
|
std::string localfilepath = filepath.substr(1,filepath.size()-1);
|
|
|
|
cmCTestTestHandler::AddConfigurations(ctest, attempted,
|
|
|
|
attemptedConfigs,
|
|
|
|
localfilepath,filename);
|
|
|
|
}
|
2011-03-11 16:04:58 +03:00
|
|
|
|
|
|
|
|
2007-03-19 20:04:10 +03:00
|
|
|
// if extraPaths are provided and we were not passed a full path, try them,
|
|
|
|
// try any extra paths
|
|
|
|
if (filepath.size() == 0)
|
|
|
|
{
|
|
|
|
for (unsigned int i = 0; i < extraPaths.size(); ++i)
|
2004-09-09 16:41:05 +04:00
|
|
|
{
|
2007-03-19 20:04:10 +03:00
|
|
|
std::string filepathExtra =
|
|
|
|
cmSystemTools::GetFilenamePath(extraPaths[i]);
|
|
|
|
std::string filenameExtra =
|
|
|
|
cmSystemTools::GetFilenameName(extraPaths[i]);
|
|
|
|
cmCTestTestHandler::AddConfigurations(ctest,attempted,
|
|
|
|
attemptedConfigs,
|
|
|
|
filepathExtra,
|
|
|
|
filenameExtra);
|
2004-09-09 16:41:05 +04:00
|
|
|
}
|
2011-03-11 16:04:58 +03:00
|
|
|
}
|
|
|
|
|
2007-03-19 20:04:10 +03:00
|
|
|
// store the final location in fullPath
|
|
|
|
std::string fullPath;
|
2004-09-09 16:41:05 +04:00
|
|
|
|
2007-03-19 20:04:10 +03:00
|
|
|
// now look in the paths we specified above
|
|
|
|
for(unsigned int ai=0;
|
|
|
|
ai < attempted.size() && fullPath.size() == 0; ++ai)
|
|
|
|
{
|
|
|
|
// first check without exe extension
|
|
|
|
if(cmSystemTools::FileExists(attempted[ai].c_str())
|
2014-10-15 16:54:05 +04:00
|
|
|
&& !cmSystemTools::FileIsDirectory(attempted[ai]))
|
2004-09-09 16:41:05 +04:00
|
|
|
{
|
2014-10-15 16:54:05 +04:00
|
|
|
fullPath = cmSystemTools::CollapseFullPath(attempted[ai]);
|
2007-03-19 20:04:10 +03:00
|
|
|
resultingConfig = attemptedConfigs[ai];
|
2004-09-09 16:41:05 +04:00
|
|
|
}
|
2007-03-19 20:04:10 +03:00
|
|
|
// then try with the exe extension
|
|
|
|
else
|
2004-09-09 16:41:05 +04:00
|
|
|
{
|
2014-03-11 03:04:11 +04:00
|
|
|
failed.push_back(attempted[ai]);
|
2007-03-19 20:04:10 +03:00
|
|
|
tempPath = attempted[ai];
|
|
|
|
tempPath += cmSystemTools::GetExecutableExtension();
|
|
|
|
if(cmSystemTools::FileExists(tempPath.c_str())
|
2014-10-15 16:54:05 +04:00
|
|
|
&& !cmSystemTools::FileIsDirectory(tempPath))
|
2007-03-19 20:04:10 +03:00
|
|
|
{
|
2014-10-15 16:54:05 +04:00
|
|
|
fullPath = cmSystemTools::CollapseFullPath(tempPath);
|
2007-03-19 20:04:10 +03:00
|
|
|
resultingConfig = attemptedConfigs[ai];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2014-03-11 03:04:11 +04:00
|
|
|
failed.push_back(tempPath);
|
2007-03-19 20:04:10 +03:00
|
|
|
}
|
2004-09-09 16:41:05 +04:00
|
|
|
}
|
|
|
|
}
|
2011-03-11 16:04:58 +03:00
|
|
|
|
2005-08-09 21:12:03 +04:00
|
|
|
// if everything else failed, check the users path, but only if a full path
|
2007-03-19 20:04:10 +03:00
|
|
|
// wasn't specified
|
|
|
|
if (fullPath.size() == 0 && filepath.size() == 0)
|
2004-09-09 16:41:05 +04:00
|
|
|
{
|
2007-03-19 20:04:10 +03:00
|
|
|
std::string path = cmSystemTools::FindProgram(filename.c_str());
|
2004-09-09 16:41:05 +04:00
|
|
|
if (path != "")
|
|
|
|
{
|
2007-03-19 20:04:10 +03:00
|
|
|
resultingConfig = "";
|
2004-09-09 16:41:05 +04:00
|
|
|
return path;
|
|
|
|
}
|
|
|
|
}
|
2007-09-17 18:40:57 +04:00
|
|
|
if(fullPath.size() == 0)
|
|
|
|
{
|
|
|
|
cmCTestLog(ctest, HANDLER_OUTPUT,
|
|
|
|
"Could not find executable " << testCommand << "\n"
|
|
|
|
<< "Looked in the following places:\n");
|
|
|
|
for(std::vector<std::string>::iterator i = failed.begin();
|
|
|
|
i != failed.end(); ++i)
|
|
|
|
{
|
|
|
|
cmCTestLog(ctest, HANDLER_OUTPUT,
|
|
|
|
i->c_str() << "\n");
|
|
|
|
}
|
|
|
|
}
|
2011-03-11 16:04:58 +03:00
|
|
|
|
2004-09-09 16:41:05 +04:00
|
|
|
return fullPath;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-01-27 23:54:47 +03:00
|
|
|
//----------------------------------------------------------------------
|
2005-06-07 17:06:38 +04:00
|
|
|
void cmCTestTestHandler::GetListOfTests()
|
2004-09-09 16:41:05 +04:00
|
|
|
{
|
2009-02-10 22:24:24 +03:00
|
|
|
if ( !this->IncludeLabelRegExp.empty() )
|
|
|
|
{
|
|
|
|
this->IncludeLabelRegularExpression.
|
|
|
|
compile(this->IncludeLabelRegExp.c_str());
|
|
|
|
}
|
2014-06-06 12:28:18 +04:00
|
|
|
if ( !this->ExcludeLabelRegExp.empty() )
|
2009-02-10 22:24:24 +03:00
|
|
|
{
|
|
|
|
this->ExcludeLabelRegularExpression.
|
|
|
|
compile(this->ExcludeLabelRegExp.c_str());
|
|
|
|
}
|
2006-03-10 23:03:09 +03:00
|
|
|
if ( !this->IncludeRegExp.empty() )
|
2005-06-07 17:06:38 +04:00
|
|
|
{
|
2006-03-10 23:03:09 +03:00
|
|
|
this->IncludeTestsRegularExpression.compile(this->IncludeRegExp.c_str());
|
2005-06-07 17:06:38 +04:00
|
|
|
}
|
2006-03-10 23:03:09 +03:00
|
|
|
if ( !this->ExcludeRegExp.empty() )
|
2005-06-07 17:06:38 +04:00
|
|
|
{
|
2006-03-10 23:03:09 +03:00
|
|
|
this->ExcludeTestsRegularExpression.compile(this->ExcludeRegExp.c_str());
|
2005-06-07 17:06:38 +04:00
|
|
|
}
|
2006-03-10 23:03:09 +03:00
|
|
|
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
|
|
|
"Constructing a list of tests" << std::endl);
|
2005-06-07 17:06:38 +04:00
|
|
|
cmake cm;
|
|
|
|
cmGlobalGenerator gg;
|
|
|
|
gg.SetCMakeInstance(&cm);
|
2012-11-21 03:56:36 +04:00
|
|
|
cmsys::auto_ptr<cmLocalGenerator> lg(gg.CreateLocalGenerator());
|
2005-06-07 17:06:38 +04:00
|
|
|
cmMakefile *mf = lg->GetMakefile();
|
2006-03-09 19:17:10 +03:00
|
|
|
mf->AddDefinition("CTEST_CONFIGURATION_TYPE",
|
2006-03-10 23:03:09 +03:00
|
|
|
this->CTest->GetConfigType().c_str());
|
2005-06-07 17:06:38 +04:00
|
|
|
|
|
|
|
// Add handler for ADD_TEST
|
|
|
|
cmCTestAddTestCommand* newCom1 = new cmCTestAddTestCommand;
|
2006-03-10 23:03:09 +03:00
|
|
|
newCom1->TestHandler = this;
|
2005-06-07 17:06:38 +04:00
|
|
|
cm.AddCommand(newCom1);
|
|
|
|
|
2008-01-19 23:09:36 +03:00
|
|
|
// Add handler for SUBDIRS
|
2011-03-11 16:04:58 +03:00
|
|
|
cmCTestSubdirCommand* newCom2 =
|
2008-01-19 23:09:36 +03:00
|
|
|
new cmCTestSubdirCommand;
|
2006-03-10 23:03:09 +03:00
|
|
|
newCom2->TestHandler = this;
|
2005-06-07 17:06:38 +04:00
|
|
|
cm.AddCommand(newCom2);
|
|
|
|
|
2008-01-19 23:09:36 +03:00
|
|
|
// Add handler for ADD_SUBDIRECTORY
|
2011-03-11 16:04:58 +03:00
|
|
|
cmCTestAddSubdirectoryCommand* newCom3 =
|
2008-01-19 23:09:36 +03:00
|
|
|
new cmCTestAddSubdirectoryCommand;
|
2006-03-10 23:03:09 +03:00
|
|
|
newCom3->TestHandler = this;
|
2005-09-07 07:31:41 +04:00
|
|
|
cm.AddCommand(newCom3);
|
|
|
|
|
2008-01-19 23:09:36 +03:00
|
|
|
// Add handler for SET_SOURCE_FILES_PROPERTIES
|
|
|
|
cmCTestSetTestsPropertiesCommand* newCom4
|
|
|
|
= new cmCTestSetTestsPropertiesCommand;
|
|
|
|
newCom4->TestHandler = this;
|
|
|
|
cm.AddCommand(newCom4);
|
|
|
|
|
2005-06-20 16:59:33 +04:00
|
|
|
const char* testFilename;
|
2005-04-01 23:57:55 +04:00
|
|
|
if( cmSystemTools::FileExists("CTestTestfile.cmake") )
|
|
|
|
{
|
|
|
|
// does the CTestTestfile.cmake exist ?
|
|
|
|
testFilename = "CTestTestfile.cmake";
|
|
|
|
}
|
2008-02-01 00:33:07 +03:00
|
|
|
else if( cmSystemTools::FileExists("DartTestfile.txt") )
|
2008-01-31 19:43:44 +03:00
|
|
|
{
|
|
|
|
// does the DartTestfile.txt exist ?
|
|
|
|
testFilename = "DartTestfile.txt";
|
|
|
|
}
|
2005-04-01 23:57:55 +04:00
|
|
|
else
|
2004-09-09 16:41:05 +04:00
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2005-06-07 17:06:38 +04:00
|
|
|
if ( !mf->ReadListFile(0, testFilename) )
|
2004-09-09 16:41:05 +04:00
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2005-06-07 17:06:38 +04:00
|
|
|
if ( cmSystemTools::GetErrorOccuredFlag() )
|
2004-09-09 16:41:05 +04:00
|
|
|
{
|
2005-06-07 17:06:38 +04:00
|
|
|
return;
|
2004-09-09 16:41:05 +04:00
|
|
|
}
|
2006-03-10 23:03:09 +03:00
|
|
|
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
2006-03-09 19:17:10 +03:00
|
|
|
"Done constructing a list of tests" << std::endl);
|
2004-09-09 16:41:05 +04:00
|
|
|
}
|
|
|
|
|
2005-01-27 23:54:47 +03:00
|
|
|
//----------------------------------------------------------------------
|
2004-09-09 16:41:05 +04:00
|
|
|
void cmCTestTestHandler::UseIncludeRegExp()
|
|
|
|
{
|
2006-03-10 23:03:09 +03:00
|
|
|
this->UseIncludeRegExpFlag = true;
|
2004-09-09 16:41:05 +04:00
|
|
|
}
|
|
|
|
|
2005-01-27 23:54:47 +03:00
|
|
|
//----------------------------------------------------------------------
|
2004-09-09 16:41:05 +04:00
|
|
|
void cmCTestTestHandler::UseExcludeRegExp()
|
|
|
|
{
|
2006-03-10 23:03:09 +03:00
|
|
|
this->UseExcludeRegExpFlag = true;
|
|
|
|
this->UseExcludeRegExpFirst = this->UseIncludeRegExpFlag ? false : true;
|
2004-09-09 16:41:05 +04:00
|
|
|
}
|
2006-03-09 19:17:10 +03:00
|
|
|
|
2005-01-27 23:54:47 +03:00
|
|
|
//----------------------------------------------------------------------
|
2004-09-09 16:41:05 +04:00
|
|
|
const char* cmCTestTestHandler::GetTestStatus(int status)
|
|
|
|
{
|
|
|
|
static const char statuses[][100] = {
|
|
|
|
"Not Run",
|
|
|
|
"Timeout",
|
|
|
|
"SEGFAULT",
|
|
|
|
"ILLEGAL",
|
|
|
|
"INTERRUPT",
|
|
|
|
"NUMERICAL",
|
|
|
|
"OTHER_FAULT",
|
|
|
|
"Failed",
|
|
|
|
"BAD_COMMAND",
|
|
|
|
"Completed"
|
|
|
|
};
|
|
|
|
|
2006-03-09 19:17:10 +03:00
|
|
|
if ( status < cmCTestTestHandler::NOT_RUN ||
|
2004-09-09 16:41:05 +04:00
|
|
|
status > cmCTestTestHandler::COMPLETED )
|
|
|
|
{
|
|
|
|
return "No Status";
|
|
|
|
}
|
|
|
|
return statuses[status];
|
|
|
|
}
|
|
|
|
|
2005-01-27 23:54:47 +03:00
|
|
|
//----------------------------------------------------------------------
|
2008-07-07 03:58:38 +04:00
|
|
|
void cmCTestTestHandler::ExpandTestsToRunInformation(size_t numTests)
|
2004-09-09 16:41:05 +04:00
|
|
|
{
|
|
|
|
if (this->TestsToRunString.empty())
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2006-03-09 19:17:10 +03:00
|
|
|
|
2004-09-09 16:41:05 +04:00
|
|
|
int start;
|
|
|
|
int end = -1;
|
|
|
|
double stride = -1;
|
|
|
|
std::string::size_type pos = 0;
|
|
|
|
std::string::size_type pos2;
|
|
|
|
// read start
|
|
|
|
if(GetNextNumber(this->TestsToRunString, start, pos, pos2))
|
|
|
|
{
|
|
|
|
// read end
|
|
|
|
if(GetNextNumber(this->TestsToRunString, end, pos, pos2))
|
|
|
|
{
|
|
|
|
// read stride
|
|
|
|
if(GetNextRealNumber(this->TestsToRunString, stride, pos, pos2))
|
|
|
|
{
|
|
|
|
int val =0;
|
|
|
|
// now read specific numbers
|
|
|
|
while(GetNextNumber(this->TestsToRunString, val, pos, pos2))
|
|
|
|
{
|
2006-03-10 23:03:09 +03:00
|
|
|
this->TestsToRun.push_back(val);
|
2004-09-09 16:41:05 +04:00
|
|
|
}
|
2006-03-10 23:03:09 +03:00
|
|
|
this->TestsToRun.push_back(val);
|
2004-09-09 16:41:05 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// if start is not specified then we assume we start at 1
|
|
|
|
if(start == -1)
|
|
|
|
{
|
|
|
|
start = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
// if end isnot specified then we assume we end with the last test
|
|
|
|
if(end == -1)
|
|
|
|
{
|
2008-07-07 06:06:08 +04:00
|
|
|
end = static_cast<int>(numTests);
|
2004-09-09 16:41:05 +04:00
|
|
|
}
|
2006-03-09 19:17:10 +03:00
|
|
|
|
2004-09-09 16:41:05 +04:00
|
|
|
// if the stride wasn't specified then it defaults to 1
|
|
|
|
if(stride == -1)
|
|
|
|
{
|
|
|
|
stride = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
// if we have a range then add it
|
|
|
|
if(end != -1 && start != -1 && stride > 0)
|
|
|
|
{
|
|
|
|
int i = 0;
|
|
|
|
while (i*stride + start <= end)
|
|
|
|
{
|
2006-03-10 23:03:09 +03:00
|
|
|
this->TestsToRun.push_back(static_cast<int>(i*stride+start));
|
2004-09-09 16:41:05 +04:00
|
|
|
++i;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// sort the array
|
2006-03-10 23:03:09 +03:00
|
|
|
std::sort(this->TestsToRun.begin(), this->TestsToRun.end(),
|
|
|
|
std::less<int>());
|
2004-09-09 16:41:05 +04:00
|
|
|
// remove duplicates
|
2006-03-09 19:17:10 +03:00
|
|
|
std::vector<int>::iterator new_end =
|
2006-03-10 23:03:09 +03:00
|
|
|
std::unique(this->TestsToRun.begin(), this->TestsToRun.end());
|
|
|
|
this->TestsToRun.erase(new_end, this->TestsToRun.end());
|
2004-09-09 16:41:05 +04:00
|
|
|
}
|
|
|
|
|
2013-09-24 22:20:38 +04:00
|
|
|
void cmCTestTestHandler::ExpandTestsToRunInformationForRerunFailed()
|
|
|
|
{
|
|
|
|
|
|
|
|
std::string dirName = this->CTest->GetBinaryDir() + "/Testing/Temporary";
|
|
|
|
|
|
|
|
cmsys::Directory directory;
|
2014-10-15 16:54:05 +04:00
|
|
|
if (directory.Load(dirName) == 0)
|
2013-09-24 22:20:38 +04:00
|
|
|
{
|
|
|
|
cmCTestLog(this->CTest, ERROR_MESSAGE, "Unable to read the contents of "
|
|
|
|
<< dirName << std::endl);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
int numFiles = static_cast<int>
|
2014-10-15 16:54:05 +04:00
|
|
|
(cmsys::Directory::GetNumberOfFilesInDirectory(dirName));
|
2013-09-24 22:20:38 +04:00
|
|
|
std::string pattern = "LastTestsFailed";
|
|
|
|
std::string logName = "";
|
|
|
|
|
|
|
|
for (int i = 0; i < numFiles; ++i)
|
|
|
|
{
|
|
|
|
std::string fileName = directory.GetFile(i);
|
|
|
|
// bcc crashes if we attempt a normal substring comparison,
|
|
|
|
// hence the following workaround
|
|
|
|
std::string fileNameSubstring = fileName.substr(0, pattern.length());
|
|
|
|
if (fileNameSubstring.compare(pattern) != 0)
|
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if (logName == "")
|
|
|
|
{
|
|
|
|
logName = fileName;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// if multiple matching logs were found we use the most recently
|
|
|
|
// modified one.
|
|
|
|
int res;
|
2014-10-15 16:54:05 +04:00
|
|
|
cmSystemTools::FileTimeCompare(logName, fileName, &res);
|
2013-09-24 22:20:38 +04:00
|
|
|
if (res == -1)
|
|
|
|
{
|
|
|
|
logName = fileName;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
std::string lastTestsFailedLog = this->CTest->GetBinaryDir()
|
|
|
|
+ "/Testing/Temporary/" + logName;
|
|
|
|
|
|
|
|
if ( !cmSystemTools::FileExists(lastTestsFailedLog.c_str()) )
|
|
|
|
{
|
|
|
|
if ( !this->CTest->GetShowOnly() && !this->CTest->ShouldPrintLabels() )
|
|
|
|
{
|
|
|
|
cmCTestLog(this->CTest, ERROR_MESSAGE, lastTestsFailedLog
|
|
|
|
<< " does not exist!" << std::endl);
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// parse the list of tests to rerun from LastTestsFailed.log
|
2014-01-04 09:47:13 +04:00
|
|
|
cmsys::ifstream ifs(lastTestsFailedLog.c_str());
|
2013-09-24 22:20:38 +04:00
|
|
|
if ( ifs )
|
|
|
|
{
|
|
|
|
std::string line;
|
|
|
|
std::string::size_type pos;
|
|
|
|
while ( cmSystemTools::GetLineFromStream(ifs, line) )
|
|
|
|
{
|
|
|
|
pos = line.find(':', 0);
|
|
|
|
if (pos == line.npos)
|
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
int val = atoi(line.substr(0, pos).c_str());
|
|
|
|
this->TestsToRun.push_back(val);
|
|
|
|
}
|
|
|
|
ifs.close();
|
|
|
|
}
|
|
|
|
else if ( !this->CTest->GetShowOnly() && !this->CTest->ShouldPrintLabels() )
|
|
|
|
{
|
|
|
|
cmCTestLog(this->CTest, ERROR_MESSAGE, "Problem reading file: "
|
2014-03-11 16:35:32 +04:00
|
|
|
<< lastTestsFailedLog <<
|
2013-09-24 22:20:38 +04:00
|
|
|
" while generating list of previously failed tests." << std::endl);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-01-27 23:54:47 +03:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// Just for convenience
|
2004-09-09 16:41:05 +04:00
|
|
|
#define SPACE_REGEX "[ \t\r\n]"
|
2005-01-27 23:54:47 +03:00
|
|
|
//----------------------------------------------------------------------
|
2004-09-09 16:41:05 +04:00
|
|
|
std::string cmCTestTestHandler::GenerateRegressionImages(
|
|
|
|
const std::string& xml)
|
|
|
|
{
|
|
|
|
cmsys::RegularExpression twoattributes(
|
2006-03-09 19:17:10 +03:00
|
|
|
"<DartMeasurement"
|
|
|
|
SPACE_REGEX "*(name|type|encoding|compression)=\"([^\"]*)\""
|
|
|
|
SPACE_REGEX "*(name|type|encoding|compression)=\"([^\"]*)\""
|
2004-09-09 16:41:05 +04:00
|
|
|
SPACE_REGEX "*>([^<]*)</DartMeasurement>");
|
|
|
|
cmsys::RegularExpression threeattributes(
|
2006-03-09 19:17:10 +03:00
|
|
|
"<DartMeasurement"
|
|
|
|
SPACE_REGEX "*(name|type|encoding|compression)=\"([^\"]*)\""
|
|
|
|
SPACE_REGEX "*(name|type|encoding|compression)=\"([^\"]*)\""
|
|
|
|
SPACE_REGEX "*(name|type|encoding|compression)=\"([^\"]*)\""
|
2004-09-09 16:41:05 +04:00
|
|
|
SPACE_REGEX "*>([^<]*)</DartMeasurement>");
|
|
|
|
cmsys::RegularExpression fourattributes(
|
2006-03-09 19:17:10 +03:00
|
|
|
"<DartMeasurement"
|
|
|
|
SPACE_REGEX "*(name|type|encoding|compression)=\"([^\"]*)\""
|
|
|
|
SPACE_REGEX "*(name|type|encoding|compression)=\"([^\"]*)\""
|
|
|
|
SPACE_REGEX "*(name|type|encoding|compression)=\"([^\"]*)\""
|
|
|
|
SPACE_REGEX "*(name|type|encoding|compression)=\"([^\"]*)\""
|
2004-09-09 16:41:05 +04:00
|
|
|
SPACE_REGEX "*>([^<]*)</DartMeasurement>");
|
2008-06-17 22:03:49 +04:00
|
|
|
cmsys::RegularExpression cdatastart(
|
2008-05-23 19:28:46 +04:00
|
|
|
"<DartMeasurement"
|
|
|
|
SPACE_REGEX "*(name|type|encoding|compression)=\"([^\"]*)\""
|
|
|
|
SPACE_REGEX "*(name|type|encoding|compression)=\"([^\"]*)\""
|
2008-06-17 22:03:49 +04:00
|
|
|
SPACE_REGEX "*>"
|
|
|
|
SPACE_REGEX "*<!\\[CDATA\\[");
|
|
|
|
cmsys::RegularExpression cdataend(
|
|
|
|
"]]>"
|
|
|
|
SPACE_REGEX "*</DartMeasurement>");
|
2004-09-09 16:41:05 +04:00
|
|
|
cmsys::RegularExpression measurementfile(
|
2006-03-09 19:17:10 +03:00
|
|
|
"<DartMeasurementFile"
|
|
|
|
SPACE_REGEX "*(name|type|encoding|compression)=\"([^\"]*)\""
|
|
|
|
SPACE_REGEX "*(name|type|encoding|compression)=\"([^\"]*)\""
|
2004-09-09 16:41:05 +04:00
|
|
|
SPACE_REGEX "*>([^<]*)</DartMeasurementFile>");
|
|
|
|
|
|
|
|
cmOStringStream ostr;
|
|
|
|
bool done = false;
|
|
|
|
std::string cxml = xml;
|
|
|
|
while ( ! done )
|
|
|
|
{
|
|
|
|
if ( twoattributes.find(cxml) )
|
|
|
|
{
|
|
|
|
ostr
|
2006-03-09 19:17:10 +03:00
|
|
|
<< "\t\t\t<NamedMeasurement"
|
|
|
|
<< " " << twoattributes.match(1) << "=\""
|
|
|
|
<< twoattributes.match(2) << "\""
|
|
|
|
<< " " << twoattributes.match(3) << "=\""
|
|
|
|
<< twoattributes.match(4) << "\""
|
|
|
|
<< "><Value>" << twoattributes.match(5)
|
|
|
|
<< "</Value></NamedMeasurement>"
|
2004-09-09 16:41:05 +04:00
|
|
|
<< std::endl;
|
2006-03-09 19:17:10 +03:00
|
|
|
cxml.erase(twoattributes.start(),
|
|
|
|
twoattributes.end() - twoattributes.start());
|
2004-09-09 16:41:05 +04:00
|
|
|
}
|
|
|
|
else if ( threeattributes.find(cxml) )
|
|
|
|
{
|
|
|
|
ostr
|
2006-03-09 19:17:10 +03:00
|
|
|
<< "\t\t\t<NamedMeasurement"
|
|
|
|
<< " " << threeattributes.match(1) << "=\""
|
|
|
|
<< threeattributes.match(2) << "\""
|
|
|
|
<< " " << threeattributes.match(3) << "=\""
|
|
|
|
<< threeattributes.match(4) << "\""
|
|
|
|
<< " " << threeattributes.match(5) << "=\""
|
|
|
|
<< threeattributes.match(6) << "\""
|
|
|
|
<< "><Value>" << threeattributes.match(7)
|
|
|
|
<< "</Value></NamedMeasurement>"
|
2004-09-09 16:41:05 +04:00
|
|
|
<< std::endl;
|
2006-03-09 19:17:10 +03:00
|
|
|
cxml.erase(threeattributes.start(),
|
|
|
|
threeattributes.end() - threeattributes.start());
|
2004-09-09 16:41:05 +04:00
|
|
|
}
|
|
|
|
else if ( fourattributes.find(cxml) )
|
|
|
|
{
|
|
|
|
ostr
|
2006-03-09 19:17:10 +03:00
|
|
|
<< "\t\t\t<NamedMeasurement"
|
|
|
|
<< " " << fourattributes.match(1) << "=\""
|
|
|
|
<< fourattributes.match(2) << "\""
|
|
|
|
<< " " << fourattributes.match(3) << "=\""
|
|
|
|
<< fourattributes.match(4) << "\""
|
|
|
|
<< " " << fourattributes.match(5) << "=\""
|
|
|
|
<< fourattributes.match(6) << "\""
|
|
|
|
<< " " << fourattributes.match(7) << "=\""
|
|
|
|
<< fourattributes.match(8) << "\""
|
|
|
|
<< "><Value>" << fourattributes.match(9)
|
|
|
|
<< "</Value></NamedMeasurement>"
|
2004-09-09 16:41:05 +04:00
|
|
|
<< std::endl;
|
2006-03-09 19:17:10 +03:00
|
|
|
cxml.erase(fourattributes.start(),
|
|
|
|
fourattributes.end() - fourattributes.start());
|
2004-09-09 16:41:05 +04:00
|
|
|
}
|
2008-06-17 22:03:49 +04:00
|
|
|
else if ( cdatastart.find(cxml) && cdataend.find(cxml) )
|
2008-05-23 19:28:46 +04:00
|
|
|
{
|
|
|
|
ostr
|
|
|
|
<< "\t\t\t<NamedMeasurement"
|
2008-06-17 22:03:49 +04:00
|
|
|
<< " " << cdatastart.match(1) << "=\""
|
|
|
|
<< cdatastart.match(2) << "\""
|
|
|
|
<< " " << cdatastart.match(3) << "=\""
|
|
|
|
<< cdatastart.match(4) << "\""
|
|
|
|
<< "><Value><![CDATA["
|
|
|
|
<< cxml.substr(cdatastart.end(), cdataend.start() - cdatastart.end())
|
|
|
|
<< "]]></Value></NamedMeasurement>"
|
2008-05-23 19:28:46 +04:00
|
|
|
<< std::endl;
|
2008-06-17 22:03:49 +04:00
|
|
|
cxml.erase(cdatastart.start(),
|
|
|
|
cdataend.end() - cdatastart.start());
|
2008-05-23 19:28:46 +04:00
|
|
|
}
|
2004-09-09 16:41:05 +04:00
|
|
|
else if ( measurementfile.find(cxml) )
|
|
|
|
{
|
2006-03-09 19:17:10 +03:00
|
|
|
const std::string& filename =
|
2004-09-09 16:41:05 +04:00
|
|
|
cmCTest::CleanString(measurementfile.match(5));
|
|
|
|
if ( cmSystemTools::FileExists(filename.c_str()) )
|
|
|
|
{
|
2014-11-23 13:05:50 +03:00
|
|
|
long len = cmSystemTools::FileLength(filename);
|
2004-09-09 16:41:05 +04:00
|
|
|
if ( len == 0 )
|
|
|
|
{
|
|
|
|
std::string k1 = measurementfile.match(1);
|
|
|
|
std::string v1 = measurementfile.match(2);
|
|
|
|
std::string k2 = measurementfile.match(3);
|
|
|
|
std::string v2 = measurementfile.match(4);
|
|
|
|
if ( cmSystemTools::LowerCase(k1) == "type" )
|
|
|
|
{
|
|
|
|
v1 = "text/string";
|
|
|
|
}
|
|
|
|
if ( cmSystemTools::LowerCase(k2) == "type" )
|
|
|
|
{
|
|
|
|
v2 = "text/string";
|
2006-03-09 19:17:10 +03:00
|
|
|
}
|
|
|
|
|
2004-09-09 16:41:05 +04:00
|
|
|
ostr
|
2006-03-09 19:17:10 +03:00
|
|
|
<< "\t\t\t<NamedMeasurement"
|
2004-09-09 16:41:05 +04:00
|
|
|
<< " " << k1 << "=\"" << v1 << "\""
|
|
|
|
<< " " << k2 << "=\"" << v2 << "\""
|
|
|
|
<< " encoding=\"none\""
|
2014-03-11 16:35:32 +04:00
|
|
|
<< "><Value>Image " << filename
|
2004-09-09 16:41:05 +04:00
|
|
|
<< " is empty</Value></NamedMeasurement>";
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2014-01-04 09:47:13 +04:00
|
|
|
cmsys::ifstream ifs(filename.c_str(), std::ios::in
|
2004-09-09 16:41:05 +04:00
|
|
|
#ifdef _WIN32
|
|
|
|
| std::ios::binary
|
|
|
|
#endif
|
|
|
|
);
|
|
|
|
unsigned char *file_buffer = new unsigned char [ len + 1 ];
|
|
|
|
ifs.read(reinterpret_cast<char*>(file_buffer), len);
|
2006-03-09 19:17:10 +03:00
|
|
|
unsigned char *encoded_buffer
|
2010-06-27 19:22:05 +04:00
|
|
|
= new unsigned char [ static_cast<int>(
|
|
|
|
static_cast<double>(len) * 1.5 + 5.0) ];
|
2006-03-09 19:17:10 +03:00
|
|
|
|
|
|
|
unsigned long rlen
|
|
|
|
= cmsysBase64_Encode(file_buffer, len, encoded_buffer, 1);
|
2004-09-09 16:41:05 +04:00
|
|
|
unsigned long cc;
|
2006-03-09 19:17:10 +03:00
|
|
|
|
2004-09-09 16:41:05 +04:00
|
|
|
ostr
|
2006-03-09 19:17:10 +03:00
|
|
|
<< "\t\t\t<NamedMeasurement"
|
|
|
|
<< " " << measurementfile.match(1) << "=\""
|
|
|
|
<< measurementfile.match(2) << "\""
|
|
|
|
<< " " << measurementfile.match(3) << "=\""
|
|
|
|
<< measurementfile.match(4) << "\""
|
2004-09-09 16:41:05 +04:00
|
|
|
<< " encoding=\"base64\""
|
|
|
|
<< ">" << std::endl << "\t\t\t\t<Value>";
|
|
|
|
for ( cc = 0; cc < rlen; cc ++ )
|
|
|
|
{
|
|
|
|
ostr << encoded_buffer[cc];
|
|
|
|
if ( cc % 60 == 0 && cc )
|
|
|
|
{
|
|
|
|
ostr << std::endl;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ostr
|
2006-03-09 19:17:10 +03:00
|
|
|
<< "</Value>" << std::endl << "\t\t\t</NamedMeasurement>"
|
2004-09-09 16:41:05 +04:00
|
|
|
<< std::endl;
|
|
|
|
delete [] file_buffer;
|
|
|
|
delete [] encoded_buffer;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
int idx = 4;
|
|
|
|
if ( measurementfile.match(1) == "name" )
|
|
|
|
{
|
|
|
|
idx = 2;
|
|
|
|
}
|
|
|
|
ostr
|
2006-03-09 19:17:10 +03:00
|
|
|
<< "\t\t\t<NamedMeasurement"
|
2004-09-09 16:41:05 +04:00
|
|
|
<< " name=\"" << measurementfile.match(idx) << "\""
|
|
|
|
<< " text=\"text/string\""
|
2014-03-11 16:35:32 +04:00
|
|
|
<< "><Value>File " << filename
|
2006-03-09 19:17:10 +03:00
|
|
|
<< " not found</Value></NamedMeasurement>"
|
2004-09-09 16:41:05 +04:00
|
|
|
<< std::endl;
|
2014-03-11 16:35:32 +04:00
|
|
|
cmCTestLog(this->CTest, HANDLER_OUTPUT, "File \"" << filename
|
2006-03-09 19:17:10 +03:00
|
|
|
<< "\" not found." << std::endl);
|
2004-09-09 16:41:05 +04:00
|
|
|
}
|
2006-03-09 19:17:10 +03:00
|
|
|
cxml.erase(measurementfile.start(),
|
|
|
|
measurementfile.end() - measurementfile.start());
|
2004-09-09 16:41:05 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
done = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return ostr.str();
|
|
|
|
}
|
|
|
|
|
2005-01-27 23:54:47 +03:00
|
|
|
//----------------------------------------------------------------------
|
2004-09-09 16:41:05 +04:00
|
|
|
void cmCTestTestHandler::SetIncludeRegExp(const char *arg)
|
|
|
|
{
|
2006-03-10 23:03:09 +03:00
|
|
|
this->IncludeRegExp = arg;
|
2004-09-09 16:41:05 +04:00
|
|
|
}
|
|
|
|
|
2005-01-27 23:54:47 +03:00
|
|
|
//----------------------------------------------------------------------
|
2004-09-09 16:41:05 +04:00
|
|
|
void cmCTestTestHandler::SetExcludeRegExp(const char *arg)
|
|
|
|
{
|
2006-03-10 23:03:09 +03:00
|
|
|
this->ExcludeRegExp = arg;
|
2004-09-09 16:41:05 +04:00
|
|
|
}
|
|
|
|
|
2005-01-27 23:54:47 +03:00
|
|
|
//----------------------------------------------------------------------
|
2004-09-09 16:41:05 +04:00
|
|
|
void cmCTestTestHandler::SetTestsToRunInformation(const char* in)
|
|
|
|
{
|
2005-02-18 00:59:22 +03:00
|
|
|
if ( !in )
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2004-09-09 16:41:05 +04:00
|
|
|
this->TestsToRunString = in;
|
2006-03-09 19:17:10 +03:00
|
|
|
// if the argument is a file, then read it and use the contents as the
|
|
|
|
// string
|
2004-09-09 16:41:05 +04:00
|
|
|
if(cmSystemTools::FileExists(in))
|
|
|
|
{
|
2014-01-04 09:47:13 +04:00
|
|
|
cmsys::ifstream fin(in);
|
2004-09-09 16:41:05 +04:00
|
|
|
unsigned long filelen = cmSystemTools::FileLength(in);
|
|
|
|
char* buff = new char[filelen+1];
|
|
|
|
fin.getline(buff, filelen);
|
|
|
|
buff[fin.gcount()] = 0;
|
|
|
|
this->TestsToRunString = buff;
|
2011-06-07 00:41:17 +04:00
|
|
|
delete [] buff;
|
2004-09-09 16:41:05 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-01-04 21:20:49 +03:00
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
bool cmCTestTestHandler::CleanTestOutput(std::string& output, size_t length)
|
2005-01-26 19:13:12 +03:00
|
|
|
{
|
2011-01-04 21:20:49 +03:00
|
|
|
if(!length || length >= output.size() ||
|
|
|
|
output.find("CTEST_FULL_OUTPUT") != output.npos)
|
2005-01-26 19:13:12 +03:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
2011-01-04 21:20:49 +03:00
|
|
|
|
|
|
|
// Truncate at given length but do not break in the middle of a multi-byte
|
|
|
|
// UTF-8 encoding.
|
|
|
|
char const* const begin = output.c_str();
|
|
|
|
char const* const end = begin + output.size();
|
|
|
|
char const* const truncate = begin + length;
|
|
|
|
char const* current = begin;
|
|
|
|
while(current < truncate)
|
2005-01-26 19:13:12 +03:00
|
|
|
{
|
2011-01-04 21:20:49 +03:00
|
|
|
unsigned int ch;
|
|
|
|
if(const char* next = cm_utf8_decode_character(current, end, &ch))
|
2005-01-26 19:13:12 +03:00
|
|
|
{
|
2011-01-04 21:20:49 +03:00
|
|
|
if(next > truncate)
|
2005-01-26 19:13:12 +03:00
|
|
|
{
|
2011-01-04 21:20:49 +03:00
|
|
|
break;
|
2005-01-26 19:13:12 +03:00
|
|
|
}
|
2011-01-04 21:20:49 +03:00
|
|
|
current = next;
|
2005-01-26 19:13:12 +03:00
|
|
|
}
|
2011-01-04 21:20:49 +03:00
|
|
|
else // Bad byte will be handled by cmXMLSafe.
|
2005-01-26 19:13:12 +03:00
|
|
|
{
|
2011-01-04 21:20:49 +03:00
|
|
|
++current;
|
2005-01-26 19:13:12 +03:00
|
|
|
}
|
|
|
|
}
|
2011-01-04 21:20:49 +03:00
|
|
|
output = output.substr(0, current - begin);
|
|
|
|
|
|
|
|
// Append truncation message.
|
|
|
|
cmOStringStream msg;
|
|
|
|
msg << "...\n"
|
|
|
|
"The rest of the test output was removed since it exceeds the threshold "
|
|
|
|
"of " << length << " bytes.\n";
|
|
|
|
output += msg.str();
|
2005-01-26 19:13:12 +03:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2005-09-07 07:31:41 +04:00
|
|
|
//----------------------------------------------------------------------
|
2006-03-09 19:17:10 +03:00
|
|
|
bool cmCTestTestHandler::SetTestsProperties(
|
|
|
|
const std::vector<std::string>& args)
|
2005-09-07 07:31:41 +04:00
|
|
|
{
|
|
|
|
std::vector<std::string>::const_iterator it;
|
2014-02-10 09:21:34 +04:00
|
|
|
std::vector<std::string> tests;
|
2005-09-07 07:31:41 +04:00
|
|
|
bool found = false;
|
|
|
|
for ( it = args.begin(); it != args.end(); ++ it )
|
|
|
|
{
|
|
|
|
if ( *it == "PROPERTIES" )
|
|
|
|
{
|
|
|
|
found = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
tests.push_back(*it);
|
|
|
|
}
|
|
|
|
if ( !found )
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
++ it; // skip PROPERTIES
|
|
|
|
for ( ; it != args.end(); ++ it )
|
|
|
|
{
|
|
|
|
std::string key = *it;
|
|
|
|
++ it;
|
|
|
|
if ( it == args.end() )
|
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
std::string val = *it;
|
2014-02-10 09:21:34 +04:00
|
|
|
std::vector<std::string>::const_iterator tit;
|
2005-09-07 07:31:41 +04:00
|
|
|
for ( tit = tests.begin(); tit != tests.end(); ++ tit )
|
|
|
|
{
|
2006-03-10 23:03:09 +03:00
|
|
|
cmCTestTestHandler::ListOfTests::iterator rtit;
|
|
|
|
for ( rtit = this->TestList.begin();
|
|
|
|
rtit != this->TestList.end();
|
|
|
|
++ rtit )
|
2005-09-07 07:31:41 +04:00
|
|
|
{
|
2006-03-10 23:03:09 +03:00
|
|
|
if ( *tit == rtit->Name )
|
2005-09-07 07:31:41 +04:00
|
|
|
{
|
|
|
|
if ( key == "WILL_FAIL" )
|
|
|
|
{
|
2006-03-10 23:03:09 +03:00
|
|
|
rtit->WillFail = cmSystemTools::IsOn(val.c_str());
|
2005-09-07 07:31:41 +04:00
|
|
|
}
|
2009-12-15 20:07:15 +03:00
|
|
|
if ( key == "ATTACHED_FILES" )
|
|
|
|
{
|
|
|
|
std::vector<std::string> lval;
|
2014-03-11 03:04:11 +04:00
|
|
|
cmSystemTools::ExpandListArgument(val, lval);
|
2009-12-15 20:07:15 +03:00
|
|
|
|
|
|
|
for(std::vector<std::string>::iterator f = lval.begin();
|
|
|
|
f != lval.end(); ++f)
|
|
|
|
{
|
|
|
|
rtit->AttachedFiles.push_back(*f);
|
|
|
|
}
|
|
|
|
}
|
2009-12-16 22:50:16 +03:00
|
|
|
if ( key == "ATTACHED_FILES_ON_FAIL" )
|
|
|
|
{
|
|
|
|
std::vector<std::string> lval;
|
2014-03-11 03:04:11 +04:00
|
|
|
cmSystemTools::ExpandListArgument(val, lval);
|
2009-12-16 22:50:16 +03:00
|
|
|
|
|
|
|
for(std::vector<std::string>::iterator f = lval.begin();
|
|
|
|
f != lval.end(); ++f)
|
|
|
|
{
|
|
|
|
rtit->AttachOnFail.push_back(*f);
|
|
|
|
}
|
|
|
|
}
|
2010-03-02 23:34:37 +03:00
|
|
|
if ( key == "RESOURCE_LOCK" )
|
|
|
|
{
|
|
|
|
std::vector<std::string> lval;
|
2014-03-11 03:04:11 +04:00
|
|
|
cmSystemTools::ExpandListArgument(val, lval);
|
2010-03-02 23:34:37 +03:00
|
|
|
|
|
|
|
for(std::vector<std::string>::iterator f = lval.begin();
|
|
|
|
f != lval.end(); ++f)
|
|
|
|
{
|
|
|
|
rtit->LockedResources.insert(*f);
|
|
|
|
}
|
|
|
|
}
|
2007-01-25 19:16:16 +03:00
|
|
|
if ( key == "TIMEOUT" )
|
|
|
|
{
|
|
|
|
rtit->Timeout = atof(val.c_str());
|
2011-01-03 22:41:25 +03:00
|
|
|
rtit->ExplicitTimeout = true;
|
2007-01-25 19:16:16 +03:00
|
|
|
}
|
2009-09-08 21:39:13 +04:00
|
|
|
if ( key == "COST" )
|
2009-09-03 19:14:13 +04:00
|
|
|
{
|
2009-10-02 23:30:01 +04:00
|
|
|
rtit->Cost = static_cast<float>(atof(val.c_str()));
|
2009-09-03 19:14:13 +04:00
|
|
|
}
|
2009-12-15 20:07:15 +03:00
|
|
|
if ( key == "REQUIRED_FILES" )
|
2009-12-10 23:37:04 +03:00
|
|
|
{
|
2009-12-15 20:07:15 +03:00
|
|
|
std::vector<std::string> lval;
|
2014-03-11 03:04:11 +04:00
|
|
|
cmSystemTools::ExpandListArgument(val, lval);
|
2009-12-15 20:07:15 +03:00
|
|
|
|
|
|
|
for(std::vector<std::string>::iterator f = lval.begin();
|
|
|
|
f != lval.end(); ++f)
|
|
|
|
{
|
|
|
|
rtit->RequiredFiles.push_back(*f);
|
|
|
|
}
|
2009-12-10 23:37:04 +03:00
|
|
|
}
|
2009-09-07 18:26:17 +04:00
|
|
|
if ( key == "RUN_SERIAL" )
|
|
|
|
{
|
|
|
|
rtit->RunSerial = cmSystemTools::IsOn(val.c_str());
|
|
|
|
}
|
2005-11-09 19:07:36 +03:00
|
|
|
if ( key == "FAIL_REGULAR_EXPRESSION" )
|
2005-11-09 01:59:20 +03:00
|
|
|
{
|
|
|
|
std::vector<std::string> lval;
|
2014-03-11 03:04:11 +04:00
|
|
|
cmSystemTools::ExpandListArgument(val, lval);
|
2005-11-09 01:59:20 +03:00
|
|
|
std::vector<std::string>::iterator crit;
|
|
|
|
for ( crit = lval.begin(); crit != lval.end(); ++ crit )
|
|
|
|
{
|
2006-03-10 23:03:09 +03:00
|
|
|
rtit->ErrorRegularExpressions.push_back(
|
2007-09-19 19:16:57 +04:00
|
|
|
std::pair<cmsys::RegularExpression, std::string>(
|
|
|
|
cmsys::RegularExpression(crit->c_str()),
|
2014-03-11 03:04:11 +04:00
|
|
|
std::string(*crit)));
|
2005-11-09 01:59:20 +03:00
|
|
|
}
|
|
|
|
}
|
2009-09-03 18:47:14 +04:00
|
|
|
if ( key == "PROCESSORS" )
|
|
|
|
{
|
|
|
|
rtit->Processors = atoi(val.c_str());
|
|
|
|
if(rtit->Processors < 1)
|
|
|
|
{
|
|
|
|
rtit->Processors = 1;
|
|
|
|
}
|
|
|
|
}
|
2012-09-21 19:37:08 +04:00
|
|
|
if ( key == "SKIP_RETURN_CODE" )
|
|
|
|
{
|
|
|
|
rtit->SkipReturnCode = atoi(val.c_str());
|
|
|
|
if(rtit->SkipReturnCode < 0 || rtit->SkipReturnCode > 255)
|
|
|
|
{
|
|
|
|
rtit->SkipReturnCode = -1;
|
|
|
|
}
|
|
|
|
}
|
2008-07-03 17:31:33 +04:00
|
|
|
if ( key == "DEPENDS" )
|
2008-11-26 22:38:43 +03:00
|
|
|
{
|
2008-07-03 17:31:33 +04:00
|
|
|
std::vector<std::string> lval;
|
2014-03-11 03:04:11 +04:00
|
|
|
cmSystemTools::ExpandListArgument(val, lval);
|
2008-07-03 17:31:33 +04:00
|
|
|
std::vector<std::string>::iterator crit;
|
|
|
|
for ( crit = lval.begin(); crit != lval.end(); ++ crit )
|
|
|
|
{
|
|
|
|
rtit->Depends.push_back(*crit);
|
|
|
|
}
|
|
|
|
}
|
2008-11-26 22:38:43 +03:00
|
|
|
if ( key == "ENVIRONMENT" )
|
2011-03-11 16:04:58 +03:00
|
|
|
{
|
2008-11-26 22:38:43 +03:00
|
|
|
std::vector<std::string> lval;
|
2014-03-11 03:04:11 +04:00
|
|
|
cmSystemTools::ExpandListArgument(val, lval);
|
2008-11-26 22:38:43 +03:00
|
|
|
std::vector<std::string>::iterator crit;
|
|
|
|
for ( crit = lval.begin(); crit != lval.end(); ++ crit )
|
|
|
|
{
|
|
|
|
rtit->Environment.push_back(*crit);
|
|
|
|
}
|
|
|
|
}
|
2009-01-07 18:41:37 +03:00
|
|
|
if ( key == "LABELS" )
|
|
|
|
{
|
|
|
|
std::vector<std::string> lval;
|
2014-03-11 03:04:11 +04:00
|
|
|
cmSystemTools::ExpandListArgument(val, lval);
|
2009-01-07 18:41:37 +03:00
|
|
|
std::vector<std::string>::iterator crit;
|
|
|
|
for ( crit = lval.begin(); crit != lval.end(); ++ crit )
|
|
|
|
{
|
|
|
|
rtit->Labels.push_back(*crit);
|
|
|
|
}
|
|
|
|
}
|
2006-10-13 17:30:33 +04:00
|
|
|
if ( key == "MEASUREMENT" )
|
|
|
|
{
|
|
|
|
size_t pos = val.find_first_of("=");
|
|
|
|
if ( pos != val.npos )
|
|
|
|
{
|
|
|
|
std::string mKey = val.substr(0, pos);
|
|
|
|
const char* mVal = val.c_str() + pos + 1;
|
|
|
|
rtit->Measurements[mKey] = mVal;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
rtit->Measurements[val] = "1";
|
|
|
|
}
|
|
|
|
}
|
2005-11-09 19:07:36 +03:00
|
|
|
if ( key == "PASS_REGULAR_EXPRESSION" )
|
2005-11-09 01:59:20 +03:00
|
|
|
{
|
|
|
|
std::vector<std::string> lval;
|
2014-03-11 03:04:11 +04:00
|
|
|
cmSystemTools::ExpandListArgument(val, lval);
|
2005-11-09 01:59:20 +03:00
|
|
|
std::vector<std::string>::iterator crit;
|
|
|
|
for ( crit = lval.begin(); crit != lval.end(); ++ crit )
|
|
|
|
{
|
2006-03-10 23:03:09 +03:00
|
|
|
rtit->RequiredRegularExpressions.push_back(
|
2007-09-19 19:16:57 +04:00
|
|
|
std::pair<cmsys::RegularExpression, std::string>(
|
|
|
|
cmsys::RegularExpression(crit->c_str()),
|
2014-03-11 03:04:11 +04:00
|
|
|
std::string(*crit)));
|
2005-11-09 01:59:20 +03:00
|
|
|
}
|
|
|
|
}
|
2010-10-26 14:06:15 +04:00
|
|
|
if ( key == "WORKING_DIRECTORY" )
|
|
|
|
{
|
|
|
|
rtit->Directory = val;
|
|
|
|
}
|
2005-09-07 07:31:41 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2005-06-07 17:06:38 +04:00
|
|
|
//----------------------------------------------------------------------
|
2009-12-10 23:37:04 +03:00
|
|
|
bool cmCTestTestHandler::AddTest(const std::vector<std::string>& args)
|
2005-06-07 17:06:38 +04:00
|
|
|
{
|
|
|
|
const std::string& testname = args[0];
|
2006-07-13 00:30:14 +04:00
|
|
|
cmCTestLog(this->CTest, DEBUG, "Add test: " << args[0] << std::endl);
|
2009-12-10 22:38:32 +03:00
|
|
|
|
2006-03-10 23:03:09 +03:00
|
|
|
if (this->UseExcludeRegExpFlag &&
|
|
|
|
this->UseExcludeRegExpFirst &&
|
|
|
|
this->ExcludeTestsRegularExpression.find(testname.c_str()))
|
2005-06-07 17:06:38 +04:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
2006-03-10 23:03:09 +03:00
|
|
|
if ( this->MemCheck )
|
2005-06-07 17:06:38 +04:00
|
|
|
{
|
2014-02-10 09:21:34 +04:00
|
|
|
std::vector<std::string>::iterator it;
|
2005-06-07 17:06:38 +04:00
|
|
|
bool found = false;
|
2006-03-10 23:03:09 +03:00
|
|
|
for ( it = this->CustomTestsIgnore.begin();
|
|
|
|
it != this->CustomTestsIgnore.end(); ++ it )
|
2005-06-07 17:06:38 +04:00
|
|
|
{
|
|
|
|
if ( *it == testname )
|
|
|
|
{
|
|
|
|
found = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ( found )
|
|
|
|
{
|
2006-03-10 23:03:09 +03:00
|
|
|
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Ignore memcheck: "
|
2006-03-09 19:17:10 +03:00
|
|
|
<< *it << std::endl);
|
2005-06-07 17:06:38 +04:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2014-02-10 09:21:34 +04:00
|
|
|
std::vector<std::string>::iterator it;
|
2005-06-07 17:06:38 +04:00
|
|
|
bool found = false;
|
2006-03-10 23:03:09 +03:00
|
|
|
for ( it = this->CustomTestsIgnore.begin();
|
|
|
|
it != this->CustomTestsIgnore.end(); ++ it )
|
2005-06-07 17:06:38 +04:00
|
|
|
{
|
|
|
|
if ( *it == testname )
|
|
|
|
{
|
|
|
|
found = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ( found )
|
|
|
|
{
|
2006-03-10 23:03:09 +03:00
|
|
|
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Ignore test: "
|
2006-03-09 19:17:10 +03:00
|
|
|
<< *it << std::endl);
|
2005-06-07 17:06:38 +04:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
cmCTestTestProperties test;
|
2006-03-10 23:03:09 +03:00
|
|
|
test.Name = testname;
|
|
|
|
test.Args = args;
|
|
|
|
test.Directory = cmSystemTools::GetCurrentWorkingDirectory();
|
2006-07-13 17:13:29 +04:00
|
|
|
cmCTestLog(this->CTest, DEBUG, "Set test directory: "
|
|
|
|
<< test.Directory << std::endl);
|
2011-03-11 16:04:58 +03:00
|
|
|
|
2006-03-10 23:03:09 +03:00
|
|
|
test.IsInBasedOnREOptions = true;
|
|
|
|
test.WillFail = false;
|
2009-09-07 18:26:17 +04:00
|
|
|
test.RunSerial = false;
|
2007-01-25 19:16:16 +03:00
|
|
|
test.Timeout = 0;
|
2011-01-03 22:41:25 +03:00
|
|
|
test.ExplicitTimeout = false;
|
2009-09-08 21:39:13 +04:00
|
|
|
test.Cost = 0;
|
2009-09-03 18:47:14 +04:00
|
|
|
test.Processors = 1;
|
2012-09-21 19:37:08 +04:00
|
|
|
test.SkipReturnCode = -1;
|
2010-02-26 00:23:49 +03:00
|
|
|
test.PreviousRuns = 0;
|
2006-03-10 23:03:09 +03:00
|
|
|
if (this->UseIncludeRegExpFlag &&
|
|
|
|
!this->IncludeTestsRegularExpression.find(testname.c_str()))
|
2005-06-07 17:06:38 +04:00
|
|
|
{
|
2006-03-10 23:03:09 +03:00
|
|
|
test.IsInBasedOnREOptions = false;
|
2005-06-07 17:06:38 +04:00
|
|
|
}
|
2006-03-10 23:03:09 +03:00
|
|
|
else if (this->UseExcludeRegExpFlag &&
|
|
|
|
!this->UseExcludeRegExpFirst &&
|
|
|
|
this->ExcludeTestsRegularExpression.find(testname.c_str()))
|
2005-06-07 17:06:38 +04:00
|
|
|
{
|
2006-03-10 23:03:09 +03:00
|
|
|
test.IsInBasedOnREOptions = false;
|
2005-06-07 17:06:38 +04:00
|
|
|
}
|
2006-03-10 23:03:09 +03:00
|
|
|
this->TestList.push_back(test);
|
2005-06-07 17:06:38 +04:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|