cmCTestSubmitHandler.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  2. file Copyright.txt or https://cmake.org/licensing for details. */
  3. #ifndef cmCTestSubmitHandler_h
  4. #define cmCTestSubmitHandler_h
  5. #include "cmConfigure.h" // IWYU pragma: keep
  6. #include "cmCTest.h"
  7. #include "cmCTestGenericHandler.h"
  8. #include <iosfwd>
  9. #include <set>
  10. #include <string>
  11. #include <vector>
  12. /** \class cmCTestSubmitHandler
  13. * \brief Helper class for CTest
  14. *
  15. * Submit testing results
  16. *
  17. */
  18. class cmCTestSubmitHandler : public cmCTestGenericHandler
  19. {
  20. public:
  21. typedef cmCTestGenericHandler Superclass;
  22. cmCTestSubmitHandler();
  23. ~cmCTestSubmitHandler() override { this->LogFile = nullptr; }
  24. /*
  25. * The main entry point for this class
  26. */
  27. int ProcessHandler() override;
  28. void Initialize() override;
  29. /** Specify a set of parts (by name) to submit. */
  30. void SelectParts(std::set<cmCTest::Part> const& parts);
  31. /** Specify a set of files to submit. */
  32. void SelectFiles(cmCTest::SetOfStrings const& files);
  33. // handle the cdash file upload protocol
  34. int HandleCDashUploadFile(std::string const& file, std::string const& type);
  35. void SetHttpHeaders(std::vector<std::string> const& v)
  36. {
  37. this->HttpHeaders = v;
  38. }
  39. void ConstructCDashURL(std::string& dropMethod, std::string& url);
  40. private:
  41. void SetLogFile(std::ostream* ost) { this->LogFile = ost; }
  42. /**
  43. * Submit file using various ways
  44. */
  45. bool SubmitUsingFTP(const std::string& localprefix,
  46. const std::set<std::string>& files,
  47. const std::string& remoteprefix, const std::string& url);
  48. bool SubmitUsingHTTP(const std::string& localprefix,
  49. const std::set<std::string>& files,
  50. const std::string& remoteprefix,
  51. const std::string& url);
  52. bool SubmitUsingSCP(const std::string& scp_command,
  53. const std::string& localprefix,
  54. const std::set<std::string>& files,
  55. const std::string& remoteprefix, const std::string& url);
  56. bool SubmitUsingCP(const std::string& localprefix,
  57. const std::set<std::string>& files,
  58. const std::string& remoteprefix, const std::string& url);
  59. bool TriggerUsingHTTP(const std::set<std::string>& files,
  60. const std::string& remoteprefix,
  61. const std::string& url);
  62. bool SubmitUsingXMLRPC(const std::string& localprefix,
  63. const std::set<std::string>& files,
  64. const std::string& remoteprefix,
  65. const std::string& url);
  66. typedef std::vector<char> cmCTestSubmitHandlerVectorOfChar;
  67. void ParseResponse(cmCTestSubmitHandlerVectorOfChar chunk);
  68. std::string GetSubmitResultsPrefix();
  69. class ResponseParser;
  70. std::string HTTPProxy;
  71. int HTTPProxyType;
  72. std::string HTTPProxyAuth;
  73. std::string FTPProxy;
  74. int FTPProxyType;
  75. std::ostream* LogFile;
  76. bool SubmitPart[cmCTest::PartCount];
  77. bool CDash;
  78. bool HasWarnings;
  79. bool HasErrors;
  80. cmCTest::SetOfStrings Files;
  81. std::vector<std::string> HttpHeaders;
  82. };
  83. #endif