summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Source/CTest/cmCTestSubmitHandler.cxx48
-rw-r--r--Tests/RunCMake/ctest_submit/FILESNoBuildId-result.txt1
-rw-r--r--Tests/RunCMake/ctest_submit/FILESNoBuildId-stderr.txt1
-rw-r--r--Tests/RunCMake/ctest_submit/FILESNoBuildId-stdout.txt1
-rw-r--r--Tests/RunCMake/ctest_submit/RunCMakeTest.cmake1
5 files changed, 32 insertions, 20 deletions
diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx
index c7f3f39117..ecf309a809 100644
--- a/Source/CTest/cmCTestSubmitHandler.cxx
+++ b/Source/CTest/cmCTestSubmitHandler.cxx
@@ -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);
+ }
}
}
diff --git a/Tests/RunCMake/ctest_submit/FILESNoBuildId-result.txt b/Tests/RunCMake/ctest_submit/FILESNoBuildId-result.txt
new file mode 100644
index 0000000000..b57e2deb77
--- /dev/null
+++ b/Tests/RunCMake/ctest_submit/FILESNoBuildId-result.txt
@@ -0,0 +1 @@
+(-1|255)
diff --git a/Tests/RunCMake/ctest_submit/FILESNoBuildId-stderr.txt b/Tests/RunCMake/ctest_submit/FILESNoBuildId-stderr.txt
new file mode 100644
index 0000000000..a8f10b558f
--- /dev/null
+++ b/Tests/RunCMake/ctest_submit/FILESNoBuildId-stderr.txt
@@ -0,0 +1 @@
+ *Error message was: ([Cc]ould *n.t resolve host:? '?-no-site-'?.*|The requested URL returned error:.*)
diff --git a/Tests/RunCMake/ctest_submit/FILESNoBuildId-stdout.txt b/Tests/RunCMake/ctest_submit/FILESNoBuildId-stdout.txt
new file mode 100644
index 0000000000..929b2549c0
--- /dev/null
+++ b/Tests/RunCMake/ctest_submit/FILESNoBuildId-stdout.txt
@@ -0,0 +1 @@
+Upload file: .* to http:\/\/-no-site-\?FileName=test-site___test-build-name___.*-Experimental___XML___RunCMakeTest.cmake&MD5=.* Size: .*
diff --git a/Tests/RunCMake/ctest_submit/RunCMakeTest.cmake b/Tests/RunCMake/ctest_submit/RunCMakeTest.cmake
index 7661383646..952368d838 100644
--- a/Tests/RunCMake/ctest_submit/RunCMakeTest.cmake
+++ b/Tests/RunCMake/ctest_submit/RunCMakeTest.cmake
@@ -31,6 +31,7 @@ run_ctest_submit(CDashUploadMissingFile CDASH_UPLOAD bad-upload)
run_ctest_submit(CDashUploadRetry CDASH_UPLOAD ${CMAKE_CURRENT_LIST_FILE} CDASH_UPLOAD_TYPE foo RETRY_COUNT 2 RETRY_DELAY 1 INTERNAL_TEST_CHECKSUM)
run_ctest_submit(CDashSubmitQuiet QUIET)
run_ctest_submit_debug(CDashSubmitVerbose)
+run_ctest_submit_debug(FILESNoBuildId FILES ${CMAKE_CURRENT_LIST_FILE})
run_ctest_submit_debug(CDashSubmitHeaders HTTPHEADER "Authorization: Bearer asdf")
run_ctest_submit_debug(CDashUploadHeaders CDASH_UPLOAD ${CMAKE_CURRENT_LIST_FILE} CDASH_UPLOAD_TYPE foo HTTPHEADER "Authorization: Bearer asdf")