cmCTestTestCommand.cxx 2.1 KB

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