From c7feef30e2655bbb433050bb32f11dd4b053f227 Mon Sep 17 00:00:00 2001 From: Andy Cedilnik Date: Tue, 3 May 2005 08:17:39 -0400 Subject: ENH: Promote submit into a full handler, add test and submit command and do some cleanups --- CTestConfig.cmake | 4 +- Source/CMakeLists.txt | 4 +- Source/CTest/cmCTestBuildHandler.cxx | 4 +- Source/CTest/cmCTestScriptHandler.cxx | 4 + Source/CTest/cmCTestSubmit.cxx | 638 -------------------------- Source/CTest/cmCTestSubmit.h | 79 ---- Source/CTest/cmCTestSubmitCommand.cxx | 54 +++ Source/CTest/cmCTestSubmitCommand.h | 78 ++++ Source/CTest/cmCTestSubmitHandler.cxx | 813 ++++++++++++++++++++++++++++++++++ Source/CTest/cmCTestSubmitHandler.h | 79 ++++ Source/CTest/cmCTestTestCommand.cxx | 52 +++ Source/CTest/cmCTestTestCommand.h | 79 ++++ Source/cmCTest.cxx | 174 +------- Source/cmCTest.h | 21 +- 14 files changed, 1180 insertions(+), 903 deletions(-) delete mode 100644 Source/CTest/cmCTestSubmit.cxx delete mode 100644 Source/CTest/cmCTestSubmit.h create mode 100644 Source/CTest/cmCTestSubmitCommand.cxx create mode 100644 Source/CTest/cmCTestSubmitCommand.h create mode 100644 Source/CTest/cmCTestSubmitHandler.cxx create mode 100644 Source/CTest/cmCTestSubmitHandler.h create mode 100644 Source/CTest/cmCTestTestCommand.cxx create mode 100644 Source/CTest/cmCTestTestCommand.h diff --git a/CTestConfig.cmake b/CTestConfig.cmake index 602e08b..06226a7 100644 --- a/CTestConfig.cmake +++ b/CTestConfig.cmake @@ -1,7 +1,7 @@ SET (CTEST_PROJECT_NAME "CMake") SET (CTEST_NIGHTLY_START_TIME "21:00:00 EDT") +SET (CTEST_DROP_METHOD "http") SET (CTEST_DROP_SITE "public.kitware.com") SET (CTEST_DROP_LOCATION "/cgi-bin/HTTPUploadDartFile.cgi") -SET (CTEST_TRIGGER_SITE - "http://${DROP_SITE}/cgi-bin/Submit-CMake-TestingResults.cgi") +SET (CTEST_TRIGGER_SITE "http://${CTEST_DROP_SITE}/cgi-bin/Submit-CMake-TestingResults.cgi") diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index f3fdbeb..b8d0afc 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -163,7 +163,9 @@ SET(CMTEST_SRCS cmCTest.cxx CTest/cmCTestScriptHandler.cxx CTest/cmCTestSleepCommand.cxx CTest/cmCTestStartCommand.cxx - CTest/cmCTestSubmit.cxx + CTest/cmCTestSubmitCommand.cxx + CTest/cmCTestSubmitHandler.cxx + CTest/cmCTestTestCommand.cxx CTest/cmCTestTestHandler.cxx CTest/cmCTestUpdateCommand.cxx CTest/cmCTestUpdateHandler.cxx diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx index 66f4f98..a0e2ee7 100644 --- a/Source/CTest/cmCTestBuildHandler.cxx +++ b/Source/CTest/cmCTestBuildHandler.cxx @@ -197,13 +197,13 @@ void cmCTestBuildHandler::PopulateCustomVectors(cmMakefile *mf) int cmCTestBuildHandler::ProcessHandler() { std::cout << "Build project" << std::endl; - std::string makeCommand = m_CTest->GetDartConfiguration("MakeCommand"); + const std::string &makeCommand = m_CTest->GetDartConfiguration("MakeCommand"); if ( makeCommand.size() == 0 ) { std::cerr << "Cannot find MakeCommand key in the DartConfiguration.tcl" << std::endl; return -1; } - std::string buildDirectory = m_CTest->GetDartConfiguration("BuildDirectory"); + const std::string &buildDirectory = m_CTest->GetDartConfiguration("BuildDirectory"); if ( buildDirectory.size() == 0 ) { std::cerr << "Cannot find BuildDirectory key in the DartConfiguration.tcl" << std::endl; diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx index 3703418..71c4bb0 100644 --- a/Source/CTest/cmCTestScriptHandler.cxx +++ b/Source/CTest/cmCTestScriptHandler.cxx @@ -49,6 +49,8 @@ #include "cmCTestSleepCommand.h" #include "cmCTestStartCommand.h" #include "cmCTestUpdateCommand.h" +#include "cmCTestTestCommand.h" +#include "cmCTestSubmitCommand.h" #define CTEST_INITIAL_CMAKE_OUTPUT_FILE_NAME "CTestInitialCMakeOutput.log" @@ -229,6 +231,8 @@ int cmCTestScriptHandler::ReadInScript(const std::string& total_script_arg) this->AddCTestCommand(new cmCTestRunScriptCommand); this->AddCTestCommand(new cmCTestSleepCommand); this->AddCTestCommand(new cmCTestStartCommand); + this->AddCTestCommand(new cmCTestSubmitCommand); + this->AddCTestCommand(new cmCTestTestCommand); this->AddCTestCommand(new cmCTestUpdateCommand); // add the script arg if defined diff --git a/Source/CTest/cmCTestSubmit.cxx b/Source/CTest/cmCTestSubmit.cxx deleted file mode 100644 index bab03b3..0000000 --- a/Source/CTest/cmCTestSubmit.cxx +++ /dev/null @@ -1,638 +0,0 @@ -/*========================================================================= - -Program: CMake - Cross-Platform Makefile Generator -Module: $RCSfile$ -Language: C++ -Date: $Date$ -Version: $Revision$ - -Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. -See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. - -This software is distributed WITHOUT ANY WARRANTY; without even -the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR -PURPOSE. See the above copyright notices for more information. - -=========================================================================*/ - -#include "cmCTestSubmit.h" -#include "cmSystemTools.h" -#include "cmVersion.h" - -#include -#include -#include "xmlrpc.h" -#include "xmlrpc_client.h" - -#include "CTest/Curl/curl/curl.h" - -#include - -//---------------------------------------------------------------------------- -cmCTestSubmit::cmCTestSubmit() : m_HTTPProxy(), m_FTPProxy() -{ - m_Verbose = false; - m_HTTPProxy = ""; - m_HTTPProxyType = 0; - m_HTTPProxyAuth = ""; - if ( getenv("HTTP_PROXY") ) - { - m_HTTPProxyType = 1; - m_HTTPProxy = getenv("HTTP_PROXY"); - if ( getenv("HTTP_PROXY_PORT") ) - { - m_HTTPProxy += ":"; - m_HTTPProxy += getenv("HTTP_PROXY_PORT"); - } - if ( getenv("HTTP_PROXY_TYPE") ) - { - cmStdString type = getenv("HTTP_PROXY_TYPE"); - // HTTP/SOCKS4/SOCKS5 - if ( type == "HTTP" ) - { - m_HTTPProxyType = 1; - } - else if ( type == "SOCKS4" ) - { - m_HTTPProxyType = 2; - } - else if ( type == "SOCKS5" ) - { - m_HTTPProxyType = 3; - } - } - if ( getenv("HTTP_PROXY_USER") ) - { - m_HTTPProxyAuth = getenv("HTTP_PROXY_USER"); - } - if ( getenv("HTTP_PROXY_PASSWD") ) - { - m_HTTPProxyAuth += ":"; - m_HTTPProxyAuth += getenv("HTTP_PROXY_PASSWD"); - } - } - m_FTPProxy = ""; - m_FTPProxyType = 0; - if ( getenv("FTP_PROXY") ) - { - m_FTPProxyType = 1; - m_FTPProxy = getenv("FTP_PROXY"); - if ( getenv("FTP_PROXY_PORT") ) - { - m_FTPProxy += ":"; - m_FTPProxy += getenv("FTP_PROXY_PORT"); - } - if ( getenv("FTP_PROXY_TYPE") ) - { - cmStdString type = getenv("FTP_PROXY_TYPE"); - // HTTP/SOCKS4/SOCKS5 - if ( type == "HTTP" ) - { - m_FTPProxyType = 1; - } - else if ( type == "SOCKS4" ) - { - m_FTPProxyType = 2; - } - else if ( type == "SOCKS5" ) - { - m_FTPProxyType = 3; - } - } - } - if ( m_HTTPProxy.size() > 0 ) - { - std::cout << " Use HTTP Proxy: " << m_HTTPProxy << std::endl; - } - if ( m_FTPProxy.size() > 0 ) - { - std::cout << " Use FTP Proxy: " << m_FTPProxy << std::endl; - } -} - -//---------------------------------------------------------------------------- -bool cmCTestSubmit::SubmitUsingFTP(const cmStdString& localprefix, - const std::vector& files, - const cmStdString& remoteprefix, - const cmStdString& url) -{ - CURL *curl; - CURLcode res; - FILE* ftpfile; - char error_buffer[1024]; - - /* In windows, this will init the winsock stuff */ - ::curl_global_init(CURL_GLOBAL_ALL); - - cmStdString::size_type cc; - for ( cc = 0; cc < files.size(); cc ++ ) - { - /* get a curl handle */ - curl = curl_easy_init(); - if(curl) - { - // Using proxy - if ( m_FTPProxyType > 0 ) - { - curl_easy_setopt(curl, CURLOPT_PROXY, m_FTPProxy.c_str()); - switch (m_FTPProxyType) - { - case 2: - curl_easy_setopt(curl, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS4); - break; - case 3: - curl_easy_setopt(curl, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5); - break; - default: - curl_easy_setopt(curl, CURLOPT_PROXYTYPE, CURLPROXY_HTTP); - } - } - - // enable uploading - ::curl_easy_setopt(curl, CURLOPT_UPLOAD, 1) ; - - cmStdString local_file = localprefix + "/" + files[cc]; - cmStdString upload_as = url + "/" + remoteprefix + files[cc]; - - struct stat st; - if ( ::stat(local_file.c_str(), &st) ) - { - return false; - } - - ftpfile = ::fopen(local_file.c_str(), "rb"); - *m_LogFile << "\tUpload file: " << local_file.c_str() << " to " - << upload_as.c_str() << std::endl; - if ( m_Verbose ) - { - std::cout << " Upload file: " << local_file.c_str() << " to " - << upload_as.c_str() << std::endl; - } - - if ( m_Verbose ) - { - ::curl_easy_setopt(curl, CURLOPT_VERBOSE, 1); - } - // specify target - ::curl_easy_setopt(curl,CURLOPT_URL, upload_as.c_str()); - - // now specify which file to upload - ::curl_easy_setopt(curl, CURLOPT_INFILE, ftpfile); - - // and give the size of the upload (optional) - ::curl_easy_setopt(curl, CURLOPT_INFILESIZE, static_cast(st.st_size)); - - ::curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, &error_buffer); - - // Now run off and do what you've been told! - res = ::curl_easy_perform(curl); - fclose(ftpfile); - if ( res ) - { - std::cerr << " Error when uploading file: " << local_file.c_str() << std::endl; - std::cerr << " Error message was: " << error_buffer << std::endl; - *m_LogFile << " Error when uploading file: " << local_file.c_str() << std::endl - << " Error message was: " << error_buffer << std::endl; - ::curl_easy_cleanup(curl); - ::curl_global_cleanup(); - return false; - } - // always cleanup - ::curl_easy_cleanup(curl); - std::cout << " Uploaded: " + local_file << std::endl; - } - } - ::curl_global_cleanup(); - return true; -} - -//---------------------------------------------------------------------------- -// Uploading files is simpler -bool cmCTestSubmit::SubmitUsingHTTP(const cmStdString& localprefix, - const std::vector& files, - const cmStdString& remoteprefix, - const cmStdString& url) -{ - CURL *curl; - CURLcode res; - FILE* ftpfile; - char error_buffer[1024]; - - /* In windows, this will init the winsock stuff */ - ::curl_global_init(CURL_GLOBAL_ALL); - - cmStdString::size_type cc, kk; - for ( cc = 0; cc < files.size(); cc ++ ) - { - /* get a curl handle */ - curl = curl_easy_init(); - if(curl) - { - - // Using proxy - if ( m_HTTPProxyType > 0 ) - { - curl_easy_setopt(curl, CURLOPT_PROXY, m_HTTPProxy.c_str()); - switch (m_HTTPProxyType) - { - case 2: - curl_easy_setopt(curl, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS4); - break; - case 3: - curl_easy_setopt(curl, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5); - break; - default: - curl_easy_setopt(curl, CURLOPT_PROXYTYPE, CURLPROXY_HTTP); - if (m_HTTPProxyAuth.size() > 0) - { - curl_easy_setopt(curl, CURLOPT_PROXYUSERPWD, - m_HTTPProxyAuth.c_str()); - } - } - } - - /* enable uploading */ - curl_easy_setopt(curl, CURLOPT_UPLOAD, 1) ; - - /* HTTP PUT please */ - curl_easy_setopt(curl, CURLOPT_PUT, 1); - if ( m_Verbose ) - { - ::curl_easy_setopt(curl, CURLOPT_VERBOSE, 1); - } - - cmStdString local_file = localprefix + "/" + files[cc]; - cmStdString remote_file = remoteprefix + files[cc]; - - *m_LogFile << "\tUpload file: " << local_file.c_str() << " to " - << remote_file.c_str() << std::endl; - - cmStdString ofile = ""; - for ( kk = 0; kk < remote_file.size(); kk ++ ) - { - char c = remote_file[kk]; - char hex[4] = { 0, 0, 0, 0 }; - hex[0] = c; - switch ( c ) - { - case '+': - case '?': - case '/': - case '\\': - case '&': - case ' ': - case '=': - case '%': - sprintf(hex, "%%%02X", (int)c); - ofile.append(hex); - break; - default: - ofile.append(hex); - } - } - cmStdString upload_as - = url + ((url.find("?",0) == cmStdString::npos) ? "?" : "&") - + "FileName=" + ofile; - - struct stat st; - if ( ::stat(local_file.c_str(), &st) ) - { - return false; - } - - ftpfile = ::fopen(local_file.c_str(), "rb"); - if ( m_Verbose ) - { - std::cout << " Upload file: " << local_file.c_str() << " to " - << upload_as.c_str() << " Size: " << st.st_size << std::endl; - } - - - // specify target - ::curl_easy_setopt(curl,CURLOPT_URL, upload_as.c_str()); - - // now specify which file to upload - ::curl_easy_setopt(curl, CURLOPT_INFILE, ftpfile); - - // and give the size of the upload (optional) - ::curl_easy_setopt(curl, CURLOPT_INFILESIZE, static_cast(st.st_size)); - - // and give curl the buffer for errors - ::curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, &error_buffer); - - // Now run off and do what you've been told! - res = ::curl_easy_perform(curl); - - fclose(ftpfile); - if ( res ) - { - std::cerr << " Error when uploading file: " << local_file.c_str() << std::endl; - *m_LogFile << " Error when uploading file: " << local_file.c_str() << std::endl - << " Error message was: " << error_buffer << std::endl; - ::curl_easy_cleanup(curl); - ::curl_global_cleanup(); - return false; - } - // always cleanup - ::curl_easy_cleanup(curl); - std::cout << " Uploaded: " + local_file << std::endl; - } - } - ::curl_global_cleanup(); - return true; -} - -//---------------------------------------------------------------------------- -bool cmCTestSubmit::TriggerUsingHTTP(const std::vector& files, - const cmStdString& remoteprefix, - const cmStdString& url) -{ - CURL *curl; - char error_buffer[1024]; - - /* In windows, this will init the winsock stuff */ - ::curl_global_init(CURL_GLOBAL_ALL); - - cmStdString::size_type cc, kk; - for ( cc = 0; cc < files.size(); cc ++ ) - { - /* get a curl handle */ - curl = curl_easy_init(); - if(curl) - { - // Using proxy - if ( m_HTTPProxyType > 0 ) - { - curl_easy_setopt(curl, CURLOPT_PROXY, m_HTTPProxy.c_str()); - switch (m_HTTPProxyType) - { - case 2: - curl_easy_setopt(curl, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS4); - break; - case 3: - curl_easy_setopt(curl, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5); - break; - default: - curl_easy_setopt(curl, CURLOPT_PROXYTYPE, CURLPROXY_HTTP); - if (m_HTTPProxyAuth.size() > 0) - { - curl_easy_setopt(curl, CURLOPT_PROXYUSERPWD, - m_HTTPProxyAuth.c_str()); - } - } - } - - ::curl_easy_setopt(curl, CURLOPT_VERBOSE, 0); - if ( m_Verbose ) - { - ::curl_easy_setopt(curl, CURLOPT_VERBOSE, 1); - } - - // and give curl the buffer for errors - ::curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, &error_buffer); - - cmStdString file = remoteprefix + files[cc]; - cmStdString ofile = ""; - for ( kk = 0; kk < file.size(); kk ++ ) - { - char c = file[kk]; - char hex[4] = { 0, 0, 0, 0 }; - hex[0] = c; - switch ( c ) - { - case '+': - case '?': - case '/': - case '\\': - case '&': - case ' ': - case '=': - case '%': - sprintf(hex, "%%%02X", (int)c); - ofile.append(hex); - break; - default: - ofile.append(hex); - } - } - cmStdString turl - = url + ((url.find("?",0) == cmStdString::npos) ? "?" : "&") - + "xmlfile=" + ofile; - *m_LogFile << "Trigger url: " << turl.c_str() << std::endl; - if ( m_Verbose ) - { - std::cout << " Trigger url: " << turl.c_str() << std::endl; - } - curl_easy_setopt(curl, CURLOPT_URL, turl.c_str()); - if ( curl_easy_perform(curl) ) - { - std::cerr << " Error when triggering: " << turl.c_str() << std::endl; - *m_LogFile << "\tTrigerring failed with error: " << error_buffer << std::endl; - ::curl_easy_cleanup(curl); - ::curl_global_cleanup(); - return false; - } - // always cleanup - ::curl_easy_cleanup(curl); - std::cout << std::endl; - } - } - ::curl_global_cleanup(); - std::cout << " Dart server triggered..." << std::endl; - return true; -} - -//---------------------------------------------------------------------------- -bool cmCTestSubmit::SubmitUsingSCP( - const cmStdString& scp_command, - const cmStdString& localprefix, - const std::vector& files, - const cmStdString& remoteprefix, - const cmStdString& url) -{ - if ( !scp_command.size() || !localprefix.size() || - !files.size() || !remoteprefix.size() || !url.size() ) - { - return 0; - } - std::vector 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(0); - - cmsysProcess* cp = cmsysProcess_New(); - cmsysProcess_SetOption(cp, cmsysProcess_Option_HideWindow, 1); - //cmsysProcess_SetTimeout(cp, timeout); - - int problems = 0; - - std::vector::const_iterator it; - for ( it = files.begin(); - it != files.end(); - it ++ ) - { - int retVal; - - std::string lfname = localprefix; - cmSystemTools::ConvertToUnixSlashes(lfname); - lfname += "/" + *it; - lfname = cmSystemTools::ConvertToOutputPath(lfname.c_str()); - argv[1] = lfname.c_str(); - std::string rfname = url + "/" + remoteprefix + *it; - argv[2] = rfname.c_str(); - if ( m_Verbose ) - { - std::cout << "Execute \"" << argv[0] << "\" \"" << argv[1] << "\" \"" - << argv[2] << "\"" << std::endl; - } - *m_LogFile << "Execute \"" << argv[0] << "\" \"" << argv[1] << "\" \"" - << argv[2] << "\"" << std::endl; - cmsysProcess_SetCommand(cp, &*argv.begin()); - cmsysProcess_Execute(cp); - char* data; - int length; - while(cmsysProcess_WaitForData(cp, &data, &length, 0)) - { - std::cout.write(data, length); - } - cmsysProcess_WaitForExit(cp, 0); - int result = cmsysProcess_GetState(cp); - - if(result == cmsysProcess_State_Exited) - { - retVal = cmsysProcess_GetExitValue(cp); - if ( retVal != 0 ) - { - if ( m_Verbose ) - { - std::cout << "\tSCP returned: " << retVal << std::endl; - } - *m_LogFile << "\tSCP returned: " << retVal << std::endl; - problems ++; - } - } - else if(result == cmsysProcess_State_Exception) - { - retVal = cmsysProcess_GetExitException(cp); - if ( m_Verbose ) - { - std::cerr << "\tThere was an exception: " << retVal << std::endl; - } - *m_LogFile << "\tThere was an exception: " << retVal << std::endl; - problems ++; - } - else if(result == cmsysProcess_State_Expired) - { - if ( m_Verbose ) - { - std::cerr << "\tThere was a timeout" << std::endl; - } - *m_LogFile << "\tThere was a timeout" << std::endl; - problems ++; - } - else if(result == cmsysProcess_State_Error) - { - if ( m_Verbose ) - { - std::cerr << "\tError executing SCP: " - << cmsysProcess_GetErrorString(cp) << std::endl; - } - *m_LogFile << "\tError executing SCP: " - << cmsysProcess_GetErrorString(cp) << std::endl; - problems ++; - } - } - cmsysProcess_Delete(cp); - if ( problems ) - { - return false; - } - return true; -} - -//---------------------------------------------------------------------------- -bool cmCTestSubmit::SubmitUsingXMLRPC(const cmStdString& localprefix, - const std::vector& files, - const cmStdString& remoteprefix, - const cmStdString& url) -{ - xmlrpc_env env; - std::string ctestVersion = cmVersion::GetCMakeVersion(); - const char *state_name; - - /* Start up our XML-RPC client library. */ - xmlrpc_client_init(XMLRPC_CLIENT_NO_FLAGS, "CTest", ctestVersion.c_str()); - - /* Initialize our error-handling environment. */ - xmlrpc_env_init(&env); - - /* Call the famous server at UserLand. */ - std::cout << " Submitting to: " << url.c_str() << " (" << remoteprefix.c_str() << ")" << std::endl; - std::vector::const_iterator it; - for ( it = files.begin(); it != files.end(); ++it ) - { - xmlrpc_value *result; - - std::string local_file = localprefix + "/" + *it; - std::cout << " Submit file: " << local_file.c_str() << std::endl; - struct stat st; - if ( ::stat(local_file.c_str(), &st) ) - { - return false; - } - - size_t fileSize = st.st_size; - FILE* fp = fopen(local_file.c_str(), "r"); - if ( !fp ) - { - return false; - } - - unsigned char *fileBuffer = new unsigned char[fileSize]; - if ( fread(fileBuffer, 1, fileSize, fp) != fileSize ) - { - delete [] fileBuffer; - fclose(fp); - return false; - } - fclose(fp); - - std::string remoteCommand = remoteprefix + ".put"; - result = xmlrpc_client_call(&env, url.c_str(), - remoteCommand.c_str(), - "(6)", fileBuffer, (xmlrpc_int32)fileSize ); - - delete [] fileBuffer; - - if ( env.fault_occurred ) - { - std::cerr << " Submission problem: " << env.fault_string << " (" << env.fault_code << ")" << std::endl; - xmlrpc_env_clean(&env); - xmlrpc_client_cleanup(); - return 0; - } - - - /* Get our state name and print it out. */ - xmlrpc_parse_value(&env, result, "s", &state_name); - if ( env.fault_occurred ) - { - std::cerr << " Submission problem: " << env.fault_string << " (" << env.fault_code << ")" << std::endl; - xmlrpc_DECREF(result); - xmlrpc_env_clean(&env); - xmlrpc_client_cleanup(); - return 0; - } - - /* Dispose of our result value. */ - xmlrpc_DECREF(result); - } - - /* Clean up our error-handling environment. */ - xmlrpc_env_clean(&env); - - /* Shutdown our XML-RPC client library. */ - xmlrpc_client_cleanup(); - return 1; -} diff --git a/Source/CTest/cmCTestSubmit.h b/Source/CTest/cmCTestSubmit.h deleted file mode 100644 index 5e3a329..0000000 --- a/Source/CTest/cmCTestSubmit.h +++ /dev/null @@ -1,79 +0,0 @@ -/*========================================================================= - - Program: CMake - Cross-Platform Makefile Generator - Module: $RCSfile$ - Language: C++ - Date: $Date$ - Version: $Revision$ - - Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. - See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notices for more information. - -=========================================================================*/ -#ifndef cmCTestSubmit_h -#define cmCTestSubmit_h - -#include "cmStandardIncludes.h" - -/** \class cmCTestSubmit - * \brief Helper class for CTest - * - * Submit testing results - * - */ -class cmCTestSubmit -{ -public: - cmCTestSubmit(); - ~cmCTestSubmit() { m_LogFile = 0; } - - /** - * Set verbosity of send - */ - void SetVerbose(bool i) { m_Verbose = i; } - void VerboseOn() { this->SetVerbose(1); } - void VerboseOff() { this->SetVerbose(0); } - - void SetLogFile(std::ostream* ost) { m_LogFile = ost; } - - /** - * Submit file using various ways - */ - bool SubmitUsingFTP(const cmStdString& localprefix, - const std::vector& files, - const cmStdString& remoteprefix, - const cmStdString& url); - bool SubmitUsingHTTP(const cmStdString& localprefix, - const std::vector& files, - const cmStdString& remoteprefix, - const cmStdString& url); - bool SubmitUsingSCP(const cmStdString& scp_command, - const cmStdString& localprefix, - const std::vector& files, - const cmStdString& remoteprefix, - const cmStdString& url); - - bool TriggerUsingHTTP(const std::vector& files, - const cmStdString& remoteprefix, - const cmStdString& url); - - bool SubmitUsingXMLRPC(const cmStdString& localprefix, - const std::vector& files, - const cmStdString& remoteprefix, - const cmStdString& url); - -private: - cmStdString m_HTTPProxy; - int m_HTTPProxyType; - cmStdString m_HTTPProxyAuth; - cmStdString m_FTPProxy; - int m_FTPProxyType; - bool m_Verbose; - std::ostream* m_LogFile; -}; - -#endif diff --git a/Source/CTest/cmCTestSubmitCommand.cxx b/Source/CTest/cmCTestSubmitCommand.cxx new file mode 100644 index 0000000..d21ade0 --- /dev/null +++ b/Source/CTest/cmCTestSubmitCommand.cxx @@ -0,0 +1,54 @@ +/*========================================================================= + + Program: CMake - Cross-Platform Makefile Generator + Module: $RCSfile$ + Language: C++ + Date: $Date$ + Version: $Revision$ + + Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. + See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. + +=========================================================================*/ +#include "cmCTestSubmitCommand.h" + +#include "cmCTest.h" +#include "cmCTestGenericHandler.h" + +bool cmCTestSubmitCommand::InitialPass( + std::vector const& args) +{ + if (args.size() != 1) + { + this->SetError("called with incorrect number of arguments"); + return false; + } + + const char* res_var = args[0].c_str(); + + m_CTest->SetDartConfigurationFromCMakeVariable(m_Makefile, "DropMethod", "CTEST_DROP_METHOD"); + m_CTest->SetDartConfigurationFromCMakeVariable(m_Makefile, "DropSite", "CTEST_DROP_SITE"); + m_CTest->SetDartConfigurationFromCMakeVariable(m_Makefile, "DropLocation", "CTEST_DROP_LOCATION"); + m_CTest->SetDartConfigurationFromCMakeVariable(m_Makefile, "DropSiteUser", "CTEST_DROP_SITE_USER"); + m_CTest->SetDartConfigurationFromCMakeVariable(m_Makefile, "DropSitePassword", "CTEST_DROP_SITE_PASSWORD"); + m_CTest->SetDartConfigurationFromCMakeVariable(m_Makefile, "TriggerSite", "CTEST_TRIGGER_SITE"); + m_CTest->SetDartConfigurationFromCMakeVariable(m_Makefile, "ScpCommand", "CTEST_SCP_COMMAND"); + + cmCTestGenericHandler* handler = m_CTest->GetHandler("submit"); + if ( !handler ) + { + this->SetError("internal CTest error. Cannot instantiate submit handler"); + return false; + } + int res = handler->ProcessHandler(); + cmOStringStream str; + str << res; + m_Makefile->AddDefinition(res_var, str.str().c_str()); + return true; +} + + diff --git a/Source/CTest/cmCTestSubmitCommand.h b/Source/CTest/cmCTestSubmitCommand.h new file mode 100644 index 0000000..e71d34c --- /dev/null +++ b/Source/CTest/cmCTestSubmitCommand.h @@ -0,0 +1,78 @@ +/*========================================================================= + + Program: CMake - Cross-Platform Makefile Generator + Module: $RCSfile$ + Language: C++ + Date: $Date$ + Version: $Revision$ + + Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. + See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. + +=========================================================================*/ +#ifndef cmCTestSubmitCommand_h +#define cmCTestSubmitCommand_h + +#include "cmCTestCommand.h" + +/** \class cmCTestSubmit + * \brief Run a ctest script + * + * cmCTestSubmitCommand defineds the command to submit the test results for the project. + */ +class cmCTestSubmitCommand : public cmCTestCommand +{ +public: + + cmCTestSubmitCommand() {} + + /** + * This is a virtual constructor for the command. + */ + virtual cmCommand* Clone() + { + cmCTestSubmitCommand* ni = new cmCTestSubmitCommand; + ni->m_CTest = this->m_CTest; + ni->m_CTestScriptHandler = this->m_CTestScriptHandler; + return ni; + } + + /** + * This is called when the command is first encountered in + * the CMakeLists.txt file. + */ + virtual bool InitialPass(std::vector const& args); + + /** + * The name of the command as specified in CMakeList.txt. + */ + virtual const char* GetName() { return "CTEST_SUBMIT";} + + /** + * Succinct documentation. + */ + virtual const char* GetTerseDocumentation() + { + return "Submits the repository."; + } + + /** + * More documentation. + */ + virtual const char* GetFullDocumentation() + { + return + " CTEST_SUBMIT(res)\n" + "Submits the test results for the project."; + } + + cmTypeMacro(cmCTestSubmitCommand, cmCTestCommand); + +}; + + +#endif diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx new file mode 100644 index 0000000..bac3125 --- /dev/null +++ b/Source/CTest/cmCTestSubmitHandler.cxx @@ -0,0 +1,813 @@ +/*========================================================================= + +Program: CMake - Cross-Platform Makefile Generator +Module: $RCSfile$ +Language: C++ +Date: $Date$ +Version: $Revision$ + +Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. +See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. + +This software is distributed WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +PURPOSE. See the above copyright notices for more information. + +=========================================================================*/ +#include "cmCTestSubmitHandler.h" + +#include "cmSystemTools.h" +#include "cmVersion.h" +#include "cmGeneratedFileStream.h" +#include "cmCTest.h" + +#include +#include + +// For XML-RPC submission +#include "xmlrpc.h" +#include "xmlrpc_client.h" + +// For curl submission +#include "CTest/Curl/curl/curl.h" + +#include + +//---------------------------------------------------------------------------- +cmCTestSubmitHandler::cmCTestSubmitHandler() : m_HTTPProxy(), m_FTPProxy() +{ + m_Verbose = false; + m_HTTPProxy = ""; + m_HTTPProxyType = 0; + m_HTTPProxyAuth = ""; + if ( getenv("HTTP_PROXY") ) + { + m_HTTPProxyType = 1; + m_HTTPProxy = getenv("HTTP_PROXY"); + if ( getenv("HTTP_PROXY_PORT") ) + { + m_HTTPProxy += ":"; + m_HTTPProxy += getenv("HTTP_PROXY_PORT"); + } + if ( getenv("HTTP_PROXY_TYPE") ) + { + cmStdString type = getenv("HTTP_PROXY_TYPE"); + // HTTP/SOCKS4/SOCKS5 + if ( type == "HTTP" ) + { + m_HTTPProxyType = 1; + } + else if ( type == "SOCKS4" ) + { + m_HTTPProxyType = 2; + } + else if ( type == "SOCKS5" ) + { + m_HTTPProxyType = 3; + } + } + if ( getenv("HTTP_PROXY_USER") ) + { + m_HTTPProxyAuth = getenv("HTTP_PROXY_USER"); + } + if ( getenv("HTTP_PROXY_PASSWD") ) + { + m_HTTPProxyAuth += ":"; + m_HTTPProxyAuth += getenv("HTTP_PROXY_PASSWD"); + } + } + m_FTPProxy = ""; + m_FTPProxyType = 0; + if ( getenv("FTP_PROXY") ) + { + m_FTPProxyType = 1; + m_FTPProxy = getenv("FTP_PROXY"); + if ( getenv("FTP_PROXY_PORT") ) + { + m_FTPProxy += ":"; + m_FTPProxy += getenv("FTP_PROXY_PORT"); + } + if ( getenv("FTP_PROXY_TYPE") ) + { + cmStdString type = getenv("FTP_PROXY_TYPE"); + // HTTP/SOCKS4/SOCKS5 + if ( type == "HTTP" ) + { + m_FTPProxyType = 1; + } + else if ( type == "SOCKS4" ) + { + m_FTPProxyType = 2; + } + else if ( type == "SOCKS5" ) + { + m_FTPProxyType = 3; + } + } + } + if ( m_HTTPProxy.size() > 0 ) + { + std::cout << " Use HTTP Proxy: " << m_HTTPProxy << std::endl; + } + if ( m_FTPProxy.size() > 0 ) + { + std::cout << " Use FTP Proxy: " << m_FTPProxy << std::endl; + } +} + +//---------------------------------------------------------------------------- +bool cmCTestSubmitHandler::SubmitUsingFTP(const cmStdString& localprefix, + const std::vector& files, + const cmStdString& remoteprefix, + const cmStdString& url) +{ + CURL *curl; + CURLcode res; + FILE* ftpfile; + char error_buffer[1024]; + + /* In windows, this will init the winsock stuff */ + ::curl_global_init(CURL_GLOBAL_ALL); + + cmStdString::size_type cc; + for ( cc = 0; cc < files.size(); cc ++ ) + { + /* get a curl handle */ + curl = curl_easy_init(); + if(curl) + { + // Using proxy + if ( m_FTPProxyType > 0 ) + { + curl_easy_setopt(curl, CURLOPT_PROXY, m_FTPProxy.c_str()); + switch (m_FTPProxyType) + { + case 2: + curl_easy_setopt(curl, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS4); + break; + case 3: + curl_easy_setopt(curl, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5); + break; + default: + curl_easy_setopt(curl, CURLOPT_PROXYTYPE, CURLPROXY_HTTP); + } + } + + // enable uploading + ::curl_easy_setopt(curl, CURLOPT_UPLOAD, 1) ; + + cmStdString local_file = localprefix + "/" + files[cc]; + cmStdString upload_as = url + "/" + remoteprefix + files[cc]; + + struct stat st; + if ( ::stat(local_file.c_str(), &st) ) + { + return false; + } + + ftpfile = ::fopen(local_file.c_str(), "rb"); + *m_LogFile << "\tUpload file: " << local_file.c_str() << " to " + << upload_as.c_str() << std::endl; + if ( m_Verbose ) + { + std::cout << " Upload file: " << local_file.c_str() << " to " + << upload_as.c_str() << std::endl; + } + + if ( m_Verbose ) + { + ::curl_easy_setopt(curl, CURLOPT_VERBOSE, 1); + } + // specify target + ::curl_easy_setopt(curl,CURLOPT_URL, upload_as.c_str()); + + // now specify which file to upload + ::curl_easy_setopt(curl, CURLOPT_INFILE, ftpfile); + + // and give the size of the upload (optional) + ::curl_easy_setopt(curl, CURLOPT_INFILESIZE, static_cast(st.st_size)); + + ::curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, &error_buffer); + + // Now run off and do what you've been told! + res = ::curl_easy_perform(curl); + fclose(ftpfile); + if ( res ) + { + std::cerr << " Error when uploading file: " << local_file.c_str() << std::endl; + std::cerr << " Error message was: " << error_buffer << std::endl; + *m_LogFile << " Error when uploading file: " << local_file.c_str() << std::endl + << " Error message was: " << error_buffer << std::endl; + ::curl_easy_cleanup(curl); + ::curl_global_cleanup(); + return false; + } + // always cleanup + ::curl_easy_cleanup(curl); + std::cout << " Uploaded: " + local_file << std::endl; + } + } + ::curl_global_cleanup(); + return true; +} + +//---------------------------------------------------------------------------- +// Uploading files is simpler +bool cmCTestSubmitHandler::SubmitUsingHTTP(const cmStdString& localprefix, + const std::vector& files, + const cmStdString& remoteprefix, + const cmStdString& url) +{ + CURL *curl; + CURLcode res; + FILE* ftpfile; + char error_buffer[1024]; + + /* In windows, this will init the winsock stuff */ + ::curl_global_init(CURL_GLOBAL_ALL); + + cmStdString::size_type cc, kk; + for ( cc = 0; cc < files.size(); cc ++ ) + { + /* get a curl handle */ + curl = curl_easy_init(); + if(curl) + { + + // Using proxy + if ( m_HTTPProxyType > 0 ) + { + curl_easy_setopt(curl, CURLOPT_PROXY, m_HTTPProxy.c_str()); + switch (m_HTTPProxyType) + { + case 2: + curl_easy_setopt(curl, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS4); + break; + case 3: + curl_easy_setopt(curl, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5); + break; + default: + curl_easy_setopt(curl, CURLOPT_PROXYTYPE, CURLPROXY_HTTP); + if (m_HTTPProxyAuth.size() > 0) + { + curl_easy_setopt(curl, CURLOPT_PROXYUSERPWD, + m_HTTPProxyAuth.c_str()); + } + } + } + + /* enable uploading */ + curl_easy_setopt(curl, CURLOPT_UPLOAD, 1) ; + + /* HTTP PUT please */ + curl_easy_setopt(curl, CURLOPT_PUT, 1); + if ( m_Verbose ) + { + ::curl_easy_setopt(curl, CURLOPT_VERBOSE, 1); + } + + cmStdString local_file = localprefix + "/" + files[cc]; + cmStdString remote_file = remoteprefix + files[cc]; + + *m_LogFile << "\tUpload file: " << local_file.c_str() << " to " + << remote_file.c_str() << std::endl; + + cmStdString ofile = ""; + for ( kk = 0; kk < remote_file.size(); kk ++ ) + { + char c = remote_file[kk]; + char hex[4] = { 0, 0, 0, 0 }; + hex[0] = c; + switch ( c ) + { + case '+': + case '?': + case '/': + case '\\': + case '&': + case ' ': + case '=': + case '%': + sprintf(hex, "%%%02X", (int)c); + ofile.append(hex); + break; + default: + ofile.append(hex); + } + } + cmStdString upload_as + = url + ((url.find("?",0) == cmStdString::npos) ? "?" : "&") + + "FileName=" + ofile; + + struct stat st; + if ( ::stat(local_file.c_str(), &st) ) + { + return false; + } + + ftpfile = ::fopen(local_file.c_str(), "rb"); + if ( m_Verbose ) + { + std::cout << " Upload file: " << local_file.c_str() << " to " + << upload_as.c_str() << " Size: " << st.st_size << std::endl; + } + + + // specify target + ::curl_easy_setopt(curl,CURLOPT_URL, upload_as.c_str()); + + // now specify which file to upload + ::curl_easy_setopt(curl, CURLOPT_INFILE, ftpfile); + + // and give the size of the upload (optional) + ::curl_easy_setopt(curl, CURLOPT_INFILESIZE, static_cast(st.st_size)); + + // and give curl the buffer for errors + ::curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, &error_buffer); + + // Now run off and do what you've been told! + res = ::curl_easy_perform(curl); + + fclose(ftpfile); + if ( res ) + { + std::cerr << " Error when uploading file: " << local_file.c_str() << std::endl; + *m_LogFile << " Error when uploading file: " << local_file.c_str() << std::endl + << " Error message was: " << error_buffer << std::endl; + ::curl_easy_cleanup(curl); + ::curl_global_cleanup(); + return false; + } + // always cleanup + ::curl_easy_cleanup(curl); + std::cout << " Uploaded: " + local_file << std::endl; + } + } + ::curl_global_cleanup(); + return true; +} + +//---------------------------------------------------------------------------- +bool cmCTestSubmitHandler::TriggerUsingHTTP(const std::vector& files, + const cmStdString& remoteprefix, + const cmStdString& url) +{ + CURL *curl; + char error_buffer[1024]; + + /* In windows, this will init the winsock stuff */ + ::curl_global_init(CURL_GLOBAL_ALL); + + cmStdString::size_type cc, kk; + for ( cc = 0; cc < files.size(); cc ++ ) + { + /* get a curl handle */ + curl = curl_easy_init(); + if(curl) + { + // Using proxy + if ( m_HTTPProxyType > 0 ) + { + curl_easy_setopt(curl, CURLOPT_PROXY, m_HTTPProxy.c_str()); + switch (m_HTTPProxyType) + { + case 2: + curl_easy_setopt(curl, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS4); + break; + case 3: + curl_easy_setopt(curl, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5); + break; + default: + curl_easy_setopt(curl, CURLOPT_PROXYTYPE, CURLPROXY_HTTP); + if (m_HTTPProxyAuth.size() > 0) + { + curl_easy_setopt(curl, CURLOPT_PROXYUSERPWD, + m_HTTPProxyAuth.c_str()); + } + } + } + + ::curl_easy_setopt(curl, CURLOPT_VERBOSE, 0); + if ( m_Verbose ) + { + ::curl_easy_setopt(curl, CURLOPT_VERBOSE, 1); + } + + // and give curl the buffer for errors + ::curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, &error_buffer); + + cmStdString file = remoteprefix + files[cc]; + cmStdString ofile = ""; + for ( kk = 0; kk < file.size(); kk ++ ) + { + char c = file[kk]; + char hex[4] = { 0, 0, 0, 0 }; + hex[0] = c; + switch ( c ) + { + case '+': + case '?': + case '/': + case '\\': + case '&': + case ' ': + case '=': + case '%': + sprintf(hex, "%%%02X", (int)c); + ofile.append(hex); + break; + default: + ofile.append(hex); + } + } + cmStdString turl + = url + ((url.find("?",0) == cmStdString::npos) ? "?" : "&") + + "xmlfile=" + ofile; + *m_LogFile << "Trigger url: " << turl.c_str() << std::endl; + if ( m_Verbose ) + { + std::cout << " Trigger url: " << turl.c_str() << std::endl; + } + curl_easy_setopt(curl, CURLOPT_URL, turl.c_str()); + if ( curl_easy_perform(curl) ) + { + std::cerr << " Error when triggering: " << turl.c_str() << std::endl; + *m_LogFile << "\tTrigerring failed with error: " << error_buffer << std::endl; + ::curl_easy_cleanup(curl); + ::curl_global_cleanup(); + return false; + } + // always cleanup + ::curl_easy_cleanup(curl); + std::cout << std::endl; + } + } + ::curl_global_cleanup(); + std::cout << " Dart server triggered..." << std::endl; + return true; +} + +//---------------------------------------------------------------------------- +bool cmCTestSubmitHandler::SubmitUsingSCP( + const cmStdString& scp_command, + const cmStdString& localprefix, + const std::vector& files, + const cmStdString& remoteprefix, + const cmStdString& url) +{ + if ( !scp_command.size() || !localprefix.size() || + !files.size() || !remoteprefix.size() || !url.size() ) + { + return 0; + } + std::vector 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(0); + + cmsysProcess* cp = cmsysProcess_New(); + cmsysProcess_SetOption(cp, cmsysProcess_Option_HideWindow, 1); + //cmsysProcess_SetTimeout(cp, timeout); + + int problems = 0; + + std::vector::const_iterator it; + for ( it = files.begin(); + it != files.end(); + it ++ ) + { + int retVal; + + std::string lfname = localprefix; + cmSystemTools::ConvertToUnixSlashes(lfname); + lfname += "/" + *it; + lfname = cmSystemTools::ConvertToOutputPath(lfname.c_str()); + argv[1] = lfname.c_str(); + std::string rfname = url + "/" + remoteprefix + *it; + argv[2] = rfname.c_str(); + if ( m_Verbose ) + { + std::cout << "Execute \"" << argv[0] << "\" \"" << argv[1] << "\" \"" + << argv[2] << "\"" << std::endl; + } + *m_LogFile << "Execute \"" << argv[0] << "\" \"" << argv[1] << "\" \"" + << argv[2] << "\"" << std::endl; + cmsysProcess_SetCommand(cp, &*argv.begin()); + cmsysProcess_Execute(cp); + char* data; + int length; + while(cmsysProcess_WaitForData(cp, &data, &length, 0)) + { + std::cout.write(data, length); + } + cmsysProcess_WaitForExit(cp, 0); + int result = cmsysProcess_GetState(cp); + + if(result == cmsysProcess_State_Exited) + { + retVal = cmsysProcess_GetExitValue(cp); + if ( retVal != 0 ) + { + if ( m_Verbose ) + { + std::cout << "\tSCP returned: " << retVal << std::endl; + } + *m_LogFile << "\tSCP returned: " << retVal << std::endl; + problems ++; + } + } + else if(result == cmsysProcess_State_Exception) + { + retVal = cmsysProcess_GetExitException(cp); + if ( m_Verbose ) + { + std::cerr << "\tThere was an exception: " << retVal << std::endl; + } + *m_LogFile << "\tThere was an exception: " << retVal << std::endl; + problems ++; + } + else if(result == cmsysProcess_State_Expired) + { + if ( m_Verbose ) + { + std::cerr << "\tThere was a timeout" << std::endl; + } + *m_LogFile << "\tThere was a timeout" << std::endl; + problems ++; + } + else if(result == cmsysProcess_State_Error) + { + if ( m_Verbose ) + { + std::cerr << "\tError executing SCP: " + << cmsysProcess_GetErrorString(cp) << std::endl; + } + *m_LogFile << "\tError executing SCP: " + << cmsysProcess_GetErrorString(cp) << std::endl; + problems ++; + } + } + cmsysProcess_Delete(cp); + if ( problems ) + { + return false; + } + return true; +} + +//---------------------------------------------------------------------------- +bool cmCTestSubmitHandler::SubmitUsingXMLRPC(const cmStdString& localprefix, + const std::vector& files, + const cmStdString& remoteprefix, + const cmStdString& url) +{ + xmlrpc_env env; + std::string ctestVersion = cmVersion::GetCMakeVersion(); + const char *state_name; + + /* Start up our XML-RPC client library. */ + xmlrpc_client_init(XMLRPC_CLIENT_NO_FLAGS, "CTest", ctestVersion.c_str()); + + /* Initialize our error-handling environment. */ + xmlrpc_env_init(&env); + + /* Call the famous server at UserLand. */ + std::cout << " Submitting to: " << url.c_str() << " (" << remoteprefix.c_str() << ")" << std::endl; + std::vector::const_iterator it; + for ( it = files.begin(); it != files.end(); ++it ) + { + xmlrpc_value *result; + + std::string local_file = localprefix + "/" + *it; + std::cout << " Submit file: " << local_file.c_str() << std::endl; + struct stat st; + if ( ::stat(local_file.c_str(), &st) ) + { + return false; + } + + size_t fileSize = st.st_size; + FILE* fp = fopen(local_file.c_str(), "r"); + if ( !fp ) + { + return false; + } + + unsigned char *fileBuffer = new unsigned char[fileSize]; + if ( fread(fileBuffer, 1, fileSize, fp) != fileSize ) + { + delete [] fileBuffer; + fclose(fp); + return false; + } + fclose(fp); + + std::string remoteCommand = remoteprefix + ".put"; + result = xmlrpc_client_call(&env, url.c_str(), + remoteCommand.c_str(), + "(6)", fileBuffer, (xmlrpc_int32)fileSize ); + + delete [] fileBuffer; + + if ( env.fault_occurred ) + { + std::cerr << " Submission problem: " << env.fault_string << " (" << env.fault_code << ")" << std::endl; + xmlrpc_env_clean(&env); + xmlrpc_client_cleanup(); + return false; + } + + + /* Get our state name and print it out. */ + xmlrpc_parse_value(&env, result, "s", &state_name); + if ( env.fault_occurred ) + { + std::cerr << " Submission problem: " << env.fault_string << " (" << env.fault_code << ")" << std::endl; + xmlrpc_DECREF(result); + xmlrpc_env_clean(&env); + xmlrpc_client_cleanup(); + return false; + } + + /* Dispose of our result value. */ + xmlrpc_DECREF(result); + } + + /* Clean up our error-handling environment. */ + xmlrpc_env_clean(&env); + + /* Shutdown our XML-RPC client library. */ + xmlrpc_client_cleanup(); + return true; +} + +//---------------------------------------------------------------------------- +int cmCTestSubmitHandler::ProcessHandler() +{ + const std::string &buildDirectory = m_CTest->GetDartConfiguration("BuildDirectory"); + if ( buildDirectory.size() == 0 ) + { + std::cerr << "Cannot find BuildDirectory key in the DartConfiguration.tcl" << std::endl; + return -1; + } + + cmGeneratedFileStream ofs; + m_CTest->OpenOutputFile("Temporary", "LastSubmit.log", ofs); + + cmCTest::tm_VectorOfStrings files; + std::string prefix = this->GetSubmitResultsPrefix(); + // TODO: + // Check if test is enabled + m_CTest->AddIfExists(files, "Update.xml"); + m_CTest->AddIfExists(files, "Configure.xml"); + m_CTest->AddIfExists(files, "Build.xml"); + m_CTest->AddIfExists(files, "Test.xml"); + if ( m_CTest->AddIfExists(files, "Coverage.xml") ) + { + cmCTest::tm_VectorOfStrings gfiles; + std::string gpath = buildDirectory + "/Testing/" + m_CTest->GetCurrentTag(); + std::string::size_type glen = gpath.size() + 1; + gpath = gpath + "/CoverageLog*"; + //std::cout << "Globbing for: " << gpath.c_str() << std::endl; + if ( cmSystemTools::SimpleGlob(gpath, gfiles, 1) ) + { + size_t cc; + for ( cc = 0; cc < gfiles.size(); cc ++ ) + { + gfiles[cc] = gfiles[cc].substr(glen); + //std::cout << "Glob file: " << gfiles[cc].c_str() << std::endl; + files.push_back(gfiles[cc]); + } + } + else + { + std::cerr << "Problem globbing" << std::endl; + } + } + m_CTest->AddIfExists(files, "DynamicAnalysis.xml"); + m_CTest->AddIfExists(files, "Purify.xml"); + m_CTest->AddIfExists(files, "Notes.xml"); + + if ( ofs ) + { + ofs << "Upload files:" << std::endl; + int cnt = 0; + cmCTest::tm_VectorOfStrings::iterator it; + for ( it = files.begin(); it != files.end(); ++ it ) + { + ofs << cnt << "\t" << it->c_str() << std::endl; + cnt ++; + } + } + std::cout << "Submit files (using " << m_CTest->GetDartConfiguration("DropMethod") << ")" + << std::endl; + this->SetLogFile(&ofs); + if ( m_CTest->GetDartConfiguration("DropMethod") == "" || + m_CTest->GetDartConfiguration("DropMethod") == "ftp" ) + { + ofs << "Using drop method: FTP" << std::endl; + std::cout << " Using FTP submit method" << std::endl; + std::string url = "ftp://"; + url += cmCTest::MakeURLSafe(m_CTest->GetDartConfiguration("DropSiteUser")) + ":" + + cmCTest::MakeURLSafe(m_CTest->GetDartConfiguration("DropSitePassword")) + "@" + + m_CTest->GetDartConfiguration("DropSite") + + cmCTest::MakeURLSafe(m_CTest->GetDartConfiguration("DropLocation")); + if ( !this->SubmitUsingFTP(buildDirectory+"/Testing/"+m_CTest->GetCurrentTag(), + files, prefix, url) ) + { + std::cerr << " Problems when submitting via FTP" << std::endl; + ofs << " Problems when submitting via FTP" << std::endl; + return -1; + } + if ( !this->TriggerUsingHTTP(files, prefix, m_CTest->GetDartConfiguration("TriggerSite")) ) + { + std::cerr << " Problems when triggering via HTTP" << std::endl; + ofs << " Problems when triggering via HTTP" << std::endl; + return -1; + } + std::cout << " Submission successful" << std::endl; + ofs << " Submission successful" << std::endl; + return 0; + } + else if ( m_CTest->GetDartConfiguration("DropMethod") == "http" ) + { + ofs << "Using drop method: HTTP" << std::endl; + std::cout << " Using HTTP submit method" << std::endl; + std::string url = "http://"; + if ( m_CTest->GetDartConfiguration("DropSiteUser").size() > 0 ) + { + url += m_CTest->GetDartConfiguration("DropSiteUser"); + if ( m_CTest->GetDartConfiguration("DropSitePassword").size() > 0 ) + { + url += ":" + m_CTest->GetDartConfiguration("DropSitePassword"); + } + url += "@"; + } + url += m_CTest->GetDartConfiguration("DropSite") + m_CTest->GetDartConfiguration("DropLocation"); + if ( !this->SubmitUsingHTTP(buildDirectory +"/Testing/"+m_CTest->GetCurrentTag(), files, prefix, url) ) + { + std::cerr << " Problems when submitting via HTTP" << std::endl; + ofs << " Problems when submitting via HTTP" << std::endl; + return -1; + } + if ( !this->TriggerUsingHTTP(files, prefix, m_CTest->GetDartConfiguration("TriggerSite")) ) + { + std::cerr << " Problems when triggering via HTTP" << std::endl; + ofs << " Problems when triggering via HTTP" << std::endl; + return -1; + } + std::cout << " Submission successful" << std::endl; + ofs << " Submission successful" << std::endl; + return 0; + } + else if ( m_CTest->GetDartConfiguration("DropMethod") == "xmlrpc" ) + { + ofs << "Using drop method: XML-RPC" << std::endl; + std::cout << " Using XML-RPC submit method" << std::endl; + std::string url = m_CTest->GetDartConfiguration("DropSite"); + prefix = m_CTest->GetDartConfiguration("DropLocation"); + if ( !this->SubmitUsingXMLRPC(buildDirectory+"/Testing/"+m_CTest->GetCurrentTag(), files, prefix, url) ) + { + std::cerr << " Problems when submitting via XML-RPC" << std::endl; + ofs << " Problems when submitting via XML-RPC" << std::endl; + return -1; + } + std::cout << " Submission successful" << std::endl; + ofs << " Submission successful" << std::endl; + return 0; + } + else if ( m_CTest->GetDartConfiguration("DropMethod") == "scp" ) + { + std::string url; + if ( m_CTest->GetDartConfiguration("DropSiteUser").size() > 0 ) + { + url += m_CTest->GetDartConfiguration("DropSiteUser") + "@"; + } + url += m_CTest->GetDartConfiguration("DropSite") + ":" + m_CTest->GetDartConfiguration("DropLocation"); + + if ( !this->SubmitUsingSCP(m_CTest->GetDartConfiguration("ScpCommand"), + buildDirectory+"/Testing/"+m_CTest->GetCurrentTag(), files, prefix, url) ) + { + std::cerr << " Problems when submitting via SCP" << std::endl; + ofs << " Problems when submitting via SCP" << std::endl; + return -1; + } + std::cout << " Submission successful" << std::endl; + ofs << " Submission successful" << std::endl; + } + std::cout << " Unknown submission method: \"" << m_CTest->GetDartConfiguration("DropMethod") << "\"" << std::endl; + return -1; +} + +//---------------------------------------------------------------------------- +std::string cmCTestSubmitHandler::GetSubmitResultsPrefix() +{ + std::string name = m_CTest->GetDartConfiguration("Site") + + "___" + m_CTest->GetDartConfiguration("BuildName") + + "___" + m_CTest->GetCurrentTag() + "-" + + m_CTest->GetTestModelString() + "___XML___"; + return name; +} + + diff --git a/Source/CTest/cmCTestSubmitHandler.h b/Source/CTest/cmCTestSubmitHandler.h new file mode 100644 index 0000000..45d8f30 --- /dev/null +++ b/Source/CTest/cmCTestSubmitHandler.h @@ -0,0 +1,79 @@ +/*========================================================================= + + Program: CMake - Cross-Platform Makefile Generator + Module: $RCSfile$ + Language: C++ + Date: $Date$ + Version: $Revision$ + + Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. + See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. + +=========================================================================*/ +#ifndef cmCTestSubmitHandler_h +#define cmCTestSubmitHandler_h + +#include "cmCTestGenericHandler.h" + +/** \class cmCTestSubmitHandler + * \brief Helper class for CTest + * + * Submit testing results + * + */ +class cmCTestSubmitHandler : public cmCTestGenericHandler +{ +public: + cmCTestSubmitHandler(); + ~cmCTestSubmitHandler() { m_LogFile = 0; } + + /* + * The main entry point for this class + */ + int ProcessHandler(); + + +private: + void SetLogFile(std::ostream* ost) { m_LogFile = ost; } + + /** + * Submit file using various ways + */ + bool SubmitUsingFTP(const cmStdString& localprefix, + const std::vector& files, + const cmStdString& remoteprefix, + const cmStdString& url); + bool SubmitUsingHTTP(const cmStdString& localprefix, + const std::vector& files, + const cmStdString& remoteprefix, + const cmStdString& url); + bool SubmitUsingSCP(const cmStdString& scp_command, + const cmStdString& localprefix, + const std::vector& files, + const cmStdString& remoteprefix, + const cmStdString& url); + + bool TriggerUsingHTTP(const std::vector& files, + const cmStdString& remoteprefix, + const cmStdString& url); + + bool SubmitUsingXMLRPC(const cmStdString& localprefix, + const std::vector& files, + const cmStdString& remoteprefix, + const cmStdString& url); + + std::string GetSubmitResultsPrefix(); + + cmStdString m_HTTPProxy; + int m_HTTPProxyType; + cmStdString m_HTTPProxyAuth; + cmStdString m_FTPProxy; + int m_FTPProxyType; + std::ostream* m_LogFile; +}; + +#endif diff --git a/Source/CTest/cmCTestTestCommand.cxx b/Source/CTest/cmCTestTestCommand.cxx new file mode 100644 index 0000000..7588135 --- /dev/null +++ b/Source/CTest/cmCTestTestCommand.cxx @@ -0,0 +1,52 @@ +/*========================================================================= + + Program: CMake - Cross-Platform Makefile Generator + Module: $RCSfile$ + Language: C++ + Date: $Date$ + Version: $Revision$ + + Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. + See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. + +=========================================================================*/ +#include "cmCTestTestCommand.h" + +#include "cmCTest.h" +#include "cmCTestGenericHandler.h" + +bool cmCTestTestCommand::InitialPass( + std::vector const& args) +{ + if (args.size() != 2) + { + this->SetError("called with incorrect number of arguments"); + return false; + } + + const char* build_dir = args[0].c_str(); + const char* res_var = args[1].c_str(); + + m_CTest->SetDartConfiguration("BuildDirectory", build_dir); + + cmCTestGenericHandler* handler = m_CTest->GetHandler("test"); + if ( !handler ) + { + this->SetError("internal CTest error. Cannot instantiate test handler"); + return false; + } + std::string current_dir = cmSystemTools::GetCurrentWorkingDirectory(); + cmSystemTools::ChangeDirectory(build_dir); + int res = handler->ProcessHandler(); + cmSystemTools::ChangeDirectory(current_dir.c_str()); + cmOStringStream str; + str << res; + m_Makefile->AddDefinition(res_var, str.str().c_str()); + return true; +} + + diff --git a/Source/CTest/cmCTestTestCommand.h b/Source/CTest/cmCTestTestCommand.h new file mode 100644 index 0000000..907cb54 --- /dev/null +++ b/Source/CTest/cmCTestTestCommand.h @@ -0,0 +1,79 @@ +/*========================================================================= + + Program: CMake - Cross-Platform Makefile Generator + Module: $RCSfile$ + Language: C++ + Date: $Date$ + Version: $Revision$ + + Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. + See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. + +=========================================================================*/ +#ifndef cmCTestTestCommand_h +#define cmCTestTestCommand_h + +#include "cmCTestCommand.h" + +/** \class cmCTestTest + * \brief Run a ctest script + * + * cmCTestTestCommand defineds the command to test the project. + */ +class cmCTestTestCommand : public cmCTestCommand +{ +public: + + cmCTestTestCommand() {} + + /** + * This is a virtual constructor for the command. + */ + virtual cmCommand* Clone() + { + cmCTestTestCommand* ni = new cmCTestTestCommand; + ni->m_CTest = this->m_CTest; + ni->m_CTestScriptHandler = this->m_CTestScriptHandler; + return ni; + } + + /** + * This is called when the command is first encountered in + * the CMakeLists.txt file. + */ + virtual bool InitialPass(std::vector const& args); + + /** + * The name of the command as specified in CMakeList.txt. + */ + virtual const char* GetName() { return "CTEST_TEST";} + + /** + * Succinct documentation. + */ + virtual const char* GetTerseDocumentation() + { + return "Tests the repository."; + } + + /** + * More documentation. + */ + virtual const char* GetFullDocumentation() + { + return + " CTEST_TEST(build_dir res)\n" + "Tests the given build directory and stores results in Test.xml. The " + "second argument is a variable that will hold value."; + } + + cmTypeMacro(cmCTestTestCommand, cmCTestCommand); + +}; + + +#endif diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index e75efd4..53ea159 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -33,8 +33,8 @@ #include "cmCTestScriptHandler.h" #include "cmCTestTestHandler.h" #include "cmCTestUpdateHandler.h" +#include "cmCTestSubmitHandler.h" -#include "cmCTestSubmit.h" #include "cmVersion.h" #include @@ -250,6 +250,7 @@ cmCTest::cmCTest() m_TestingHandlers["update"] = new cmCTestUpdateHandler; m_TestingHandlers["configure"] = new cmCTestConfigureHandler; m_TestingHandlers["memcheck"] = new cmCTestMemCheckHandler; + m_TestingHandlers["submit"] = new cmCTestSubmitHandler; cmCTest::t_TestingHandlers::iterator it; for ( it = m_TestingHandlers.begin(); it != m_TestingHandlers.end(); ++ it ) @@ -575,163 +576,6 @@ bool cmCTest::AddIfExists(tm_VectorOfStrings& files, const char* file) return true; } -int cmCTest::SubmitResults() -{ - cmGeneratedFileStream ofs; - this->OpenOutputFile("Temporary", "LastSubmit.log", ofs); - - cmCTest::tm_VectorOfStrings files; - std::string prefix = this->GetSubmitResultsPrefix(); - // TODO: - // Check if test is enabled - this->AddIfExists(files, "Update.xml"); - this->AddIfExists(files, "Configure.xml"); - this->AddIfExists(files, "Build.xml"); - this->AddIfExists(files, "Test.xml"); - if ( this->AddIfExists(files, "Coverage.xml") ) - { - cmCTest::tm_VectorOfStrings gfiles; - std::string gpath = m_BinaryDir + "/Testing/" + m_CurrentTag; - std::string::size_type glen = gpath.size() + 1; - gpath = gpath + "/CoverageLog*"; - //std::cout << "Globbing for: " << gpath.c_str() << std::endl; - if ( cmSystemTools::SimpleGlob(gpath, gfiles, 1) ) - { - size_t cc; - for ( cc = 0; cc < gfiles.size(); cc ++ ) - { - gfiles[cc] = gfiles[cc].substr(glen); - //std::cout << "Glob file: " << gfiles[cc].c_str() << std::endl; - files.push_back(gfiles[cc]); - } - } - else - { - std::cerr << "Problem globbing" << std::endl; - } - } - this->AddIfExists(files, "DynamicAnalysis.xml"); - this->AddIfExists(files, "Purify.xml"); - this->AddIfExists(files, "Notes.xml"); - - if ( ofs ) - { - ofs << "Upload files:" << std::endl; - int cnt = 0; - cmCTest::tm_VectorOfStrings::iterator it; - for ( it = files.begin(); it != files.end(); ++ it ) - { - ofs << cnt << "\t" << it->c_str() << std::endl; - cnt ++; - } - } - std::cout << "Submit files (using " << m_DartConfiguration["DropMethod"] << ")" - << std::endl; - cmCTestSubmit submit; - submit.SetVerbose(m_ExtraVerbose); - submit.SetLogFile(&ofs); - if ( m_DartConfiguration["DropMethod"] == "" || - m_DartConfiguration["DropMethod"] == "ftp" ) - { - ofs << "Using drop method: FTP" << std::endl; - std::cout << " Using FTP submit method" << std::endl; - std::string url = "ftp://"; - url += cmCTest::MakeURLSafe(m_DartConfiguration["DropSiteUser"]) + ":" + - cmCTest::MakeURLSafe(m_DartConfiguration["DropSitePassword"]) + "@" + - m_DartConfiguration["DropSite"] + - cmCTest::MakeURLSafe(m_DartConfiguration["DropLocation"]); - if ( !submit.SubmitUsingFTP(m_BinaryDir+"/Testing/"+m_CurrentTag, - files, prefix, url) ) - { - std::cerr << " Problems when submitting via FTP" << std::endl; - ofs << " Problems when submitting via FTP" << std::endl; - return 0; - } - if ( !submit.TriggerUsingHTTP(files, prefix, m_DartConfiguration["TriggerSite"]) ) - { - std::cerr << " Problems when triggering via HTTP" << std::endl; - ofs << " Problems when triggering via HTTP" << std::endl; - return 0; - } - std::cout << " Submission successful" << std::endl; - ofs << " Submission successful" << std::endl; - return 1; - } - else if ( m_DartConfiguration["DropMethod"] == "http" ) - { - ofs << "Using drop method: HTTP" << std::endl; - std::cout << " Using HTTP submit method" << std::endl; - std::string url = "http://"; - if ( m_DartConfiguration["DropSiteUser"].size() > 0 ) - { - url += m_DartConfiguration["DropSiteUser"]; - if ( m_DartConfiguration["DropSitePassword"].size() > 0 ) - { - url += ":" + m_DartConfiguration["DropSitePassword"]; - } - url += "@"; - } - url += m_DartConfiguration["DropSite"] + m_DartConfiguration["DropLocation"]; - if ( !submit.SubmitUsingHTTP(m_BinaryDir+"/Testing/"+m_CurrentTag, files, prefix, url) ) - { - std::cerr << " Problems when submitting via HTTP" << std::endl; - ofs << " Problems when submitting via HTTP" << std::endl; - return 0; - } - if ( !submit.TriggerUsingHTTP(files, prefix, m_DartConfiguration["TriggerSite"]) ) - { - std::cerr << " Problems when triggering via HTTP" << std::endl; - ofs << " Problems when triggering via HTTP" << std::endl; - return 0; - } - std::cout << " Submission successful" << std::endl; - ofs << " Submission successful" << std::endl; - return 1; - } - else if ( m_DartConfiguration["DropMethod"] == "xmlrpc" ) - { - ofs << "Using drop method: XML-RPC" << std::endl; - std::cout << " Using XML-RPC submit method" << std::endl; - std::string url = m_DartConfiguration["DropSite"]; - prefix = m_DartConfiguration["DropLocation"]; - if ( !submit.SubmitUsingXMLRPC(m_BinaryDir+"/Testing/"+m_CurrentTag, files, prefix, url) ) - { - std::cerr << " Problems when submitting via XML-RPC" << std::endl; - ofs << " Problems when submitting via XML-RPC" << std::endl; - return 0; - } - std::cout << " Submission successful" << std::endl; - ofs << " Submission successful" << std::endl; - return 1; - } - else if ( m_DartConfiguration["DropMethod"] == "scp" ) - { - std::string url; - if ( m_DartConfiguration["DropSiteUser"].size() > 0 ) - { - url += m_DartConfiguration["DropSiteUser"] + "@"; - } - url += m_DartConfiguration["DropSite"] + ":" + m_DartConfiguration["DropLocation"]; - - if ( !submit.SubmitUsingSCP(m_DartConfiguration["ScpCommand"], - m_BinaryDir+"/Testing/"+m_CurrentTag, files, prefix, url) ) - { - std::cerr << " Problems when submitting via SCP" << std::endl; - ofs << " Problems when submitting via SCP" << std::endl; - return 0; - } - std::cout << " Submission successful" << std::endl; - ofs << " Submission successful" << std::endl; - } - else - { - std::cout << " Unknown submission method: \"" << m_DartConfiguration["DropMethod"] << "\"" << std::endl; - return 0; - } - - return 0; -} - bool cmCTest::CTestFileExists(const std::string& filename) { std::string testingDir = m_BinaryDir + "/Testing/" + m_CurrentTag + "/" + @@ -739,15 +583,6 @@ bool cmCTest::CTestFileExists(const std::string& filename) return cmSystemTools::FileExists(testingDir.c_str()); } -std::string cmCTest::GetSubmitResultsPrefix() -{ - std::string name = m_DartConfiguration["Site"] + - "___" + m_DartConfiguration["BuildName"] + - "___" + m_CurrentTag + "-" + - this->GetTestModelString() + "___XML___"; - return name; -} - cmCTestGenericHandler* cmCTest::GetHandler(const char* handler) { cmCTest::t_TestingHandlers::iterator it = m_TestingHandlers.find(handler); @@ -872,7 +707,10 @@ int cmCTest::ProcessTests() if ( m_Tests[SUBMIT_TEST] || m_Tests[ALL_TEST] ) { this->UpdateCTestConfiguration(); - this->SubmitResults(); + if (this->GetHandler("submit")->ProcessHandler() < 0) + { + res |= cmCTest::SUBMIT_ERRORS; + } } return res; } diff --git a/Source/cmCTest.h b/Source/cmCTest.h index 7e832dc..25f8492 100644 --- a/Source/cmCTest.h +++ b/Source/cmCTest.h @@ -71,12 +71,6 @@ public: */ int TestDirectory(bool memcheck); - /** - * Do submit testing results - */ - int SubmitResults(); - std::string GetSubmitResultsPrefix(); - ///! what is the configuraiton type, e.g. Debug, Release etc. std::string GetConfigType(); @@ -166,12 +160,13 @@ public: // provide some more detailed info on the return code for ctest enum { - UPDATE_ERRORS = 0x01, + UPDATE_ERRORS = 0x01, CONFIGURE_ERRORS = 0x02, - BUILD_ERRORS = 0x04, - TEST_ERRORS = 0x08, - MEMORY_ERRORS = 0x10, - COVERAGE_ERRORS = 0x20 + BUILD_ERRORS = 0x04, + TEST_ERRORS = 0x08, + MEMORY_ERRORS = 0x10, + COVERAGE_ERRORS = 0x20, + SUBMIT_ERRORS = 0x40 }; ///! Are we producing XML @@ -198,6 +193,8 @@ public: */ bool SetDartConfigurationFromCMakeVariable(cmMakefile* mf, const char* dconfig, const char* cmake_var); + //! Make string safe to be send as an URL + static std::string MakeURLSafe(const std::string&); private: std::string m_ConfigType; bool m_Verbose; @@ -210,8 +207,6 @@ private: int GenerateNotesFile(const char* files); - static std::string MakeURLSafe(const std::string&); - // these are helper classes typedef std::map t_TestingHandlers; t_TestingHandlers m_TestingHandlers; -- cgit v0.12