diff options
author | Andy Cedilnik <andy.cedilnik@kitware.com> | 2005-01-27 15:15:01 (GMT) |
---|---|---|
committer | Andy Cedilnik <andy.cedilnik@kitware.com> | 2005-01-27 15:15:01 (GMT) |
commit | 62b310bc52b9feefab32992f7bcebaecbf3aa857 (patch) | |
tree | f1070331289cf33a4e15edcf4f616005f6b3ff8b /Source/CTest | |
parent | 14477cee6e8a380e74f4cbf70afe5f3c3bfbd8a2 (diff) | |
download | CMake-62b310bc52b9feefab32992f7bcebaecbf3aa857.zip CMake-62b310bc52b9feefab32992f7bcebaecbf3aa857.tar.gz CMake-62b310bc52b9feefab32992f7bcebaecbf3aa857.tar.bz2 |
ENH: Add compression support to XML files
Diffstat (limited to 'Source/CTest')
-rw-r--r-- | Source/CTest/cmCTestBuildHandler.cxx | 13 | ||||
-rw-r--r-- | Source/CTest/cmCTestConfigureHandler.cxx | 7 | ||||
-rw-r--r-- | Source/CTest/cmCTestCoverageHandler.cxx | 13 | ||||
-rw-r--r-- | Source/CTest/cmCTestCoverageHandler.h | 5 | ||||
-rw-r--r-- | Source/CTest/cmCTestTestHandler.cxx | 13 | ||||
-rw-r--r-- | Source/CTest/cmCTestUpdateHandler.cxx | 7 |
6 files changed, 31 insertions, 27 deletions
diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx index b4d96ed..1c40b23 100644 --- a/Source/CTest/cmCTestBuildHandler.cxx +++ b/Source/CTest/cmCTestBuildHandler.cxx @@ -22,6 +22,7 @@ #include "cmMakefile.h" #include "cmLocalGenerator.h" #include "cmGlobalGenerator.h" +#include "cmGeneratedFileStream.h" //#include <cmsys/RegularExpression.hxx> #include <cmsys/Process.h> @@ -211,12 +212,13 @@ int cmCTestBuildHandler::BuildDirectory(cmCTest *ctest_inst) return 1; } - std::ofstream ofs; + cmGeneratedFileStream ofs; double elapsed_time_start = cmSystemTools::GetTime(); if ( !m_CTest->OpenOutputFile("Temporary", "LastBuild.log", ofs) ) { std::cerr << "Cannot create LastBuild.log file" << std::endl; } + m_StartBuild = m_CTest->CurrentTime(); std::string output; int retVal = 0; @@ -237,10 +239,6 @@ int cmCTestBuildHandler::BuildDirectory(cmCTest *ctest_inst) { std::cerr << "Error(s) when building project" << std::endl; } - if ( ofs ) - { - ofs.close(); - } std::vector<cmStdString>::size_type cc; if ( m_CTest->GetDartConfiguration("SourceDirectory").size() > 20 || @@ -440,12 +438,13 @@ int cmCTestBuildHandler::BuildDirectory(cmCTest *ctest_inst) std::cout << " " << errors << " Compiler errors" << std::endl; std::cout << " " << warnings << " Compiler warnings" << std::endl; - if( !m_CTest->OpenOutputFile(m_CTest->GetCurrentTag(), "Build.xml", ofs) ) + cmGeneratedFileStream xofs; + if( !m_CTest->OpenOutputFile(m_CTest->GetCurrentTag(), "Build.xml", xofs, true) ) { std::cerr << "Cannot create build XML file" << std::endl; return 1; } - this->GenerateDartBuildOutput(ofs, errorsWarnings, elapsed_build_time); + this->GenerateDartBuildOutput(xofs, errorsWarnings, elapsed_build_time); return 0; } diff --git a/Source/CTest/cmCTestConfigureHandler.cxx b/Source/CTest/cmCTestConfigureHandler.cxx index 65950a7..fbf88b4 100644 --- a/Source/CTest/cmCTestConfigureHandler.cxx +++ b/Source/CTest/cmCTestConfigureHandler.cxx @@ -18,6 +18,7 @@ #include "cmCTestConfigureHandler.h" #include "cmCTest.h" +#include "cmGeneratedFileStream.h" #include "cmake.h" #include <cmsys/Process.h> @@ -59,15 +60,15 @@ int cmCTestConfigureHandler::ConfigureDirectory(cmCTest *ctest_inst) int res = 0; if ( !m_CTest->GetShowOnly() ) { - std::ofstream os; - if ( !m_CTest->OpenOutputFile(m_CTest->GetCurrentTag(), "Configure.xml", os) ) + cmGeneratedFileStream os; + if ( !m_CTest->OpenOutputFile(m_CTest->GetCurrentTag(), "Configure.xml", os, true) ) { std::cerr << "Cannot open configure file" << std::endl; return 1; } std::string start_time = m_CTest->CurrentTime(); - std::ofstream ofs; + cmGeneratedFileStream ofs; m_CTest->OpenOutputFile("Temporary", "LastConfigure.log", ofs); res = m_CTest->RunMakeCommand(cCommand.c_str(), &output, &retVal, buildDirectory.c_str(), diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx index 204d684..8883b39 100644 --- a/Source/CTest/cmCTestCoverageHandler.cxx +++ b/Source/CTest/cmCTestCoverageHandler.cxx @@ -20,6 +20,7 @@ #include "cmCTest.h" #include "cmake.h" #include "cmSystemTools.h" +#include "cmGeneratedFileStream.h" #include "cmGlob.h" #include <cmsys/Process.h> #include <cmsys/RegularExpression.hxx> @@ -38,13 +39,13 @@ cmCTestCoverageHandler::cmCTestCoverageHandler() } //---------------------------------------------------------------------- -bool cmCTestCoverageHandler::StartLogFile(std::ofstream& covLogFile, int logFileCount) +bool cmCTestCoverageHandler::StartLogFile(cmGeneratedFileStream& covLogFile, int logFileCount) { char covLogFilename[1024]; sprintf(covLogFilename, "CoverageLog-%d.xml", logFileCount); std::cout << "Open file: " << covLogFilename << std::endl; if (!m_CTest->OpenOutputFile(m_CTest->GetCurrentTag(), - covLogFilename, covLogFile)) + covLogFilename, covLogFile, true)) { std::cerr << "Cannot open log file: " << covLogFilename << std::endl; return false; @@ -57,7 +58,7 @@ bool cmCTestCoverageHandler::StartLogFile(std::ofstream& covLogFile, int logFile } //---------------------------------------------------------------------- -void cmCTestCoverageHandler::EndLogFile(std::ofstream& ostr, int logFileCount) +void cmCTestCoverageHandler::EndLogFile(cmGeneratedFileStream& ostr, int logFileCount) { std::string local_end_time = m_CTest->CurrentTime(); ostr << "\t<EndDateTime>" << local_end_time << "</EndDateTime>" << std::endl @@ -324,11 +325,11 @@ int cmCTestCoverageHandler::CoverageDirectory(cmCTest *ctest_inst) } } - std::ofstream covSumFile; - std::ofstream covLogFile; + cmGeneratedFileStream covSumFile; + cmGeneratedFileStream covLogFile; if (!m_CTest->OpenOutputFile(m_CTest->GetCurrentTag(), - "Coverage.xml", covSumFile)) + "Coverage.xml", covSumFile, true)) { std::cerr << "Cannot open coverage summary file: Coverage.xml" << std::endl; return 1; diff --git a/Source/CTest/cmCTestCoverageHandler.h b/Source/CTest/cmCTestCoverageHandler.h index caf8589..c6a80a6 100644 --- a/Source/CTest/cmCTestCoverageHandler.h +++ b/Source/CTest/cmCTestCoverageHandler.h @@ -23,6 +23,7 @@ #include "cmListFileCache.h" class cmCTest; +class cmGeneratedFileStream; /** \class cmCTestCoverageHandler * \brief A class that handles coverage computaiton for ctest @@ -49,8 +50,8 @@ private: cmCTest *m_CTest; bool ShouldIDoCoverage(const char* file, const char* srcDir, const char* binDir, bool verbose); - bool StartLogFile(std::ofstream& ostr, int logFileCount); - void EndLogFile(std::ofstream& ostr, int logFileCount); + bool StartLogFile(cmGeneratedFileStream& ostr, int logFileCount); + void EndLogFile(cmGeneratedFileStream& ostr, int logFileCount); struct cmCTestCoverage { diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index 60e6b94..9e8945b 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -19,6 +19,7 @@ #include "cmCTest.h" #include "cmake.h" +#include "cmGeneratedFileStream.h" #include <cmsys/Process.h> #include <cmsys/RegularExpression.hxx> #include <cmsys/Base64.h> @@ -302,7 +303,7 @@ int cmCTestTestHandler::TestDirectory(cmCTest *ctest_inst, bool memcheck) if (failed.size()) { - std::ofstream ofs; + cmGeneratedFileStream ofs; std::cerr << "\nThe following tests FAILED:\n"; m_CTest->OpenOutputFile("Temporary", "LastTestsFailed.log", ofs); @@ -324,9 +325,9 @@ int cmCTestTestHandler::TestDirectory(cmCTest *ctest_inst, bool memcheck) if ( m_CTest->GetProduceXML() ) { - std::ofstream xmlfile; + cmGeneratedFileStream xmlfile; if( !m_CTest->OpenOutputFile(m_CTest->GetCurrentTag(), - (memcheck ? "DynamicAnalysis.xml" : "Test.xml"), xmlfile) ) + (memcheck ? "DynamicAnalysis.xml" : "Test.xml"), xmlfile, true) ) { std::cerr << "Cannot create " << (memcheck ? "memory check" : "testing") << " XML file" << std::endl; @@ -372,8 +373,8 @@ void cmCTestTestHandler::ProcessDirectory(std::vector<cmStdString> &passed, this->GetListOfTests(&testlist, memcheck); tm_ListOfTests::size_type tmsize = testlist.size(); - std::ofstream ofs; - std::ofstream *olog = 0; + cmGeneratedFileStream ofs; + cmGeneratedFileStream *olog = 0; if ( !m_CTest->GetShowOnly() && tmsize > 0 && m_CTest->OpenOutputFile("Temporary", (memcheck?"LastMemCheck.log":"LastTest.log"), ofs) ) @@ -1670,7 +1671,7 @@ bool cmCTestTestHandler::CleanTestOutput(std::string& output, size_t remove_thre } cmOStringStream ostr; std::string::size_type cc; - std::string::size_type skipsize; + std::string::size_type skipsize = 0; int inTag = 0; int skipped = 0; for ( cc = 0; cc < output.size(); cc ++ ) diff --git a/Source/CTest/cmCTestUpdateHandler.cxx b/Source/CTest/cmCTestUpdateHandler.cxx index c3eff5d..cbdb3ad 100644 --- a/Source/CTest/cmCTestUpdateHandler.cxx +++ b/Source/CTest/cmCTestUpdateHandler.cxx @@ -23,6 +23,7 @@ #include "cmLocalGenerator.h" #include "cmGlobalGenerator.h" #include "cmVersion.h" +#include "cmGeneratedFileStream.h" //#include <cmsys/RegularExpression.hxx> #include <cmsys/Process.h> @@ -95,8 +96,8 @@ int cmCTestUpdateHandler::UpdateDirectory(cmCTest *ctest_inst) std::string command = cvsCommand + " -z3 update " + cvsOptions + " " + extra_update_opts; - std::ofstream os; - if ( !m_CTest->OpenOutputFile(m_CTest->GetCurrentTag(), "Update.xml", os) ) + cmGeneratedFileStream os; + if ( !m_CTest->OpenOutputFile(m_CTest->GetCurrentTag(), "Update.xml", os, true) ) { std::cerr << "Cannot open log file" << std::endl; } @@ -106,7 +107,7 @@ int cmCTestUpdateHandler::UpdateDirectory(cmCTest *ctest_inst) std::string goutput; int retVal = 0; bool res = true; - std::ofstream ofs; + cmGeneratedFileStream ofs; if ( !m_CTest->GetShowOnly() ) { res = cmSystemTools::RunSingleCommand(command.c_str(), &goutput, |