1
0

cmCTestTestCommand.cxx 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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_LAST] = 0;
  22. this->Last = ctt_LAST;
  23. }
  24. cmCTestGenericHandler* cmCTestTestCommand::InitializeHandler()
  25. {
  26. const char* ctestTimeout =
  27. this->Makefile->GetDefinition("CTEST_TEST_TIMEOUT");
  28. double timeout = this->CTest->GetTimeOut();
  29. if ( ctestTimeout )
  30. {
  31. timeout = atof(ctestTimeout);
  32. }
  33. else
  34. {
  35. if ( timeout <= 0 )
  36. {
  37. // By default use timeout of 10 minutes
  38. timeout = 600;
  39. }
  40. }
  41. this->CTest->SetTimeOut(timeout);
  42. cmCTestGenericHandler* handler = this->InitializeActualHandler();
  43. if ( this->Values[ctt_START] || this->Values[ctt_END] ||
  44. this->Values[ctt_STRIDE] )
  45. {
  46. cmOStringStream testsToRunString;
  47. if ( this->Values[ctt_START] )
  48. {
  49. testsToRunString << this->Values[ctt_START];
  50. }
  51. testsToRunString << ",";
  52. if ( this->Values[ctt_END] )
  53. {
  54. testsToRunString << this->Values[ctt_END];
  55. }
  56. testsToRunString << ",";
  57. if ( this->Values[ctt_STRIDE] )
  58. {
  59. testsToRunString << this->Values[ctt_STRIDE];
  60. }
  61. handler->SetOption("TestsToRunInformation",
  62. testsToRunString.str().c_str());
  63. }
  64. return handler;
  65. }
  66. cmCTestGenericHandler* cmCTestTestCommand::InitializeActualHandler()
  67. {
  68. return this->CTest->GetInitializedHandler("test");
  69. }