cmCTestTestCommand.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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. #ifndef cmCTestTestCommand_h
  11. #define cmCTestTestCommand_h
  12. #include "cmCTestHandlerCommand.h"
  13. /** \class cmCTestTest
  14. * \brief Run a ctest script
  15. *
  16. * cmCTestTestCommand defineds the command to test the project.
  17. */
  18. class cmCTestTestCommand : public cmCTestHandlerCommand
  19. {
  20. public:
  21. cmCTestTestCommand();
  22. /**
  23. * This is a virtual constructor for the command.
  24. */
  25. virtual cmCommand* Clone()
  26. {
  27. cmCTestTestCommand* ni = new cmCTestTestCommand;
  28. ni->CTest = this->CTest;
  29. ni->CTestScriptHandler = this->CTestScriptHandler;
  30. return ni;
  31. }
  32. /**
  33. * The name of the command as specified in CMakeList.txt.
  34. */
  35. virtual const char* GetName() const { return "ctest_test";}
  36. /**
  37. * Succinct documentation.
  38. */
  39. virtual const char* GetTerseDocumentation() const
  40. {
  41. return "Run tests in the project build tree.";
  42. }
  43. /**
  44. * More documentation.
  45. */
  46. virtual const char* GetFullDocumentation() const
  47. {
  48. return
  49. " ctest_test([BUILD build_dir] [APPEND]\n"
  50. " [START start number] [END end number]\n"
  51. " [STRIDE stride number] [EXCLUDE exclude regex ]\n"
  52. " [INCLUDE include regex] [RETURN_VALUE res] \n"
  53. " [EXCLUDE_LABEL exclude regex] \n"
  54. " [INCLUDE_LABEL label regex] \n"
  55. " [PARALLEL_LEVEL level] \n"
  56. " [SCHEDULE_RANDOM on] \n"
  57. " [STOP_TIME time of day]) \n"
  58. "Tests the given build directory and stores results in Test.xml. The "
  59. "second argument is a variable that will hold value. Optionally, "
  60. "you can specify the starting test number START, the ending test number "
  61. "END, the number of tests to skip between each test STRIDE, a regular "
  62. "expression for tests to run INCLUDE, or a regular expression for tests "
  63. "to not run EXCLUDE. EXCLUDE_LABEL and INCLUDE_LABEL are regular "
  64. "expression for test to be included or excluded by the test "
  65. "property LABEL. PARALLEL_LEVEL should be set to a positive number "
  66. "representing the number of tests to be run in parallel. "
  67. "SCHEDULE_RANDOM will launch tests in a random order, and is "
  68. "typically used to detect implicit test dependencies. STOP_TIME is the "
  69. "time of day at which the tests should all stop running."
  70. "\n"
  71. CTEST_COMMAND_APPEND_OPTION_DOCS;
  72. }
  73. cmTypeMacro(cmCTestTestCommand, cmCTestHandlerCommand);
  74. protected:
  75. virtual cmCTestGenericHandler* InitializeActualHandler();
  76. cmCTestGenericHandler* InitializeHandler();
  77. enum {
  78. ctt_BUILD = ct_LAST,
  79. ctt_RETURN_VALUE,
  80. ctt_START,
  81. ctt_END,
  82. ctt_STRIDE,
  83. ctt_EXCLUDE,
  84. ctt_INCLUDE,
  85. ctt_EXCLUDE_LABEL,
  86. ctt_INCLUDE_LABEL,
  87. ctt_PARALLEL_LEVEL,
  88. ctt_SCHEDULE_RANDOM,
  89. ctt_STOP_TIME,
  90. ctt_LAST
  91. };
  92. };
  93. #endif