ctest.cxx 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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 "cmCTest.h"
  14. #include "cmSystemTools.h"
  15. // this is a test driver program for cmCTest.
  16. int main (int argc, char *argv[])
  17. {
  18. cmSystemTools::EnableMSVCDebugHook();
  19. cmCTest inst;
  20. // look at the args
  21. std::vector<std::string> args;
  22. for(int i =0; i < argc; ++i)
  23. {
  24. args.push_back(argv[i]);
  25. }
  26. #ifdef _WIN32
  27. std::string comspec = "cmw9xcom.exe";
  28. cmSystemTools::SetWindows9xComspecSubstitute(comspec.c_str());
  29. #endif
  30. for(unsigned int i=1; i < args.size(); ++i)
  31. {
  32. std::string arg = args[i];
  33. if(arg.find("-D",0) == 0 && i < args.size() - 1)
  34. {
  35. inst.m_ConfigType = args[i+1];
  36. }
  37. if( arg.find("-V",0) == 0 || arg.find("--verbose",0) == 0 )
  38. {
  39. inst.m_Verbose = true;
  40. }
  41. if( arg.find("-N",0) == 0 || arg.find("--show-only",0) == 0 )
  42. {
  43. inst.m_ShowOnly = true;
  44. }
  45. if( ( arg.find("-T",0) == 0 || arg.find("--dart-mode",0) == 0 ) &&
  46. (i < args.size() -1) )
  47. {
  48. inst.m_DartMode = true;
  49. inst.SetTest(args[i+1].c_str());
  50. }
  51. if(arg.find("-R",0) == 0 && i < args.size() - 1)
  52. {
  53. inst.m_UseIncludeRegExp = true;
  54. inst.m_IncludeRegExp = args[i+1];
  55. }
  56. if(arg.find("-E",0) == 0 && i < args.size() - 1)
  57. {
  58. inst.m_UseExcludeRegExp = true;
  59. inst.m_ExcludeRegExp = args[i+1];
  60. inst.m_UseExcludeRegExpFirst = inst.m_UseIncludeRegExp ? false : true;
  61. }
  62. if(arg.find("-h") == 0 ||
  63. arg.find("-help") == 0 ||
  64. arg.find("-H") == 0 ||
  65. arg.find("--help") == 0 ||
  66. arg.find("/H") == 0 ||
  67. arg.find("/HELP") == 0 ||
  68. arg.find("/?") == 0)
  69. {
  70. std::cerr << "Usage: " << argv[0] << " <options>" << std::endl
  71. << "\t -D type Specify config type" << std::endl
  72. << "\t -E test Specify regular expression for tests to exclude"
  73. << std::endl
  74. << "\t -R test Specify regular expression for tests to include"
  75. << std::endl
  76. << "\t -V Verbose testing" << std::endl
  77. << "\t -N Only show what would be done without this option"
  78. << std::endl
  79. << "\t -H Help page" << std::endl;
  80. return 1;
  81. }
  82. }
  83. // call process directory
  84. inst.Initialize();
  85. int res = inst.ProcessTests();
  86. inst.Finalize();
  87. return res;
  88. }