2016-09-27 19:01:08 +00:00
|
|
|
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
|
|
|
file Copyright.txt or https://cmake.org/licensing for details. */
|
2005-04-24 19:59:51 +00:00
|
|
|
#include "cmTest.h"
|
2016-04-29 13:40:20 +00:00
|
|
|
|
2006-12-07 14:45:32 +00:00
|
|
|
#include "cmMakefile.h"
|
2016-08-16 23:08:13 +00:00
|
|
|
#include "cmProperty.h"
|
2016-10-18 19:28:49 +00:00
|
|
|
#include "cmState.h"
|
2016-08-16 23:08:13 +00:00
|
|
|
#include "cmSystemTools.h"
|
2005-04-24 19:59:51 +00:00
|
|
|
|
2009-08-11 13:07:28 +00:00
|
|
|
cmTest::cmTest(cmMakefile* mf)
|
2014-03-12 21:59:42 +00:00
|
|
|
: Backtrace(mf->GetBacktrace())
|
2005-04-24 19:59:51 +00:00
|
|
|
{
|
2009-08-11 13:07:28 +00:00
|
|
|
this->Makefile = mf;
|
2009-03-16 14:51:30 +00:00
|
|
|
this->OldStyle = true;
|
2005-04-24 19:59:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
cmTest::~cmTest()
|
|
|
|
{
|
2009-08-11 13:07:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
cmListFileBacktrace const& cmTest::GetBacktrace() const
|
|
|
|
{
|
2014-05-23 18:59:11 +00:00
|
|
|
return this->Backtrace;
|
2005-04-24 19:59:51 +00:00
|
|
|
}
|
|
|
|
|
2014-02-04 02:20:33 +00:00
|
|
|
void cmTest::SetName(const std::string& name)
|
2005-04-24 19:59:51 +00:00
|
|
|
{
|
2006-03-15 16:02:08 +00:00
|
|
|
this->Name = name;
|
2005-04-24 19:59:51 +00:00
|
|
|
}
|
|
|
|
|
2009-03-16 14:42:40 +00:00
|
|
|
void cmTest::SetCommand(std::vector<std::string> const& command)
|
2005-04-24 19:59:51 +00:00
|
|
|
{
|
2006-03-15 16:02:08 +00:00
|
|
|
this->Command = command;
|
2005-04-24 19:59:51 +00:00
|
|
|
}
|
|
|
|
|
2016-05-16 14:34:04 +00:00
|
|
|
const char* cmTest::GetProperty(const std::string& prop) const
|
2005-07-31 15:51:42 +00:00
|
|
|
{
|
2016-05-16 14:34:04 +00:00
|
|
|
const char* retVal = this->Properties.GetPropertyValue(prop);
|
|
|
|
if (!retVal) {
|
|
|
|
const bool chain =
|
|
|
|
this->Makefile->GetState()->IsPropertyChained(prop, cmProperty::TEST);
|
|
|
|
if (chain) {
|
2015-06-06 07:41:30 +00:00
|
|
|
return this->Makefile->GetProperty(prop, chain);
|
2005-07-31 15:51:42 +00:00
|
|
|
}
|
2016-05-16 14:34:04 +00:00
|
|
|
}
|
2006-12-07 15:22:19 +00:00
|
|
|
return retVal;
|
2005-07-31 15:51:42 +00:00
|
|
|
}
|
|
|
|
|
2013-09-02 20:27:32 +00:00
|
|
|
bool cmTest::GetPropertyAsBool(const std::string& prop) const
|
2005-07-31 15:51:42 +00:00
|
|
|
{
|
2006-12-07 14:45:32 +00:00
|
|
|
return cmSystemTools::IsOn(this->GetProperty(prop));
|
2005-07-31 15:51:42 +00:00
|
|
|
}
|
|
|
|
|
2013-09-02 20:27:32 +00:00
|
|
|
void cmTest::SetProperty(const std::string& prop, const char* value)
|
2005-07-31 15:51:42 +00:00
|
|
|
{
|
2015-06-06 07:41:15 +00:00
|
|
|
this->Properties.SetProperty(prop, value);
|
2006-12-07 14:45:32 +00:00
|
|
|
}
|
|
|
|
|
2016-05-16 14:34:04 +00:00
|
|
|
void cmTest::AppendProperty(const std::string& prop, const char* value,
|
|
|
|
bool asString)
|
2008-01-17 23:13:55 +00:00
|
|
|
{
|
2015-06-06 07:41:15 +00:00
|
|
|
this->Properties.AppendProperty(prop, value, asString);
|
2008-01-17 23:13:55 +00:00
|
|
|
}
|