ENH: put the 64 bit paths first
[cmake.git] / Source / cmTest.cxx
blob34ce04413f638cffa6e08c0ced7986726e34770b
1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmTest.cxx,v $
5 Language: C++
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 =========================================================================*/
17 #include "cmTest.h"
18 #include "cmSystemTools.h"
20 #include "cmake.h"
21 #include "cmMakefile.h"
23 //----------------------------------------------------------------------------
24 cmTest::cmTest()
26 this->Makefile = 0;
27 this->OldStyle = true;
30 //----------------------------------------------------------------------------
31 cmTest::~cmTest()
35 //----------------------------------------------------------------------------
36 void cmTest::SetName(const char* name)
38 if ( !name )
40 name = "";
42 this->Name = 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
54 bool chain = false;
55 const char *retVal =
56 this->Properties.GetPropertyValue(prop, cmProperty::TEST, chain);
57 if (chain)
59 return this->Makefile->GetProperty(prop,cmProperty::TEST);
61 return retVal;
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)
73 if (!prop)
75 return;
78 this->Properties.SetProperty(prop, value, cmProperty::TEST);
81 //----------------------------------------------------------------------------
82 void cmTest::AppendProperty(const char* prop, const char* value)
84 if (!prop)
86 return;
88 this->Properties.AppendProperty(prop, value, cmProperty::TEST);
91 //----------------------------------------------------------------------------
92 void cmTest::SetMakefile(cmMakefile* mf)
94 this->Makefile = mf;
95 this->Properties.SetCMakeInstance(mf->GetCMakeInstance());
98 //----------------------------------------------------------------------------
99 void cmTest::DefineProperties(cmake *cm)
101 cm->DefineProperty
102 ("ENVIRONMENT", cmProperty::TEST,
103 "Specify environment variables that should be defined for running "
104 "a test.",
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.");
110 cm->DefineProperty
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\"");
117 cm->DefineProperty
118 ("LABELS", cmProperty::TEST,
119 "Specify a list of text labels associated with a test.",
120 "The list is reported in dashboard submissions.");
122 cm->DefineProperty
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\".");
129 cm->DefineProperty
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.");
136 cm->DefineProperty
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.");
145 cm->DefineProperty
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.");