Resync
[CMakeLuaTailorHgBridge.git] / CMakeLua / Source / CTest / cmCTestTestCommand.cxx
blobe4c113e7222a8a1866e9cabc5a89e756fa4f1b73
1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmCTestTestCommand.cxx,v $
5 Language: C++
6 Date: $Date: 2009-02-10 19:24:23 $
7 Version: $Revision: 1.12 $
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 "cmCTestTestCommand.h"
19 #include "cmCTest.h"
20 #include "cmCTestGenericHandler.h"
22 cmCTestTestCommand::cmCTestTestCommand()
24 this->Arguments[ctt_START] = "START";
25 this->Arguments[ctt_END] = "END";
26 this->Arguments[ctt_STRIDE] = "STRIDE";
27 this->Arguments[ctt_EXCLUDE] = "EXCLUDE";
28 this->Arguments[ctt_INCLUDE] = "INCLUDE";
29 this->Arguments[ctt_EXCLUDE_LABEL] = "EXCLUDE_LABEL";
30 this->Arguments[ctt_INCLUDE_LABEL] = "INCLUDE_LABEL";
31 this->Arguments[ctt_LAST] = 0;
32 this->Last = ctt_LAST;
35 cmCTestGenericHandler* cmCTestTestCommand::InitializeHandler()
37 const char* ctestTimeout =
38 this->Makefile->GetDefinition("CTEST_TEST_TIMEOUT");
39 double timeout = this->CTest->GetTimeOut();
40 if ( ctestTimeout )
42 timeout = atof(ctestTimeout);
44 else
46 if ( timeout <= 0 )
48 // By default use timeout of 10 minutes
49 timeout = 600;
52 this->CTest->SetTimeOut(timeout);
53 cmCTestGenericHandler* handler = this->InitializeActualHandler();
54 if ( this->Values[ctt_START] || this->Values[ctt_END] ||
55 this->Values[ctt_STRIDE] )
57 cmOStringStream testsToRunString;
58 if ( this->Values[ctt_START] )
60 testsToRunString << this->Values[ctt_START];
62 testsToRunString << ",";
63 if ( this->Values[ctt_END] )
65 testsToRunString << this->Values[ctt_END];
67 testsToRunString << ",";
68 if ( this->Values[ctt_STRIDE] )
70 testsToRunString << this->Values[ctt_STRIDE];
72 handler->SetOption("TestsToRunInformation",
73 testsToRunString.str().c_str());
75 if(this->Values[ctt_EXCLUDE])
77 handler->SetOption("ExcludeRegularExpression", this->Values[ctt_EXCLUDE]);
79 if(this->Values[ctt_INCLUDE])
81 handler->SetOption("IncludeRegularExpression", this->Values[ctt_INCLUDE]);
83 if(this->Values[ctt_EXCLUDE_LABEL])
85 handler->SetOption("ExcludeLabelRegularExpression",
86 this->Values[ctt_EXCLUDE_LABEL]);
88 if(this->Values[ctt_INCLUDE_LABEL])
90 handler->SetOption("LabelRegularExpression",
91 this->Values[ctt_INCLUDE_LABEL]);
93 return handler;
96 cmCTestGenericHandler* cmCTestTestCommand::InitializeActualHandler()
98 return this->CTest->GetInitializedHandler("test");