summaryrefslogtreecommitdiffstats
path: root/Source/CTest/cmCTestTestHandler.cxx
diff options
context:
space:
mode:
authorZach Mullen <zach.mullen@kitware.com>2011-02-18 17:11:51 (GMT)
committerBrad King <brad.king@kitware.com>2011-03-15 19:07:37 (GMT)
commit350546db3aa956e34487bd38dd048fe9a0689e4a (patch)
tree3f0bda38ef56ddba39d93cb172e5cec8e6fb3fe7 /Source/CTest/cmCTestTestHandler.cxx
parent0554e5e50f6eb3117b4e207f4b01876dbe5a75a4 (diff)
downloadCMake-350546db3aa956e34487bd38dd048fe9a0689e4a.zip
CMake-350546db3aa956e34487bd38dd048fe9a0689e4a.tar.gz
CMake-350546db3aa956e34487bd38dd048fe9a0689e4a.tar.bz2
Implement ctest_upload command
Diffstat (limited to 'Source/CTest/cmCTestTestHandler.cxx')
-rw-r--r--Source/CTest/cmCTestTestHandler.cxx44
1 files changed, 1 insertions, 43 deletions
diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx
index f87c929..bad26c5 100644
--- a/Source/CTest/cmCTestTestHandler.cxx
+++ b/Source/CTest/cmCTestTestHandler.cxx
@@ -1282,7 +1282,7 @@ void cmCTestTestHandler::AttachFiles(std::ostream& os,
result->Properties->AttachedFiles.begin();
file != result->Properties->AttachedFiles.end(); ++file)
{
- std::string base64 = this->EncodeFile(*file);
+ std::string base64 = this->CTest->Base64GzipEncodeFile(*file);
std::string fname = cmSystemTools::GetFilenameName(*file);
os << "\t\t<NamedMeasurement name=\"Attached File\" encoding=\"base64\" "
"compression=\"tar/gzip\" filename=\"" << fname << "\" type=\"file\">"
@@ -1293,48 +1293,6 @@ void cmCTestTestHandler::AttachFiles(std::ostream& os,
}
//----------------------------------------------------------------------
-std::string cmCTestTestHandler::EncodeFile(std::string file)
-{
- std::string tarFile = file + "_temp.tar.gz";
- std::vector<cmStdString> files;
- files.push_back(file);
-
- if(!cmSystemTools::CreateTar(tarFile.c_str(), files, true, false, false))
- {
- cmCTestLog(this->CTest, ERROR_MESSAGE, "Error creating tar while "
- "attaching file: " << file << std::endl);
- return "";
- }
- long len = cmSystemTools::FileLength(tarFile.c_str());
- std::ifstream ifs(tarFile.c_str(), std::ios::in
-#ifdef _WIN32
- | std::ios::binary
-#endif
- );
- unsigned char *file_buffer = new unsigned char [ len + 1 ];
- ifs.read(reinterpret_cast<char*>(file_buffer), len);
- ifs.close();
- cmSystemTools::RemoveFile(tarFile.c_str());
-
- unsigned char *encoded_buffer
- = new unsigned char [ static_cast<int>(
- static_cast<double>(len) * 1.5 + 5.0) ];
-
- unsigned long rlen
- = cmsysBase64_Encode(file_buffer, len, encoded_buffer, 1);
-
- std::string base64 = "";
- for(unsigned long i = 0; i < rlen; i++)
- {
- base64 += encoded_buffer[i];
- }
- delete [] file_buffer;
- delete [] encoded_buffer;
-
- return base64;
-}
-
-//----------------------------------------------------------------------
int cmCTestTestHandler::ExecuteCommands(std::vector<cmStdString>& vec)
{
std::vector<cmStdString>::iterator it;