cmCTestSubmitHandler.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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. private:
  40. void SetLogFile(std::ostream* ost) { this->LogFile = ost; }
  41. /**
  42. * Submit file using various ways
  43. */
  44. bool SubmitUsingHTTP(const std::string& localprefix,
  45. const std::vector<std::string>& files,
  46. const std::string& remoteprefix,
  47. const std::string& url);
  48. typedef std::vector<char> cmCTestSubmitHandlerVectorOfChar;
  49. void ParseResponse(cmCTestSubmitHandlerVectorOfChar chunk);
  50. std::string GetSubmitResultsPrefix();
  51. class ResponseParser;
  52. std::string HTTPProxy;
  53. int HTTPProxyType;
  54. std::string HTTPProxyAuth;
  55. std::ostream* LogFile;
  56. bool SubmitPart[cmCTest::PartCount];
  57. bool HasWarnings;
  58. bool HasErrors;
  59. cmCTest::SetOfStrings Files;
  60. std::vector<std::string> HttpHeaders;
  61. };
  62. #endif