cmCTestTestCommand.cxx 3.0 KB

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