cmCTestScriptHandler.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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 <memory>
  6. #include <string>
  7. #include <vector>
  8. class cmCTest;
  9. class cmGlobalGenerator;
  10. class cmMakefile;
  11. class cmake;
  12. /** \class cmCTestScriptHandler
  13. * \brief A class that handles ctest -S invocations
  14. */
  15. class cmCTestScriptHandler
  16. {
  17. public:
  18. /**
  19. * Add a script to run, and if is should run in the current process
  20. */
  21. void AddConfigurationScript(const std::string&, bool pscope);
  22. /**
  23. * Run a dashboard using a specified configuration script
  24. */
  25. int ProcessHandler();
  26. /*
  27. * Run a script
  28. */
  29. static bool RunScript(cmCTest* ctest, cmMakefile* mf,
  30. const std::string& script, bool InProcess,
  31. int* returnValue);
  32. /*
  33. * Some elapsed time handling functions
  34. */
  35. void UpdateElapsedTime();
  36. cmCTestScriptHandler(cmCTest* ctest);
  37. cmCTestScriptHandler(const cmCTestScriptHandler&) = delete;
  38. const cmCTestScriptHandler& operator=(const cmCTestScriptHandler&) = delete;
  39. ~cmCTestScriptHandler();
  40. void CreateCMake();
  41. cmake* GetCMake() { return this->CMake.get(); }
  42. cmMakefile* GetMakefile() { return this->Makefile.get(); }
  43. private:
  44. // reads in a script
  45. int ReadInScript(const std::string& total_script_arg);
  46. int ExecuteScript(const std::string& total_script_arg);
  47. int RunConfigurationScript(const std::string& script, bool pscope);
  48. cmCTest* CTest = nullptr;
  49. std::vector<std::string> ConfigurationScripts;
  50. std::vector<bool> ScriptProcessScope;
  51. std::unique_ptr<cmMakefile> Makefile;
  52. cmMakefile* ParentMakefile = nullptr;
  53. std::unique_ptr<cmGlobalGenerator> GlobalGenerator;
  54. std::unique_ptr<cmake> CMake;
  55. };