cmCTestTestCommand.cxx 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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_LAST] = 0;
  26. this->Last = ctt_LAST;
  27. }
  28. cmCTestGenericHandler* cmCTestTestCommand::InitializeHandler()
  29. {
  30. const char* ctestTimeout =
  31. this->Makefile->GetDefinition("CTEST_TEST_TIMEOUT");
  32. double timeout = this->CTest->GetTimeOut();
  33. if ( ctestTimeout )
  34. {
  35. timeout = atof(ctestTimeout);
  36. }
  37. else
  38. {
  39. if ( timeout <= 0 )
  40. {
  41. // By default use timeout of 10 minutes
  42. timeout = 600;
  43. }
  44. }
  45. this->CTest->SetTimeOut(timeout);
  46. cmCTestGenericHandler* handler = this->InitializeActualHandler();
  47. if ( this->Values[ctt_START] || this->Values[ctt_END] ||
  48. this->Values[ctt_STRIDE] )
  49. {
  50. cmOStringStream testsToRunString;
  51. if ( this->Values[ctt_START] )
  52. {
  53. testsToRunString << this->Values[ctt_START];
  54. }
  55. testsToRunString << ",";
  56. if ( this->Values[ctt_END] )
  57. {
  58. testsToRunString << this->Values[ctt_END];
  59. }
  60. testsToRunString << ",";
  61. if ( this->Values[ctt_STRIDE] )
  62. {
  63. testsToRunString << this->Values[ctt_STRIDE];
  64. }
  65. handler->SetOption("TestsToRunInformation",
  66. testsToRunString.str().c_str());
  67. }
  68. if(this->Values[ctt_EXCLUDE])
  69. {
  70. handler->SetOption("ExcludeRegularExpression", this->Values[ctt_EXCLUDE]);
  71. }
  72. if(this->Values[ctt_INCLUDE])
  73. {
  74. handler->SetOption("IncludeRegularExpression", this->Values[ctt_INCLUDE]);
  75. }
  76. if(this->Values[ctt_EXCLUDE_LABEL])
  77. {
  78. handler->SetOption("ExcludeLabelRegularExpression",
  79. this->Values[ctt_EXCLUDE_LABEL]);
  80. }
  81. if(this->Values[ctt_INCLUDE_LABEL])
  82. {
  83. handler->SetOption("LabelRegularExpression",
  84. this->Values[ctt_INCLUDE_LABEL]);
  85. }
  86. return handler;
  87. }
  88. cmCTestGenericHandler* cmCTestTestCommand::InitializeActualHandler()
  89. {
  90. return this->CTest->GetInitializedHandler("test");
  91. }