CTest: Remove submit method 'scp'

This commit is contained in:
Regina Pfeifer 2018-11-27 22:35:00 +01:00
parent aebdad399e
commit c339b64cf2
11 changed files with 4 additions and 152 deletions

View File

@ -1106,8 +1106,8 @@ Configuration settings include:
``DropMethod``
Specify the method by which results should be submitted to the
dashboard server. The value may be ``ftp``, ``http``,
``https``, or ``scp``.
dashboard server. The value may be ``ftp``, ``http``, or
``https``.
* `CTest Script`_ variable: :variable:`CTEST_DROP_METHOD`
* :module:`CTest` module variable: ``DROP_METHOD`` if set,
@ -1144,7 +1144,7 @@ Configuration settings include:
* :module:`CTest` module variable: ``CTEST_DROP_SITE_CDASH``
``ScpCommand``
``scp`` command-line tool to use when ``DropMethod`` is ``scp``.
Legacy option. Not used.
* `CTest Script`_ variable: :variable:`CTEST_SCP_COMMAND`
* :module:`CTest` module variable: ``SCPCOMMAND``

View File

@ -1,5 +1,4 @@
CTEST_SCP_COMMAND
-----------------
Specify the CTest ``SCPCommand`` setting
in a :manual:`ctest(1)` dashboard client script.
Legacy option. Not used.

View File

@ -177,9 +177,6 @@ if(BUILD_TESTING)
)
set(MEMORYCHECK_SUPPRESSIONS_FILE "" CACHE FILEPATH
"File that contains suppressions for the memory checker")
find_program(SCPCOMMAND scp DOC
"Path to scp command, used by CTest for submitting results to a Dart server"
)
find_program(COVERAGE_COMMAND gcov DOC
"Path to the coverage program that CTest uses for performing coverage inspection"
)

View File

@ -30,7 +30,6 @@ DropSitePassword: @DROP_SITE_PASSWORD@
DropSiteMode: @DROP_SITE_MODE@
DropMethod: @DROP_METHOD@
TriggerSite: @TRIGGER_SITE@
ScpCommand: @SCPCOMMAND@
# Dashboard start time
NightlyStartTime: @NIGHTLY_START_TIME@

View File

@ -58,8 +58,6 @@ cmCTestGenericHandler* cmCTestSubmitCommand::InitializeHandler()
this->CTest->SetCTestConfigurationFromCMakeVariable(
this->Makefile, "DropSitePassword", "CTEST_DROP_SITE_PASSWORD",
this->Quiet);
this->CTest->SetCTestConfigurationFromCMakeVariable(
this->Makefile, "ScpCommand", "CTEST_SCP_COMMAND", this->Quiet);
const char* notesFilesVariable =
this->Makefile->GetDefinition("CTEST_NOTES_FILES");

View File

