cmCTestTestCommand.cxx 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. /*=========================================================================
  2. Program: CMake - Cross-Platform Makefile Generator
  3. Module: $RCSfile$
  4. Language: C++
  5. Date: $Date$
  6. Version: $Revision$
  7. Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
  8. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
  9. This software is distributed WITHOUT ANY WARRANTY; without even
  10. the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  11. PURPOSE. See the above copyright notices for more information.
  12. =========================================================================*/
  13. #include "cmCTestTestCommand.h"
  14. #include "cmCTest.h"
  15. #include "cmCTestGenericHandler.h"
  16. cmCTestTestCommand::cmCTestTestCommand()
  17. {
  18. this->Arguments[ctt_START] = "START";
  19. this->Arguments[ctt_END] = "END";
  20. this->Arguments[ctt_STRIDE] = "STRIDE";
  21. this->Arguments[ctt_EXCLUDE] = "EXCLUDE";
  22. this->Arguments[ctt_INCLUDE] = "INCLUDE";
  23. this->Arguments[ctt_EXCLUDE_LABEL] = "EXCLUDE_LABEL";
  24. this->Arguments[ctt_INCLUDE_LABEL] = "INCLUDE_LABEL";
  25. this->Arguments[ctt_PARALLEL_LEVEL] = "PARALLEL_LEVEL";
  26. this->Arguments[ctt_LAST] = 0;
  27. this->Last = ctt_LAST;
  28. }
  29. cmCTestGenericHandler* cmCTestTestCommand::InitializeHandler()
  30. {
  31. const char* ctestTimeout =
  32. this->Makefile->GetDefinition("CTEST_TEST_TIMEOUT");
  33. double timeout = this->CTest->GetTimeOut();
  34. if ( ctestTimeout )
  35. {
  36. timeout = atof(ctestTimeout);
  37. }
  38. else
  39. {
  40. if ( timeout <= 0 )
  41. {
  42. // By default use timeout of 10 minutes
  43. timeout = 600;
  44. }
  45. }
  46. this->CTest->SetTimeOut(timeout);
  47. cmCTestGenericHandler* handler = this->InitializeActualHandler();
  48. if ( this->Values[ctt_START] || this->Values[ctt_END] ||
  49. this->Values[ctt_STRIDE] )
  50. {
  51. cmOStringStream testsToRunString;
  52. if ( this->Values[ctt_START] )
  53. {
  54. testsToRunString << this->Values[ctt_START];
  55. }
  56. testsToRunString << ",";
  57. if ( this->Values[ctt_END] )
  58. {
  59. testsToRunString << this->Values[ctt_END];
  60. }
  61. testsToRunString << ",";
  62. if ( this->Values[ctt_STRIDE] )
  63. {
  64. testsToRunString << this->Values[ctt_STRIDE];
  65. }
  66. handler->SetOption("TestsToRunInformation",
  67. testsToRunString.str().c_str());
  68. }
  69. if(this->Values[ctt_EXCLUDE])
  70. {
  71. handler->SetOption("ExcludeRegularExpression", this->Values[ctt_EXCLUDE]);
  72. }
  73. if(this->Values[ctt_INCLUDE])
  74. {
  75. handler->SetOption("IncludeRegularExpression", this->Values[ctt_INCLUDE]);
  76. }
  77. if(this->Values[ctt_EXCLUDE_LABEL])
  78. {
  79. handler->SetOption("ExcludeLabelRegularExpression",
  80. this->Values[ctt_EXCLUDE_LABEL]);
  81. }
  82. if(this->Values[ctt_INCLUDE_LABEL])
  83. {
  84. handler->SetOption("LabelRegularExpression",
  85. this->Values[ctt_INCLUDE_LABEL]);
  86. }
  87. if(this->Values[ctt_PARALLEL_LEVEL])
  88. {
  89. handler->SetOption("ParallelLevel",
  90. this->Values[ctt_PARALLEL_LEVEL]);
  91. }
  92. return handler;
  93. }
  94. cmCTestGenericHandler* cmCTestTestCommand::InitializeActualHandler()
  95. {
  96. return this->CTest->GetInitializedHandler("test");
  97. }