1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmTest.cxx,v $
6 Date: $Date: 2009-04-03 15:41:33 $
7 Version: $Revision: 1.14 $
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"
23 //----------------------------------------------------------------------------
27 this->OldStyle
= true;
30 //----------------------------------------------------------------------------
35 //----------------------------------------------------------------------------
36 void cmTest::SetName(const char* name
)
45 //----------------------------------------------------------------------------
46 void cmTest::SetCommand(std::vector
<std::string
> const& command
)
48 this->Command
= command
;
51 //----------------------------------------------------------------------------
52 const char *cmTest::GetProperty(const char* prop
) const
56 this->Properties
.GetPropertyValue(prop
, cmProperty::TEST
, chain
);
59 return this->Makefile
->GetProperty(prop
,cmProperty::TEST
);
64 //----------------------------------------------------------------------------
65 bool cmTest::GetPropertyAsBool(const char* prop
) const
67 return cmSystemTools::IsOn(this->GetProperty(prop
));
70 //----------------------------------------------------------------------------
71 void cmTest::SetProperty(const char* prop
, const char* value
)
78 this->Properties
.SetProperty(prop
, value
, cmProperty::TEST
);
81 //----------------------------------------------------------------------------
82 void cmTest::AppendProperty(const char* prop
, const char* value
)
88 this->Properties
.AppendProperty(prop
, value
, cmProperty::TEST
);
91 //----------------------------------------------------------------------------
92 void cmTest::SetMakefile(cmMakefile
* mf
)
95 this->Properties
.SetCMakeInstance(mf
->GetCMakeInstance());
98 //----------------------------------------------------------------------------
99 void cmTest::DefineProperties(cmake
*cm
)
102 ("ENVIRONMENT", cmProperty::TEST
,
103 "Specify environment variables that should be defined for running "
105 "If set to a list of environment variables and values of the form "
106 "MYVAR=value those environment variables will be defined while "
107 "running the test. The environment is restored to its previous state "
108 "after the test is done.");
111 ("FAIL_REGULAR_EXPRESSION", cmProperty::TEST
,
112 "If the output matches this regular expression the test will fail.",
113 "If set, if the output matches one of "
114 "specified regular expressions, the test will fail."
115 "For example: PASS_REGULAR_EXPRESSION \"[^a-z]Error;ERROR;Failed\"");
118 ("LABELS", cmProperty::TEST
,
119 "Specify a list of text labels associated with a test.",
120 "The list is reported in dashboard submissions.");
123 ("MEASUREMENT", cmProperty::TEST
,
124 "Specify a DART measurement and value to be reported for a test.",
125 "If set to a name then that name will be reported to DART as a "
126 "named measurement with a value of 1. You may also specify a value "
127 "by setting MEASUREMENT to \"measurement=value\".");
130 ("PASS_REGULAR_EXPRESSION", cmProperty::TEST
,
131 "The output must match this regular expression for the test to pass.",
132 "If set, the test output will be checked "
133 "against the specified regular expressions and at least one of the"
134 " regular expressions has to match, otherwise the test will fail.");
137 ("TIMEOUT", cmProperty::TEST
,
138 "How many seconds to allow for this test.",
139 "This property if set will limit a test to not take more than "
140 "the specified number of seconds to run. If it exceeds that the "
141 "test process will be killed and ctest will move to the next test. "
142 "This setting takes precedence over DART_TESTING_TIMEOUT and "
143 "CTEST_TESTING_TIMEOUT.");
146 ("WILL_FAIL", cmProperty::TEST
,
147 "If set to true, this will invert the pass/fail flag of the test.",
148 "This property can be used for tests that are expected to fail and "
149 "return a non zero return code.");