1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmTest.cxx,v $
6 Date: $Date: 2008-04-01 18:22:07 $
7 Version: $Revision: 1.10 $
9 Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
10 See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
12 This software is distributed WITHOUT ANY WARRANTY; without even
13 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 PURPOSE. See the above copyright notices for more information.
16 =========================================================================*/
18 #include "cmSystemTools.h"
21 #include "cmMakefile.h"
32 void cmTest::SetName(const char* name
)
41 void cmTest::SetCommand(const char* command
)
47 this->Command
= command
;
48 cmSystemTools::ConvertToUnixSlashes(this->Command
);
51 void cmTest::SetArguments(const std::vector
<cmStdString
>& args
)
56 const char *cmTest::GetProperty(const char* prop
) const
60 this->Properties
.GetPropertyValue(prop
, cmProperty::TEST
, chain
);
63 return this->Makefile
->GetProperty(prop
,cmProperty::TEST
);
68 bool cmTest::GetPropertyAsBool(const char* prop
) const
70 return cmSystemTools::IsOn(this->GetProperty(prop
));
73 void cmTest::SetProperty(const char* prop
, const char* value
)
80 this->Properties
.SetProperty(prop
, value
, cmProperty::TEST
);
83 //----------------------------------------------------------------------------
84 void cmTest::AppendProperty(const char* prop
, const char* value
)
90 this->Properties
.AppendProperty(prop
, value
, cmProperty::TEST
);
93 //----------------------------------------------------------------------------
94 void cmTest::SetMakefile(cmMakefile
* mf
)
98 this->Properties
.SetCMakeInstance(mf
->GetCMakeInstance());
102 void cmTest::DefineProperties(cmake
*cm
)
106 ("FAIL_REGULAR_EXPRESSION", cmProperty::TEST
,
107 "If the output matches this regular expression the test will fail.",
108 "If set, if the output matches one of "
109 "specified regular expressions, the test will fail."
110 "For example: PASS_REGULAR_EXPRESSION \"[^a-z]Error;ERROR;Failed\"");
113 ("MEASUREMENT", cmProperty::TEST
,
114 "Specify a DART measurement and value to be reported for a test.",
115 "If set to a name then that name will be reported to DART as a "
116 "named measurement with a value of 1. You may also specify a value "
117 "by setting MEASUREMENT to \"measurement=value\".");
120 ("PASS_REGULAR_EXPRESSION", cmProperty::TEST
,
121 "The output must match this regular expression for the test to pass.",
122 "If set, the test output will be checked "
123 "against the specified regular expressions and at least one of the"
124 " regular expressions has to match, otherwise the test will fail.");
127 ("TIMEOUT", cmProperty::TEST
,
128 "How many seconds to allow for this test.",
129 "This property if set will limit a test to not take more than "
130 "the specified number of seconds to run. If it exceeds that the "
131 "test process will be killed and ctest will move to the next test. "
132 "This setting takes precedence over DART_TESTING_TIMEOUT and "
133 "CTEST_TESTING_TIMEOUT.");
136 ("WILL_FAIL", cmProperty::TEST
,
137 "If set to true, this will invert the pass/fail flag of the test.",
138 "This property can be used for tests that are expected to fail and "
139 "return a non zero return code.");