ctest.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. /*=========================================================================
  2. Program: Insight Segmentation & Registration Toolkit
  3. Module: $RCSfile$
  4. Language: C++
  5. Date: $Date$
  6. Version: $Revision$
  7. Copyright (c) 2002 Insight Consortium. All rights reserved.
  8. See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm 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 "cmStandardIncludes.h"
  14. class ctest
  15. {
  16. public:
  17. /**
  18. * Initialize and finalize testing
  19. */
  20. void Initialize();
  21. void Finalize();
  22. /**
  23. * Process the tests. This is the main routine. The execution of the
  24. * tests should look like this:
  25. *
  26. * ctest foo;
  27. * foo.Initialize();
  28. * // Set some things on foo
  29. * foo.ProcessTests();
  30. * foo.Finalize();
  31. */
  32. int ProcessTests();
  33. /**
  34. * Try to build the project
  35. */
  36. void BuildDirectory();
  37. /**
  38. * Do revision control update of directory
  39. */
  40. void UpdateDirectory();
  41. /**
  42. * Do configure the project
  43. */
  44. void ConfigureDirectory();
  45. /**
  46. * Run the test for a directory and any subdirectories
  47. */
  48. void ProcessDirectory(std::vector<std::string> &passed,
  49. std::vector<std::string> &failed);
  50. /**
  51. * Find the executable for a test
  52. */
  53. std::string FindExecutable(const char *exe);
  54. /**
  55. * Set the cmake test
  56. */
  57. bool SetTest(const char*);
  58. /**
  59. * constructor
  60. */
  61. ctest();
  62. bool m_UseIncludeRegExp;
  63. std::string m_IncludeRegExp;
  64. bool m_UseExcludeRegExp;
  65. bool m_UseExcludeRegExpFirst;
  66. std::string m_ExcludeRegExp;
  67. std::string m_ConfigType;
  68. bool m_Verbose;
  69. bool m_DartMode;
  70. private:
  71. enum {
  72. FIRST_TEST = 0,
  73. UPDATE_TEST,
  74. CONFIGURE_TEST,
  75. BUILD_TEST,
  76. TEST_TEST,
  77. COVERAGE_TEST,
  78. PURIFY_TEST,
  79. ALL_TEST,
  80. LAST_TEST
  81. };
  82. struct cmCTestTestResult
  83. {
  84. std::string m_Name;
  85. std::string m_Path;
  86. std::string m_FullCommandLine;
  87. double m_ExecutionTime;
  88. int m_ReturnValue;
  89. std::string m_CompletionStatus;
  90. std::string m_Output;
  91. };
  92. struct cmCTestBuildErrorWarning
  93. {
  94. bool m_Error;
  95. int m_LogLine;
  96. std::string m_Text;
  97. std::string m_SourceFile;
  98. std::string m_SourceFileTail;
  99. int m_LineNumber;
  100. std::string m_PreContext;
  101. std::string m_PostContext;
  102. };
  103. typedef std::vector<cmCTestTestResult> tm_TestResultsVector;
  104. typedef std::map<std::string, std::string> tm_DartConfigurationMap;
  105. tm_TestResultsVector m_TestResults;
  106. std::string m_ToplevelPath;
  107. tm_DartConfigurationMap m_DartConfiguration;
  108. int m_Tests[LAST_TEST];
  109. /**
  110. * Generate the Dart compatible output
  111. */
  112. void GenerateDartOutput(std::ostream& os);
  113. void GenerateDartBuildOutput(std::ostream& os,
  114. std::vector<cmCTestBuildErrorWarning>);
  115. };