cmCTestSubmitHandler.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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 <iosfwd>
  6. #include <set>
  7. #include <string>
  8. #include <vector>
  9. #include "cmCTest.h"
  10. #include "cmCTestGenericHandler.h"
  11. /** \class cmCTestSubmitHandler
  12. * \brief Helper class for CTest
  13. *
  14. * Submit testing results
  15. *
  16. */
  17. class cmCTestSubmitHandler : public cmCTestGenericHandler
  18. {
  19. public:
  20. using Superclass = cmCTestGenericHandler;
  21. cmCTestSubmitHandler();
  22. ~cmCTestSubmitHandler() override { this->LogFile = nullptr; }
  23. /*
  24. * The main entry point for this class
  25. */
  26. int ProcessHandler() override;
  27. void Initialize() override;
  28. /** Specify a set of parts (by name) to submit. */
  29. void SelectParts(std::set<cmCTest::Part> const& parts);
  30. /** Specify a set of files to submit. */
  31. void SelectFiles(std::set<std::string> const& files);
  32. // handle the cdash file upload protocol
  33. int HandleCDashUploadFile(std::string const& file, std::string const& type);
  34. void SetHttpHeaders(std::vector<std::string> const& v)
  35. {
  36. this->HttpHeaders = v;
  37. }
  38. private:
  39. void SetLogFile(std::ostream* ost) { this->LogFile = ost; }
  40. /**
  41. * Submit file using various ways
  42. */
  43. bool SubmitUsingHTTP(const std::string& localprefix,
  44. const std::vector<std::string>& files,
  45. const std::string& remoteprefix,
  46. const std::string& url);
  47. using cmCTestSubmitHandlerVectorOfChar = std::vector<char>;
  48. void ParseResponse(cmCTestSubmitHandlerVectorOfChar chunk);
  49. std::string GetSubmitResultsPrefix();
  50. class ResponseParser;
  51. std::string HTTPProxy;
  52. int HTTPProxyType;
  53. std::string HTTPProxyAuth;
  54. std::ostream* LogFile;
  55. bool SubmitPart[cmCTest::PartCount];
  56. bool HasWarnings;
  57. bool HasErrors;
  58. std::set<std::string> Files;
  59. std::vector<std::string> HttpHeaders;
  60. };