cmCTestSubmitHandler: Initialize HttpHeaders with command line

This commit is contained in:
Daniel Pfeifer 2024-10-25 00:50:25 +02:00
parent 81e904bd53
commit b64e59d571
4 changed files with 10 additions and 14 deletions

View File

@ -133,6 +133,7 @@ void cmCTestSubmitHandler::Initialize(cmCTest* ctest)
this->HTTPProxyAuth.clear();
this->LogFile = nullptr;
this->Files.clear();
this->HttpHeaders = ctest->GetCommandLineHttpHeaders();
}
bool cmCTestSubmitHandler::SubmitUsingHTTP(

View File

@ -42,20 +42,9 @@ public:
// handle the cdash file upload protocol
int HandleCDashUploadFile(std::string const& file, std::string const& type);
void AddCommandLineHttpHeader(std::string const& h)
{
this->HttpHeaders.push_back(h);
this->CommandLineHttpHeaders.push_back(h);
}
void SetHttpHeaders(std::vector<std::string> const& v)
{
if (this->CommandLineHttpHeaders.empty()) {
this->HttpHeaders = v;
} else {
this->HttpHeaders = this->CommandLineHttpHeaders;
this->HttpHeaders.insert(this->HttpHeaders.end(), v.begin(), v.end());
}
this->HttpHeaders.insert(this->HttpHeaders.end(), v.begin(), v.end());
}
private:
@ -86,7 +75,6 @@ private:
bool HasWarnings;
bool HasErrors;
std::set<std::string> Files;
std::vector<std::string> CommandLineHttpHeaders;
std::vector<std::string> HttpHeaders;
bool CDashUpload = false;

View File

@ -206,6 +206,7 @@ struct cmCTest::Private
bool NoTestsModeSetInCli = false;
cmCTestTestOptions TestOptions;
std::vector<std::string> CommandLineHttpHeaders;
};
struct tm* cmCTest::GetNightlyTime(std::string const& str, bool tomorrowtag)
@ -2497,7 +2498,7 @@ int cmCTest::Run(std::vector<std::string> const& args)
} },
CommandArgument{ "--http-header", CommandArgument::Values::One,
[this](std::string const& h) -> bool {
this->Impl->SubmitHandler.AddCommandLineHttpHeader(h);
this->Impl->CommandLineHttpHeaders.push_back(h);
return true;
} },
CommandArgument{ "--submit-index", CommandArgument::Values::One,
@ -3200,6 +3201,11 @@ cmCTestTestOptions const& cmCTest::GetTestOptions() const
return this->Impl->TestOptions;
}
std::vector<std::string> cmCTest::GetCommandLineHttpHeaders() const
{
return this->Impl->CommandLineHttpHeaders;
}
void cmCTest::AddSubmitFile(Part part, const std::string& name)
{
this->Impl->Parts[part].SubmitFiles.emplace_back(name);

View File

@ -445,6 +445,7 @@ public:
bool UpdateCTestConfiguration();
cmCTestTestOptions const& GetTestOptions() const;
std::vector<std::string> GetCommandLineHttpHeaders() const;
private:
int GenerateNotesFile(cmake* cm, const std::string& files);