mirror of
https://github.com/Kitware/CMake.git
synced 2026-04-26 00:00:39 -05:00
ctest: only create buildid when submitting from Testing/ dir
In 7f530cc we taught CTest to pass extra information to CDash at submit
time. This extra info is used by CDash to initialize a buildid.
`ctest_submit(FILES)` can be used to send specific files to CDash.
These files are not necessarily associated with the build currently
being performed. For this reason, we modify the behavior of ctest_submit()
to only specify this extra info when we are submitting files from the
current build's Testing directory.
This commit is contained in:
@@ -392,8 +392,12 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const std::string& localprefix,
|
||||
::curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
|
||||
|
||||
std::string local_file = file;
|
||||
bool initialize_cdash_buildid = false;
|
||||
if (!cmSystemTools::FileExists(local_file)) {
|
||||
local_file = localprefix + "/" + file;
|
||||
// If this file exists within the local Testing directory we assume
|
||||
// that it will be associated with the current build in CDash.
|
||||
initialize_cdash_buildid = true;
|
||||
}
|
||||
std::string remote_file =
|
||||
remoteprefix + cmSystemTools::GetFilenameName(file);
|
||||
@@ -425,26 +429,30 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const std::string& localprefix,
|
||||
((url.find('?') == std::string::npos) ? '?' : '&') +
|
||||
"FileName=" + ofile;
|
||||
|
||||
cmCTestCurl ctest_curl(this->CTest);
|
||||
upload_as += "&build=";
|
||||
upload_as +=
|
||||
ctest_curl.Escape(this->CTest->GetCTestConfiguration("BuildName"));
|
||||
upload_as += "&site=";
|
||||
upload_as +=
|
||||
ctest_curl.Escape(this->CTest->GetCTestConfiguration("Site"));
|
||||
upload_as += "&stamp=";
|
||||
upload_as += ctest_curl.Escape(this->CTest->GetCurrentTag());
|
||||
upload_as += "-";
|
||||
upload_as += ctest_curl.Escape(this->CTest->GetTestModelString());
|
||||
cmCTestScriptHandler* ch =
|
||||
static_cast<cmCTestScriptHandler*>(this->CTest->GetHandler("script"));
|
||||
cmake* cm = ch->GetCMake();
|
||||
if (cm) {
|
||||
const char* subproject =
|
||||
cm->GetState()->GetGlobalProperty("SubProject");
|
||||
if (subproject) {
|
||||
upload_as += "&subproject=";
|
||||
upload_as += ctest_curl.Escape(subproject);
|
||||
if (initialize_cdash_buildid) {
|
||||
// Provide extra arguments to CDash so that it can initialize and
|
||||
// return a buildid.
|
||||
cmCTestCurl ctest_curl(this->CTest);
|
||||
upload_as += "&build=";
|
||||
upload_as +=
|
||||
ctest_curl.Escape(this->CTest->GetCTestConfiguration("BuildName"));
|
||||
upload_as += "&site=";
|
||||
upload_as +=
|
||||
ctest_curl.Escape(this->CTest->GetCTestConfiguration("Site"));
|
||||
upload_as += "&stamp=";
|
||||
upload_as += ctest_curl.Escape(this->CTest->GetCurrentTag());
|
||||
upload_as += "-";
|
||||
upload_as += ctest_curl.Escape(this->CTest->GetTestModelString());
|
||||
cmCTestScriptHandler* ch = static_cast<cmCTestScriptHandler*>(
|
||||
this->CTest->GetHandler("script"));
|
||||
cmake* cm = ch->GetCMake();
|
||||
if (cm) {
|
||||
const char* subproject =
|
||||
cm->GetState()->GetGlobalProperty("SubProject");
|
||||
if (subproject) {
|
||||
upload_as += "&subproject=";
|
||||
upload_as += ctest_curl.Escape(subproject);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user