diff options
-rw-r--r-- | Modules/FindHDF5.cmake | 140 | ||||
-rw-r--r-- | Modules/FindProtobuf.cmake | 104 | ||||
-rw-r--r-- | Source/CTest/cmCTestMemCheckHandler.cxx | 14 | ||||
-rw-r--r-- | Source/CTest/cmCTestRunTest.cxx | 18 | ||||
-rw-r--r-- | Source/cmCTest.cxx | 80 | ||||
-rw-r--r-- | Source/cmCTest.h | 7 | ||||
-rw-r--r-- | Source/cmSystemTools.cxx | 2 | ||||
-rw-r--r-- | Source/kwsys/kwsysDateStamp.cmake | 4 |
8 files changed, 286 insertions, 83 deletions
diff --git a/Modules/FindHDF5.cmake b/Modules/FindHDF5.cmake index 90849a1..6f01ea0 100644 --- a/Modules/FindHDF5.cmake +++ b/Modules/FindHDF5.cmake @@ -9,10 +9,9 @@ # The module will optionally accept the COMPONENTS argument. If no COMPONENTS # are specified, then the find module will default to finding only the HDF5 C # library. If one or more COMPONENTS are specified, the module will attempt to -# find the language bindings for the specified components. Currently, the only -# valid components are C and CXX. The module does not yet support finding the -# Fortran bindings. If the COMPONENTS argument is not given, the module will -# attempt to find only the C bindings. +# find the language bindings for the specified components. The only valid +# components are C, CXX, Fortran, and HL. If the COMPONENTS argument is not +# given, the module will attempt to find only the C bindings. # # On UNIX systems, this module will read the variable HDF5_USE_STATIC_LIBRARIES # to determine whether or not to prefer a static link to a dynamic link for HDF5 @@ -33,12 +32,15 @@ # HDF5_DEFINITIONS - Required compiler definitions for HDF5 # HDF5_C_LIBRARIES - Required libraries for the HDF5 C bindings. # HDF5_CXX_LIBRARIES - Required libraries for the HDF5 C++ bindings +# HDF5_Fortran_LIBRARIES - Required libraries for the HDF5 Fortran bindings +# HDF5_HL_LIBRARIES - Required libraries for the HDF5 high level API # HDF5_LIBRARIES - Required libraries for all requested bindings # HDF5_FOUND - true if HDF5 was found on the system # HDF5_LIBRARY_DIRS - the full set of library directories # HDF5_IS_PARALLEL - Whether or not HDF5 was found with parallel IO support # HDF5_C_COMPILER_EXECUTABLE - the path to the HDF5 C wrapper compiler # HDF5_CXX_COMPILER_EXECUTABLE - the path to the HDF5 C++ wrapper compiler +# HDF5_Fortran_COMPILER_EXECUTABLE - the path to the HDF5 Fortran wrapper compiler # HDF5_DIFF_EXECUTABLE - the path to the HDF5 dataset comparison tool #============================================================================= @@ -63,8 +65,26 @@ include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) set( HDF5_VALID_COMPONENTS C CXX + Fortran + HL ) +# Validate the list of find components. +if( NOT HDF5_FIND_COMPONENTS ) + set( HDF5_LANGUAGE_BINDINGS "C" ) +else() + # add the extra specified components, ensuring that they are valid. + foreach( component ${HDF5_FIND_COMPONENTS} ) + list( FIND HDF5_VALID_COMPONENTS ${component} component_location ) + if( ${component_location} EQUAL -1 ) + message( FATAL_ERROR + "\"${component}\" is not a valid HDF5 component." ) + else() + list( APPEND HDF5_LANGUAGE_BINDINGS ${component} ) + endif() + endforeach() +endif() + # try to find the HDF5 wrapper compilers find_program( HDF5_C_COMPILER_EXECUTABLE NAMES h5cc h5pcc @@ -80,6 +100,13 @@ find_program( HDF5_CXX_COMPILER_EXECUTABLE DOC "HDF5 C++ Wrapper compiler. Used only to detect HDF5 compile flags." ) mark_as_advanced( HDF5_CXX_COMPILER_EXECUTABLE ) +find_program( HDF5_Fortran_COMPILER_EXECUTABLE + NAMES h5fc h5pfc + HINTS ENV HDF5_ROOT + PATH_SUFFIXES bin Bin + DOC "HDF5 Fortran Wrapper compiler. Used only to detect HDF5 compile flags." ) +mark_as_advanced( HDF5_Fortran_COMPILER_EXECUTABLE ) + find_program( HDF5_DIFF_EXECUTABLE NAMES h5diff HINTS ENV HDF5_ROOT @@ -152,31 +179,39 @@ macro( _HDF5_parse_compile_line endforeach() endmacro() -if( HDF5_INCLUDE_DIRS AND HDF5_LIBRARIES ) - # Do nothing: we already have HDF5_INCLUDE_PATH and HDF5_LIBRARIES in the - # cache, it would be a shame to override them -else() - _HDF5_invoke_compiler( C HDF5_C_COMPILE_LINE HDF5_C_RETURN_VALUE ) - _HDF5_invoke_compiler( CXX HDF5_CXX_COMPILE_LINE HDF5_CXX_RETURN_VALUE ) - - if( NOT HDF5_FIND_COMPONENTS ) - set( HDF5_LANGUAGE_BINDINGS "C" ) - else() - # add the extra specified components, ensuring that they are valid. - foreach( component ${HDF5_FIND_COMPONENTS} ) - list( FIND HDF5_VALID_COMPONENTS ${component} component_location ) - if( ${component_location} EQUAL -1 ) - message( FATAL_ERROR - "\"${component}\" is not a valid HDF5 component." ) - else() - list( APPEND HDF5_LANGUAGE_BINDINGS ${component} ) +# Try to find HDF5 using an installed hdf5-config.cmake +if( NOT HDF5_FOUND ) + find_package( HDF5 QUIET NO_MODULE ) + if( HDF5_FOUND ) + set( HDF5_INCLUDE_DIRS ${HDF5_INCLUDE_DIR} ) + set( HDF5_LIBRARIES ) + set( HDF5_C_TARGET hdf5 ) + set( HDF5_CXX_TARGET hdf5_cpp ) + set( HDF5_HL_TARGET hdf5_hl ) + set( HDF5_Fortran_TARGET hdf5_fortran ) + foreach( _component ${HDF5_LANGUAGE_BINDINGS} ) + list( FIND HDF5_VALID_COMPONENTS ${_component} _component_location ) + get_target_property( _comp_location ${HDF5_${_component}_TARGET} LOCATION ) + if( _comp_location ) + set( HDF5_${_component}_LIBRARY ${_comp_location} CACHE PATH + "HDF5 ${_component} library" ) + mark_as_advanced( HDF5_${_component}_LIBRARY ) + list( APPEND HDF5_LIBRARIES ${HDF5_${_component}_LIBRARY} ) endif() endforeach() endif() - +endif() + +if( NOT HDF5_FOUND ) + _HDF5_invoke_compiler( C HDF5_C_COMPILE_LINE HDF5_C_RETURN_VALUE ) + _HDF5_invoke_compiler( CXX HDF5_CXX_COMPILE_LINE HDF5_CXX_RETURN_VALUE ) + _HDF5_invoke_compiler( Fortran HDF5_Fortran_COMPILE_LINE HDF5_Fortran_RETURN_VALUE ) + # seed the initial lists of libraries to find with items we know we need - set( HDF5_C_LIBRARY_NAMES_INIT hdf5_hl hdf5 ) + set( HDF5_C_LIBRARY_NAMES_INIT hdf5 ) + set( HDF5_HL_LIBRARY_NAMES_INIT hdf5_hl ${HDF5_C_LIBRARY_NAMES_INIT} ) set( HDF5_CXX_LIBRARY_NAMES_INIT hdf5_cpp ${HDF5_C_LIBRARY_NAMES_INIT} ) + set( HDF5_Fortran_LIBRARY_NAMES_INIT hdf5_fortran ${HDF5_C_LIBRARY_NAMES_INIT} ) foreach( LANGUAGE ${HDF5_LANGUAGE_BINDINGS} ) if( HDF5_${LANGUAGE}_COMPILE_LINE ) @@ -198,7 +233,13 @@ else() list( APPEND HDF5_DEFINITIONS ${HDF5_${LANGUAGE}_DEFINITIONS} ) # find the HDF5 include directories - find_path( HDF5_${LANGUAGE}_INCLUDE_DIR hdf5.h + if(${LANGUAGE} STREQUAL "Fortran") + set(HDF5_INCLUDE_FILENAME hdf5.mod) + else() + set(HDF5_INCLUDE_FILENAME hdf5.h) + endif() + + find_path( HDF5_${LANGUAGE}_INCLUDE_DIR ${HDF5_INCLUDE_FILENAME} HINTS ${HDF5_${LANGUAGE}_INCLUDE_FLAGS} ENV @@ -266,26 +307,41 @@ else() # We may have picked up some duplicates in various lists during the above # process for the language bindings (both the C and C++ bindings depend on - # libz for example). Remove the duplicates. + # libz for example). Remove the duplicates. It appears that the default + # CMake behavior is to remove duplicates from the end of a list. However, + # for link lines, this is incorrect since unresolved symbols are searched + # for down the link line. Therefore, we reverse the list, remove the + # duplicates, and then reverse it again to get the duplicates removed from + # the beginning. + macro( _remove_duplicates_from_beginning _list_name ) + list( REVERSE ${_list_name} ) + list( REMOVE_DUPLICATES ${_list_name} ) + list( REVERSE ${_list_name} ) + endmacro() + if( HDF5_INCLUDE_DIRS ) - list( REMOVE_DUPLICATES HDF5_INCLUDE_DIRS ) + _remove_duplicates_from_beginning( HDF5_INCLUDE_DIRS ) endif() if( HDF5_LIBRARIES_DEBUG ) - list( REMOVE_DUPLICATES HDF5_LIBRARIES_DEBUG ) + _remove_duplicates_from_beginning( HDF5_LIBRARIES_DEBUG ) endif() if( HDF5_LIBRARIES_RELEASE ) - list( REMOVE_DUPLICATES HDF5_LIBRARIES_RELEASE ) + _remove_duplicates_from_beginning( HDF5_LIBRARIES_RELEASE ) endif() if( HDF5_LIBRARY_DIRS ) - list( REMOVE_DUPLICATES HDF5_LIBRARY_DIRS ) + _remove_duplicates_from_beginning( HDF5_LIBRARY_DIRS ) endif() # Construct the complete list of HDF5 libraries with debug and optimized # variants when the generator supports them. if( CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE ) - set( HDF5_LIBRARIES - debug ${HDF5_LIBRARIES_DEBUG} - optimized ${HDF5_LIBRARIES_RELEASE} ) + set( HDF5_LIBRARIES ) + foreach( _lib ${HDF5_LIBRARIES_DEBUG} ) + list( APPEND HDF5_LIBRARIES debug ${_lib} ) + endforeach() + foreach( _lib ${HDF5_LIBRARIES_RELEASE} ) + list( APPEND HDF5_LIBRARIES optimized ${_lib} ) + endforeach() else() set( HDF5_LIBRARIES ${HDF5_LIBRARIES_RELEASE} ) endif() @@ -307,6 +363,12 @@ else() "HDF5 library compiled with parallel IO support" ) mark_as_advanced( HDF5_IS_PARALLEL ) + # For backwards compatibility we set HDF5_INCLUDE_DIR to the value of + # HDF5_INCLUDE_DIRS + if( HDF5_INCLUDE_DIRS ) + set( HDF5_INCLUDE_DIR "${HDF5_INCLUDE_DIRS}" ) + endif() + endif() find_package_handle_standard_args( HDF5 DEFAULT_MSG @@ -314,15 +376,3 @@ find_package_handle_standard_args( HDF5 DEFAULT_MSG HDF5_INCLUDE_DIRS ) -mark_as_advanced( - HDF5_INCLUDE_DIRS - HDF5_LIBRARIES - HDF5_DEFINTIONS - HDF5_LIBRARY_DIRS - HDF5_C_COMPILER_EXECUTABLE - HDF5_CXX_COMPILER_EXECUTABLE ) - -# For backwards compatibility we set HDF5_INCLUDE_DIR to the value of -# HDF5_INCLUDE_DIRS -set( HDF5_INCLUDE_DIR "${HDF5_INCLUDE_DIRS}" ) - diff --git a/Modules/FindProtobuf.cmake b/Modules/FindProtobuf.cmake index a6e6653..88ef7cd 100644 --- a/Modules/FindProtobuf.cmake +++ b/Modules/FindProtobuf.cmake @@ -1,15 +1,31 @@ # Locate and configure the Google Protocol Buffers library. +# +# The following variables can be set and are optional: +# +# PROTOBUF_SRC_ROOT_FOLDER - When compiling with MSVC, if this cache variable is set +# the protobuf-default VS project build locations +# (vsprojects/Debug & vsprojects/Release) will be searched +# for libraries and binaries. +# # Defines the following variables: # -# PROTOBUF_FOUND - Found the Google Protocol Buffers library +# PROTOBUF_FOUND - Found the Google Protocol Buffers library (libprotobuf & header files) # PROTOBUF_INCLUDE_DIRS - Include directories for Google Protocol Buffers -# PROTOBUF_LIBRARIES - The protobuf library +# PROTOBUF_LIBRARIES - The protobuf libraries +# [New in CMake 2.8.5] +# PROTOBUF_PROTOC_LIBRARIES - The protoc libraries +# PROTOBUF_LITE_LIBRARIES - The protobuf-lite libraries # -# The following cache variables are also defined: +# The following cache variables are also available to set or use: # PROTOBUF_LIBRARY - The protobuf library # PROTOBUF_PROTOC_LIBRARY - The protoc library # PROTOBUF_INCLUDE_DIR - The include directory for protocol buffers # PROTOBUF_PROTOC_EXECUTABLE - The protoc compiler +# [New in CMake 2.8.5] +# PROTOBUF_LIBRARY_DEBUG - The protobuf library (debug) +# PROTOBUF_PROTOC_LIBRARY_DEBUG - The protoc library (debug) +# PROTOBUF_LITE_LIBRARY - The protobuf lite library +# PROTOBUF_LITE_LIBRARY_DEBUG - The protobuf lite library (debug) # # ==================================================================== # Example: @@ -20,7 +36,7 @@ # include_directories(${CMAKE_CURRENT_BINARY_DIR}) # PROTOBUF_GENERATE_CPP(PROTO_SRCS PROTO_HDRS foo.proto) # add_executable(bar bar.cc ${PROTO_SRCS} ${PROTO_HDRS}) -# target_link_libraries(bar ${PROTOBUF_LIBRARY}) +# target_link_libraries(bar ${PROTOBUF_LIBRARIES}) # # NOTE: You may need to link against pthreads, depending # on the platform. @@ -38,7 +54,7 @@ #============================================================================= # Copyright 2009 Kitware, Inc. -# Copyright 2009 Philip Lowman <philip@yhbt.com> +# Copyright 2009-2011 Philip Lowman <philip@yhbt.com> # Copyright 2008 Esben Mose Hansen, Ange Optimization ApS # # Distributed under the OSI-approved BSD License (the "License"); @@ -81,41 +97,85 @@ function(PROTOBUF_GENERATE_CPP SRCS HDRS) set(${HDRS} ${${HDRS}} PARENT_SCOPE) endfunction() +# Internal function: search for normal library as well as a debug one +# if the debug one is specified also include debug/optimized keywords +# in *_LIBRARIES variable +function(_protobuf_find_libraries name filename) + find_library(${name}_LIBRARY + NAMES ${filename} + PATHS ${PROTOBUF_SRC_ROOT_FOLDER}/vsprojects/Release) + mark_as_advanced(${name}_LIBRARY) + + find_library(${name}_LIBRARY_DEBUG + NAMES ${filename} + PATHS ${PROTOBUF_SRC_ROOT_FOLDER}/vsprojects/Debug) + mark_as_advanced(${name}_LIBRARY_DEBUG) + + if(NOT ${name}_LIBRARY_DEBUG) + # There is no debug library + set(${name}_LIBRARY_DEBUG ${${name}_LIBRARY} PARENT_SCOPE) + set(${name}_LIBRARIES ${${name}_LIBRARY} PARENT_SCOPE) + else() + # There IS a debug library + set(${name}_LIBRARIES + optimized ${${name}_LIBRARY} + debug ${${name}_LIBRARY_DEBUG} + PARENT_SCOPE + ) + endif() +endfunction() + -find_path(PROTOBUF_INCLUDE_DIR google/protobuf/service.h) +# +# Main. +# # Google's provided vcproj files generate libraries with a "lib" # prefix on Windows -if(WIN32) +if(MSVC) set(PROTOBUF_ORIG_FIND_LIBRARY_PREFIXES "${CMAKE_FIND_LIBRARY_PREFIXES}") set(CMAKE_FIND_LIBRARY_PREFIXES "lib" "") + + find_path(PROTOBUF_SRC_ROOT_FOLDER protobuf.pc.in) endif() -find_library(PROTOBUF_LIBRARY NAMES protobuf - DOC "The Google Protocol Buffers Library" -) -find_library(PROTOBUF_PROTOC_LIBRARY NAMES protoc - DOC "The Google Protocol Buffers Compiler Library" -) -find_program(PROTOBUF_PROTOC_EXECUTABLE NAMES protoc - DOC "The Google Protocol Buffers Compiler" -) +# The Protobuf library +_protobuf_find_libraries(PROTOBUF protobuf) +#DOC "The Google Protocol Buffers RELEASE Library" -mark_as_advanced(PROTOBUF_INCLUDE_DIR - PROTOBUF_LIBRARY - PROTOBUF_PROTOC_LIBRARY - PROTOBUF_PROTOC_EXECUTABLE) +_protobuf_find_libraries(PROTOBUF_LITE protobuf-lite) + +# The Protobuf Protoc Library +_protobuf_find_libraries(PROTOBUF_PROTOC protoc) # Restore original find library prefixes -if(WIN32) +if(MSVC) set(CMAKE_FIND_LIBRARY_PREFIXES "${PROTOBUF_ORIG_FIND_LIBRARY_PREFIXES}") endif() + +# Find the include directory +find_path(PROTOBUF_INCLUDE_DIR + google/protobuf/service.h + PATHS ${PROTOBUF_SRC_ROOT_FOLDER}/src +) +mark_as_advanced(PROTOBUF_INCLUDE_DIR) + +# Find the protoc Executable +find_program(PROTOBUF_PROTOC_EXECUTABLE + NAMES protoc + DOC "The Google Protocol Buffers Compiler" + PATHS + ${PROTOBUF_SRC_ROOT_FOLDER}/vsprojects/Release + ${PROTOBUF_SRC_ROOT_FOLDER}/vsprojects/Debug +) +mark_as_advanced(PROTOBUF_PROTOC_EXECUTABLE) + + include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) FIND_PACKAGE_HANDLE_STANDARD_ARGS(PROTOBUF DEFAULT_MSG PROTOBUF_LIBRARY PROTOBUF_INCLUDE_DIR) if(PROTOBUF_FOUND) set(PROTOBUF_INCLUDE_DIRS ${PROTOBUF_INCLUDE_DIR}) - set(PROTOBUF_LIBRARIES ${PROTOBUF_LIBRARY}) endif() diff --git a/Source/CTest/cmCTestMemCheckHandler.cxx b/Source/CTest/cmCTestMemCheckHandler.cxx index 13a25cb..0612449 100644 --- a/Source/CTest/cmCTestMemCheckHandler.cxx +++ b/Source/CTest/cmCTestMemCheckHandler.cxx @@ -344,9 +344,21 @@ void cmCTestMemCheckHandler::GenerateDartOutput(std::ostream& os) } this->MemoryTesterGlobalResults[kk] += memcheckresults[kk]; } + + std::string logTag; + if(this->CTest->ShouldCompressMemCheckOutput()) + { + this->CTest->CompressString(memcheckstr); + logTag = "\t<Log compression=\"gzip\" encoding=\"base64\">\n"; + } + else + { + logTag = "\t<Log>\n"; + } + os << "\t\t</Results>\n" - << "\t<Log>\n" << memcheckstr << std::endl + << logTag << memcheckstr << std::endl << "\t</Log>\n"; this->WriteTestResultFooter(os, result); if ( current < cc ) diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx index 42a4cff..b5b46f6 100644 --- a/Source/CTest/cmCTestRunTest.cxx +++ b/Source/CTest/cmCTestRunTest.cxx @@ -135,7 +135,10 @@ void cmCTestRunTest::CompressOutput() //--------------------------------------------------------- bool cmCTestRunTest::EndTest(size_t completed, size_t total, bool started) { - if (this->CTest->ShouldCompressTestOutput()) + if ((!this->TestHandler->MemCheck && + this->CTest->ShouldCompressTestOutput()) || + (this->TestHandler->MemCheck && + this->CTest->ShouldCompressMemCheckOutput())) { this->CompressOutput(); } @@ -279,11 +282,11 @@ bool cmCTestRunTest::EndTest(size_t completed, size_t total, bool started) // Output since that is what is parsed by cmCTestMemCheckHandler if(!this->TestHandler->MemCheck && started) { - this->TestHandler->CleanTestOutput(this->ProcessOutput, - static_cast<size_t> - (this->TestResult.Status == cmCTestTestHandler::COMPLETED ? - this->TestHandler->CustomMaximumPassedTestOutputSize : - this->TestHandler->CustomMaximumFailedTestOutputSize)); + this->TestHandler->CleanTestOutput(this->ProcessOutput, + static_cast<size_t> + (this->TestResult.Status == cmCTestTestHandler::COMPLETED ? + this->TestHandler->CustomMaximumPassedTestOutputSize : + this->TestHandler->CustomMaximumFailedTestOutputSize)); } this->TestResult.Reason = reason; if (this->TestHandler->LogFile) @@ -332,7 +335,8 @@ bool cmCTestRunTest::EndTest(size_t completed, size_t total, bool started) // record the results in TestResult if(started) { - bool compress = this->CompressionRatio < 1 && + bool compress = !this->TestHandler->MemCheck && + this->CompressionRatio < 1 && this->CTest->ShouldCompressTestOutput(); this->TestResult.Output = compress ? this->CompressedOutput : this->ProcessOutput; diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index 70b1c01..75a564e 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -50,6 +50,9 @@ #include <memory> // auto_ptr +#include <cm_zlib.h> +#include <cmsys/Base64.h> + #if defined(__BEOS__) && !defined(__HAIKU__) #include <be/kernel/OS.h> /* disable_debugger() API. */ #endif @@ -308,7 +311,7 @@ cmCTest::cmCTest() this->UseHTTP10 = false; this->PrintLabels = false; this->CompressTestOutput = true; - this->ComputedCompressOutput = false; + this->CompressMemCheckOutput = true; this->TestModel = cmCTest::EXPERIMENTAL; this->MaxTestNameWidth = 30; this->InteractiveDebugMode = true; @@ -325,6 +328,8 @@ cmCTest::cmCTest() this->SuppressUpdatingCTestConfiguration = false; this->DartVersion = 1; this->OutputTestOutputOnTestFailure = false; + this->ComputedCompressTestOutput = false; + this->ComputedCompressMemCheckOutput = false; if(cmSystemTools::GetEnv("CTEST_OUTPUT_ON_FAILURE")) { this->OutputTestOutputOnTestFailure = true; @@ -394,7 +399,7 @@ void cmCTest::SetParallelLevel(int level) //---------------------------------------------------------------------------- bool cmCTest::ShouldCompressTestOutput() { - if(!this->ComputedCompressOutput) + if(!this->ComputedCompressTestOutput) { std::string cdashVersion = this->GetCDashVersion(); //version >= 1.6? @@ -403,12 +408,27 @@ bool cmCTest::ShouldCompressTestOutput() cmSystemTools::VersionCompare(cmSystemTools::OP_EQUAL, cdashVersion.c_str(), "1.6"); this->CompressTestOutput &= cdashSupportsGzip; - this->ComputedCompressOutput = true; + this->ComputedCompressTestOutput = true; } return this->CompressTestOutput; } //---------------------------------------------------------------------------- +bool cmCTest::ShouldCompressMemCheckOutput() +{ + if(!this->ComputedCompressMemCheckOutput) + { + std::string cdashVersion = this->GetCDashVersion(); + + bool compressionSupported = cmSystemTools::VersionCompare( + cmSystemTools::OP_GREATER, cdashVersion.c_str(), "1.9.0"); + this->CompressMemCheckOutput &= compressionSupported; + this->ComputedCompressMemCheckOutput = true; + } + return this->CompressMemCheckOutput; +} + +//---------------------------------------------------------------------------- std::string cmCTest::GetCDashVersion() { #ifdef CMAKE_BUILD_WITH_CMAKE @@ -1926,6 +1946,7 @@ void cmCTest::HandleCommandLineArguments(size_t &i, if(this->CheckArgument(arg, "--no-compress-output")) { this->CompressTestOutput = false; + this->CompressMemCheckOutput = false; } if(this->CheckArgument(arg, "--print-labels")) @@ -3055,3 +3076,56 @@ void cmCTest::OutputTestErrors(std::vector<char> const &process_output) } cmCTestLog(this, HANDLER_OUTPUT, test_outputs << std::endl << std::flush); } + +//---------------------------------------------------------------------- +bool cmCTest::CompressString(std::string& str) +{ + int ret; + z_stream strm; + + unsigned char* in = reinterpret_cast<unsigned char*>( + const_cast<char*>(str.c_str())); + //zlib makes the guarantee that this is the maximum output size + int outSize = static_cast<int>( + static_cast<double>(str.size()) * 1.001 + 13.0); + unsigned char* out = new unsigned char[outSize]; + + strm.zalloc = Z_NULL; + strm.zfree = Z_NULL; + strm.opaque = Z_NULL; + ret = deflateInit(&strm, -1); //default compression level + if (ret != Z_OK) + { + return false; + } + + strm.avail_in = static_cast<uInt>(str.size()); + strm.next_in = in; + strm.avail_out = outSize; + strm.next_out = out; + ret = deflate(&strm, Z_FINISH); + + if(ret == Z_STREAM_ERROR || ret != Z_STREAM_END) + { + cmCTestLog(this, ERROR_MESSAGE, "Error during gzip compression." + << std::endl); + return false; + } + + (void)deflateEnd(&strm); + + // Now base64 encode the resulting binary string + unsigned char* base64EncodedBuffer + = new unsigned char[static_cast<int>(outSize * 1.5)]; + + unsigned long rlen + = cmsysBase64_Encode(out, strm.total_out, base64EncodedBuffer, 1); + + str = ""; + str.append(reinterpret_cast<char*>(base64EncodedBuffer), rlen); + + delete [] base64EncodedBuffer; + delete [] out; + + return true; +} diff --git a/Source/cmCTest.h b/Source/cmCTest.h index 3b02748..44a5349 100644 --- a/Source/cmCTest.h +++ b/Source/cmCTest.h @@ -219,6 +219,8 @@ public: bool ShouldPrintLabels() { return this->PrintLabels; } bool ShouldCompressTestOutput(); + bool ShouldCompressMemCheckOutput(); + bool CompressString(std::string& str); std::string GetCDashVersion(); @@ -430,7 +432,8 @@ private: bool RunConfigurationScript; //flag for lazy getter (optimization) - bool ComputedCompressOutput; + bool ComputedCompressTestOutput; + bool ComputedCompressMemCheckOutput; int GenerateNotesFile(const char* files); @@ -487,8 +490,8 @@ private: bool ShortDateFormat; bool CompressXMLFiles; - bool CompressTestOutput; + bool CompressMemCheckOutput; void InitStreams(); std::ostream* StreamOut; diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index dc63568..c40e905 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -2689,7 +2689,7 @@ bool cmSystemTools::VersionCompare(cmSystemTools::CompareOp op, else if(lhs[i] > rhs[i]) { // lhs > rhs, so true if operation is GREATER - return op == cmSystemTools::OP_GREATER; + return op == cmSystemTools::OP_GREATER; } } // lhs == rhs, so true if operation is EQUAL diff --git a/Source/kwsys/kwsysDateStamp.cmake b/Source/kwsys/kwsysDateStamp.cmake index 4a17cef..f4cb7f3 100644 --- a/Source/kwsys/kwsysDateStamp.cmake +++ b/Source/kwsys/kwsysDateStamp.cmake @@ -15,7 +15,7 @@ SET(KWSYS_DATE_STAMP_YEAR 2011) # KWSys version date month component. Format is MM. -SET(KWSYS_DATE_STAMP_MONTH 05) +SET(KWSYS_DATE_STAMP_MONTH 06) # KWSys version date day component. Format is DD. -SET(KWSYS_DATE_STAMP_DAY 26) +SET(KWSYS_DATE_STAMP_DAY 02) |