cmCTestLaunch.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  2. file Copyright.txt or https://cmake.org/licensing for details. */
  3. #pragma once
  4. #include "cmConfigure.h" // IWYU pragma: keep
  5. #include <string>
  6. #include <vector>
  7. #include "cmCTestLaunchReporter.h"
  8. namespace cmsys {
  9. class RegularExpression;
  10. }
  11. /** \class cmCTestLaunch
  12. * \brief Launcher for make rules to report results for ctest
  13. *
  14. * This implements the 'ctest --launch' tool.
  15. */
  16. class cmCTestLaunch
  17. {
  18. public:
  19. /** Entry point from ctest executable main(). */
  20. static int Main(int argc, const char* const argv[]);
  21. cmCTestLaunch(const cmCTestLaunch&) = delete;
  22. cmCTestLaunch& operator=(const cmCTestLaunch&) = delete;
  23. private:
  24. // Initialize the launcher from its command line.
  25. cmCTestLaunch(int argc, const char* const* argv);
  26. ~cmCTestLaunch();
  27. // Run the real command.
  28. int Run();
  29. void RunChild();
  30. // Method to check the result of the real command.
  31. bool CheckResults();
  32. // Parse out launcher-specific options specified before the real command.
  33. bool ParseArguments(int argc, const char* const* argv);
  34. // The real command line appearing after launcher arguments.
  35. int RealArgC;
  36. const char* const* RealArgV;
  37. // The real command line after response file expansion.
  38. std::vector<std::string> RealArgs;
  39. void HandleRealArg(const char* arg);
  40. struct cmsysProcess_s* Process;
  41. // Whether or not any data have been written to stdout or stderr.
  42. bool HaveOut;
  43. bool HaveErr;
  44. // Load custom rules to match warnings and their exceptions.
  45. bool ScrapeRulesLoaded;
  46. void LoadScrapeRules();
  47. void LoadScrapeRules(const char* purpose,
  48. std::vector<cmsys::RegularExpression>& regexps) const;
  49. bool ScrapeLog(std::string const& fname);
  50. // Helper class to generate the xml fragment.
  51. cmCTestLaunchReporter Reporter;
  52. // Configuration
  53. void LoadConfig();
  54. };