@ -5,9 +5,7 @@
#include "cm_curl.h"
#include "cm_jsoncpp_reader.h"
#include "cm_jsoncpp_value.h"
#include "cmsys/Process.h"
#include <chrono>
#include <cstring>
#include <sstream>
#include <stdio.h>
#include <stdlib.h>
@ -20,10 +18,8 @@
#include "cmCurl.h"
#include "cmDuration.h"
#include "cmGeneratedFileStream.h"
#include "cmProcessOutput.h"
#include "cmState.h"
#include "cmSystemTools.h"
#include "cmWorkingDirectory.h"
#include "cmXMLParser.h"
#include "cmake.h"
@ -799,102 +795,6 @@ bool cmCTestSubmitHandler::TriggerUsingHTTP(
return true;
}
bool cmCTestSubmitHandler::SubmitUsingSCP(
const std::string& scp_command, const std::string& localprefix,
const std::vector<std::string>& files, const std::string& remoteprefix,
const std::string& url)
{
if (scp_command.empty() || localprefix.empty() || files.empty() ||
remoteprefix.empty() || url.empty()) {
return false;
}
std::vector<const char*> argv;
argv.push_back(scp_command.c_str()); // Scp command
argv.push_back(scp_command.c_str()); // Dummy string for file
argv.push_back(scp_command.c_str()); // Dummy string for remote url
argv.push_back(nullptr);
cmsysProcess* cp = cmsysProcess_New();
cmsysProcess_SetOption(cp, cmsysProcess_Option_HideWindow, 1);
// cmsysProcess_SetTimeout(cp, timeout);
int problems = 0;
for (std::string const& file : files) {
int retVal;
std::string lfname = localprefix;
cmSystemTools::ConvertToUnixSlashes(lfname);
lfname += "/" + file;
lfname = cmSystemTools::ConvertToOutputPath(lfname);
argv[1] = lfname.c_str();
std::string rfname = url + "/" + remoteprefix + file;
argv[2] = rfname.c_str();
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
"Execute \"" << argv[0] << "\" \"" << argv[1] << "\" \""
<< argv[2] << "\"" << std::endl,
this->Quiet);
*this->LogFile << "Execute \"" << argv[0] << "\" \"" << argv[1] << "\" \""
<< argv[2] << "\"" << std::endl;
cmsysProcess_SetCommand(cp, &*argv.begin());
cmsysProcess_Execute(cp);
char* data;
int length;
cmProcessOutput processOutput;
std::string strdata;
while (cmsysProcess_WaitForData(cp, &data, &length, nullptr)) {
processOutput.DecodeText(data, length, strdata);
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
cmCTestLogWrite(strdata.c_str(), strdata.size()),
this->Quiet);
}
processOutput.DecodeText(std::string(), strdata);
if (!strdata.empty()) {
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
cmCTestLogWrite(strdata.c_str(), strdata.size()),
this->Quiet);
}
cmsysProcess_WaitForExit(cp, nullptr);
int result = cmsysProcess_GetState(cp);
if (result == cmsysProcess_State_Exited) {
retVal = cmsysProcess_GetExitValue(cp);
if (retVal != 0) {
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
"\tSCP returned: " << retVal << std::endl,
this->Quiet);
*this->LogFile << "\tSCP returned: " << retVal << std::endl;
problems++;
}
} else if (result == cmsysProcess_State_Exception) {
retVal = cmsysProcess_GetExitException(cp);
cmCTestLog(this->CTest, ERROR_MESSAGE,
"\tThere was an exception: " << retVal << std::endl);
*this->LogFile << "\tThere was an exception: " << retVal << std::endl;
problems++;
} else if (result == cmsysProcess_State_Expired) {
cmCTestLog(this->CTest, ERROR_MESSAGE,
"\tThere was a timeout" << std::endl);
*this->LogFile << "\tThere was a timeout" << std::endl;
problems++;
} else if (result == cmsysProcess_State_Error) {
cmCTestLog(this->CTest, ERROR_MESSAGE,
"\tError executing SCP: " << cmsysProcess_GetErrorString(cp)
<< std::endl);
*this->LogFile << "\tError executing SCP: "
<< cmsysProcess_GetErrorString(cp) << std::endl;
problems++;
}
}
cmsysProcess_Delete(cp);
return problems == 0;
}
void cmCTestSubmitHandler::ConstructCDashURL(std::string& dropMethod,
std::string& url)
{
@ -1446,39 +1346,6 @@ int cmCTestSubmitHandler::ProcessHandler()
<< (this->HasWarnings ? ", with warnings." : "") << std::endl;
}
return 0;
} else if (dropMethod == "scp") {
std::string url;
if (!this->CTest->GetCTestConfiguration("DropSiteUser").empty()) {
url += this->CTest->GetCTestConfiguration("DropSiteUser") + "@";
}
url += this->CTest->GetCTestConfiguration("DropSite") + ":" +
this->CTest->GetCTestConfiguration("DropLocation");
// change to the build directory so that we can uses a relative path
// on windows since scp doesn't support "c:" a drive in the path
cmWorkingDirectory workdir(buildDirectory);
if (workdir.Failed()) {
cmCTestLog(this->CTest, ERROR_MESSAGE,
" Failed to change directory to "
<< buildDirectory << " : "
<< std::strerror(workdir.GetLastResult()) << std::endl);
ofs << " Failed to change directory to " << buildDirectory << " : "
<< std::strerror(workdir.GetLastResult()) << std::endl;
return -1;
}
if (!this->SubmitUsingSCP(this->CTest->GetCTestConfiguration("ScpCommand"),
"Testing/" + this->CTest->GetCurrentTag(), files,
prefix, url)) {
cmCTestLog(this->CTest, ERROR_MESSAGE,
" Problems when submitting via SCP" << std::endl);
ofs << " Problems when submitting via SCP" << std::endl;
return -1;
}
cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT,
" Submission successful" << std::endl, this->Quiet);
ofs << " Submission successful" << std::endl;
return 0;
}

View File

@ -63,10 +63,6 @@ private:
const std::vector<std::string>& files,
const std::string& remoteprefix,
const std::string& url);
bool SubmitUsingSCP(const std::string& scp_command,
const std::string& localprefix,
const std::vector<std::string>& files,
const std::string& remoteprefix, const std::string& url);
bool TriggerUsingHTTP(const std::vector<std::string>& files,
const std::string& remoteprefix,

View File

@ -1 +0,0 @@
(-1|255)

View File

@ -1 +0,0 @@
Problems when submitting via SCP

View File

@ -1 +0,0 @@
Submit files \(using scp\)

View File

@ -52,4 +52,3 @@ endfunction()
run_ctest_submit_FailDrop(ftp)
run_ctest_submit_FailDrop(http)
run_ctest_submit_FailDrop(https)
run_ctest_submit_FailDrop(scp)