cmCTestTestCommand.cxx 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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_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. return handler;
  75. }
  76. cmCTestGenericHandler* cmCTestTestCommand::InitializeActualHandler()
  77. {
  78. return this->CTest->GetInitializedHandler("test");
  79. }