Merge commit 'a33b6b091999d44f771761be03beb64d3af2350a' into user_logger_instead_of_printf
This commit is contained in:
		
							
								
								
									
										14
									
								
								.travis.yml
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								.travis.yml
									
									
									
									
									
								
							| @@ -7,7 +7,11 @@ install: | |||||||
| # /usr/bin/gcc is 4.6 always, but gcc-X.Y is available. | # /usr/bin/gcc is 4.6 always, but gcc-X.Y is available. | ||||||
| - if [ "$CXX" = "g++" ]; then export CXX="g++-4.9" CC="gcc-4.9"; fi | - if [ "$CXX" = "g++" ]; then export CXX="g++-4.9" CC="gcc-4.9"; fi | ||||||
| # /usr/bin/clang is 3.4, lets override with modern one. | # /usr/bin/clang is 3.4, lets override with modern one. | ||||||
| - if [ "$CXX" = "clang++" ] && [ "$TRAVIS_OS_NAME" = "linux" ]; then export CXX="clang++-3.7" CC="clang-3.7"; fi | - if [ "$CXX" = "clang++" ] && [ "$TRAVIS_OS_NAME" = "linux" ]; then export CXX="clang++-3.7" CC="clang-3.7"; ln -sf /usr/bin/ccache /$HOME/bin/$CXX; ln -sf /usr/bin/ccache /$HOME/bin/$CC; fi | ||||||
|  | # ccache on OS X needs installation first | ||||||
|  | - if [ "$TRAVIS_OS_NAME" = "osx" ]; then brew install ccache; export PATH="/usr/local/opt/ccache/libexec:$PATH"; fi | ||||||
|  | # reset ccache statistics | ||||||
|  | - ccache --zero-stats | ||||||
| - echo ${PATH} | - echo ${PATH} | ||||||
| - echo ${CXX} | - echo ${CXX} | ||||||
| - ${CXX} --version | - ${CXX} --version | ||||||
| @@ -30,14 +34,18 @@ os: | |||||||
|   - linux |   - linux | ||||||
|   - osx |   - osx | ||||||
| language: cpp | language: cpp | ||||||
|  | cache: ccache | ||||||
|  | before_cache: | ||||||
|  |   # print statistics before uploading new cache | ||||||
|  |   - ccache --show-stats | ||||||
| compiler: | compiler: | ||||||
|   - gcc |   - gcc | ||||||
|   - clang |   - clang | ||||||
| script: ./travis.sh | script: ./travis.sh | ||||||
| env: | env: | ||||||
|   matrix: |   matrix: | ||||||
|     - SHARED_LIB=OFF STATIC_LIB=ON CMAKE_PKG=OFF BUILD_TYPE=debug VERBOSE=1 |     - SHARED_LIB=OFF STATIC_LIB=ON CMAKE_PKG=OFF BUILD_TYPE=Debug VERBOSE=1 | ||||||
|     - SHARED_LIB=OFF STATIC_LIB=ON CMAKE_PKG=OFF BUILD_TYPE=debug VERBOSE=1 CXX_FLAGS=-std=c++11 |     - SHARED_LIB=OFF STATIC_LIB=ON CMAKE_PKG=OFF BUILD_TYPE=Debug VERBOSE=1 CXX_FLAGS=-std=c++11 | ||||||
| notifications: | notifications: | ||||||
|   email: false |   email: false | ||||||
| sudo: false | sudo: false | ||||||
|   | |||||||
| @@ -164,7 +164,7 @@ if (gmock_build_tests) | |||||||
|   cxx_test(gmock_link_test gmock_main test/gmock_link2_test.cc) |   cxx_test(gmock_link_test gmock_main test/gmock_link2_test.cc) | ||||||
|   cxx_test(gmock_test gmock_main) |   cxx_test(gmock_test gmock_main) | ||||||
|  |  | ||||||
|   if (CMAKE_USE_PTHREADS_INIT) |   if (DEFINED GTEST_HAS_PTHREAD) | ||||||
|     cxx_test(gmock_stress_test gmock) |     cxx_test(gmock_stress_test gmock) | ||||||
|   endif() |   endif() | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,7 +1,7 @@ | |||||||
| m4_include(../googletest/m4/acx_pthread.m4) | m4_include(../googletest/m4/acx_pthread.m4) | ||||||
|  |  | ||||||
| AC_INIT([Google C++ Mocking Framework], | AC_INIT([Google C++ Mocking Framework], | ||||||
|         [1.7.0], |         [1.8.0], | ||||||
|         [googlemock@googlegroups.com], |         [googlemock@googlegroups.com], | ||||||
|         [gmock]) |         [gmock]) | ||||||
|  |  | ||||||
| @@ -101,7 +101,7 @@ AC_ARG_VAR([GTEST_VERSION], | |||||||
|            [The version of Google Test available.]) |            [The version of Google Test available.]) | ||||||
| HAVE_BUILT_GTEST="no" | HAVE_BUILT_GTEST="no" | ||||||
|  |  | ||||||
| GTEST_MIN_VERSION="1.7.0" | GTEST_MIN_VERSION="1.8.0" | ||||||
|  |  | ||||||
| AS_IF([test "x${enable_external_gtest}" = "xyes"], | AS_IF([test "x${enable_external_gtest}" = "xyes"], | ||||||
|       [# Begin filling in variables as we are able. |       [# Begin filling in variables as we are able. | ||||||
|   | |||||||
| @@ -249,7 +249,7 @@ match them more flexibly, or get more informative messages, you can use: | |||||||
| | `SizeIs(m)`              | `argument` is a container whose size matches `m`. E.g. `SizeIs(2)` or `SizeIs(Lt(2))`.                                           | | | `SizeIs(m)`              | `argument` is a container whose size matches `m`. E.g. `SizeIs(2)` or `SizeIs(Lt(2))`.                                           | | ||||||
| | `UnorderedElementsAre(e0, e1, ..., en)` | `argument` has `n + 1` elements, and under some permutation each element matches an `ei` (for a different `i`), which can be a value or a matcher. 0 to 10 arguments are allowed. | | | `UnorderedElementsAre(e0, e1, ..., en)` | `argument` has `n + 1` elements, and under some permutation each element matches an `ei` (for a different `i`), which can be a value or a matcher. 0 to 10 arguments are allowed. | | ||||||
| | `UnorderedElementsAreArray({ e0, e1, ..., en })`, `UnorderedElementsAreArray(array)`, or `UnorderedElementsAreArray(array, count)` | The same as `UnorderedElementsAre()` except that the expected element values/matchers come from an initializer list, STL-style container, or C-style array. | | | `UnorderedElementsAreArray({ e0, e1, ..., en })`, `UnorderedElementsAreArray(array)`, or `UnorderedElementsAreArray(array, count)` | The same as `UnorderedElementsAre()` except that the expected element values/matchers come from an initializer list, STL-style container, or C-style array. | | ||||||
| | `WhenSorted(m)`          | When `argument` is sorted using the `<` operator, it matches container matcher `m`. E.g. `WhenSorted(UnorderedElementsAre(1, 2, 3))` verifies that `argument` contains elements `1`, `2`, and `3`, ignoring order. | | | `WhenSorted(m)`          | When `argument` is sorted using the `<` operator, it matches container matcher `m`. E.g. `WhenSorted(ElementsAre(1, 2, 3))` verifies that `argument` contains elements `1`, `2`, and `3`, ignoring order. | | ||||||
| | `WhenSortedBy(comparator, m)` | The same as `WhenSorted(m)`, except that the given comparator instead of `<` is used to sort `argument`. E.g. `WhenSortedBy(std::greater<int>(), ElementsAre(3, 2, 1))`. | | | `WhenSortedBy(comparator, m)` | The same as `WhenSorted(m)`, except that the given comparator instead of `<` is used to sort `argument`. E.g. `WhenSortedBy(std::greater<int>(), ElementsAre(3, 2, 1))`. | | ||||||
|  |  | ||||||
| Notes: | Notes: | ||||||
|   | |||||||
| @@ -48,10 +48,14 @@ endmacro() | |||||||
| macro(config_compiler_and_linker) | macro(config_compiler_and_linker) | ||||||
|   # Note: pthreads on MinGW is not supported, even if available |   # Note: pthreads on MinGW is not supported, even if available | ||||||
|   # instead, we use windows threading primitives |   # instead, we use windows threading primitives | ||||||
|  |   unset(GTEST_HAS_PTHREAD) | ||||||
|   if (NOT gtest_disable_pthreads AND NOT MINGW) |   if (NOT gtest_disable_pthreads AND NOT MINGW) | ||||||
|     # Defines CMAKE_USE_PTHREADS_INIT and CMAKE_THREAD_LIBS_INIT. |     # Defines CMAKE_USE_PTHREADS_INIT and CMAKE_THREAD_LIBS_INIT. | ||||||
|     set(THREADS_PREFER_PTHREAD_FLAG ON) |     set(THREADS_PREFER_PTHREAD_FLAG ON) | ||||||
|     find_package(Threads) |     find_package(Threads) | ||||||
|  |     if (CMAKE_USE_PTHREADS_INIT) | ||||||
|  |       set(GTEST_HAS_PTHREAD ON) | ||||||
|  |     endif() | ||||||
|   endif() |   endif() | ||||||
|  |  | ||||||
|   fix_default_compiler_settings_() |   fix_default_compiler_settings_() | ||||||
| @@ -126,7 +130,8 @@ macro(config_compiler_and_linker) | |||||||
|     set(cxx_no_rtti_flags "") |     set(cxx_no_rtti_flags "") | ||||||
|   endif() |   endif() | ||||||
|  |  | ||||||
|   if (CMAKE_USE_PTHREADS_INIT)  # The pthreads library is available and allowed. |   # The pthreads library is available and allowed? | ||||||
|  |   if (DEFINED GTEST_HAS_PTHREAD) | ||||||
|     set(GTEST_HAS_PTHREAD_MACRO "-DGTEST_HAS_PTHREAD=1") |     set(GTEST_HAS_PTHREAD_MACRO "-DGTEST_HAS_PTHREAD=1") | ||||||
|   else() |   else() | ||||||
|     set(GTEST_HAS_PTHREAD_MACRO "-DGTEST_HAS_PTHREAD=0") |     set(GTEST_HAS_PTHREAD_MACRO "-DGTEST_HAS_PTHREAD=0") | ||||||
| @@ -159,7 +164,7 @@ function(cxx_library_with_type name type cxx_flags) | |||||||
|       PROPERTIES |       PROPERTIES | ||||||
|       COMPILE_DEFINITIONS "GTEST_CREATE_SHARED_LIBRARY=1") |       COMPILE_DEFINITIONS "GTEST_CREATE_SHARED_LIBRARY=1") | ||||||
|   endif() |   endif() | ||||||
|   if (CMAKE_USE_PTHREADS_INIT) |   if (DEFINED GTEST_HAS_PTHREAD) | ||||||
|     target_link_libraries(${name} ${CMAKE_THREAD_LIBS_INIT}) |     target_link_libraries(${name} ${CMAKE_THREAD_LIBS_INIT}) | ||||||
|   endif() |   endif() | ||||||
| endfunction() | endfunction() | ||||||
| @@ -236,23 +241,33 @@ endfunction() | |||||||
| # creates a Python test with the given name whose main module is in | # creates a Python test with the given name whose main module is in | ||||||
| # test/name.py.  It does nothing if Python is not installed. | # test/name.py.  It does nothing if Python is not installed. | ||||||
| function(py_test name) | function(py_test name) | ||||||
|   # We are not supporting Python tests on Linux yet as they consider |  | ||||||
|   # all Linux environments to be google3 and try to use google3 features. |  | ||||||
|   if (PYTHONINTERP_FOUND) |   if (PYTHONINTERP_FOUND) | ||||||
|     # ${CMAKE_BINARY_DIR} is known at configuration time, so we can |  | ||||||
|     # directly bind it from cmake. ${CTEST_CONFIGURATION_TYPE} is known |  | ||||||
|     # only at ctest runtime (by calling ctest -c <Configuration>), so |  | ||||||
|     # we have to escape $ to delay variable substitution here. |  | ||||||
|     if (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 3.1) |     if (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 3.1) | ||||||
|  |       if (CMAKE_CONFIGURATION_TYPES) | ||||||
|  | 	# Multi-configuration build generators as for Visual Studio save | ||||||
|  | 	# output in a subdirectory of CMAKE_CURRENT_BINARY_DIR (Debug, | ||||||
|  | 	# Release etc.), so we have to provide it here. | ||||||
|         add_test( |         add_test( | ||||||
|           NAME ${name} |           NAME ${name} | ||||||
|           COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test/${name}.py |           COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test/${name}.py | ||||||
|             --build_dir=${CMAKE_CURRENT_BINARY_DIR}/$<CONFIGURATION>) |               --build_dir=${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>) | ||||||
|  |       else (CMAKE_CONFIGURATION_TYPES) | ||||||
|  | 	# Single-configuration build generators like Makefile generators | ||||||
|  | 	# don't have subdirs below CMAKE_CURRENT_BINARY_DIR. | ||||||
|  |         add_test( | ||||||
|  |           NAME ${name} | ||||||
|  |           COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test/${name}.py | ||||||
|  |               --build_dir=${CMAKE_CURRENT_BINARY_DIR}) | ||||||
|  |       endif (CMAKE_CONFIGURATION_TYPES) | ||||||
|     else (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 3.1) |     else (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 3.1) | ||||||
|  |       # ${CMAKE_CURRENT_BINARY_DIR} is known at configuration time, so we can | ||||||
|  |       # directly bind it from cmake. ${CTEST_CONFIGURATION_TYPE} is known | ||||||
|  |       # only at ctest runtime (by calling ctest -c <Configuration>), so | ||||||
|  |       # we have to escape $ to delay variable substitution here. | ||||||
|       add_test( |       add_test( | ||||||
|         ${name} |         ${name} | ||||||
|         ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test/${name}.py |         ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test/${name}.py | ||||||
|           --build_dir=${CMAKE_CURRENT_BINARY_DIR}/\${CTEST_CONFIGURATION_TYPE}) |           --build_dir=${CMAKE_CURRENT_BINARY_DIR}/\${CTEST_CONFIGURATION_TYPE}) | ||||||
|     endif (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 3.1) |     endif (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 3.1) | ||||||
|   endif() |   endif(PYTHONINTERP_FOUND) | ||||||
| endfunction() | endfunction() | ||||||
|   | |||||||
| @@ -5,7 +5,7 @@ m4_include(m4/acx_pthread.m4) | |||||||
| # "[1.0.1]"). It also asumes that there won't be any closing parenthesis | # "[1.0.1]"). It also asumes that there won't be any closing parenthesis | ||||||
| # between "AC_INIT(" and the closing ")" including comments and strings. | # between "AC_INIT(" and the closing ")" including comments and strings. | ||||||
| AC_INIT([Google C++ Testing Framework], | AC_INIT([Google C++ Testing Framework], | ||||||
|         [1.7.0], |         [1.8.0], | ||||||
|         [googletestframework@googlegroups.com], |         [googletestframework@googlegroups.com], | ||||||
|         [gtest]) |         [gtest]) | ||||||
|  |  | ||||||
|   | |||||||
| @@ -141,7 +141,7 @@ void VerifyGenerator(const ParamGenerator<T>& generator, | |||||||
|         << ", expected_values[i] is " << PrintValue(expected_values[i]) |         << ", expected_values[i] is " << PrintValue(expected_values[i]) | ||||||
|         << ", *it is " << PrintValue(*it) |         << ", *it is " << PrintValue(*it) | ||||||
|         << ", and 'it' is an iterator created with the copy constructor.\n"; |         << ", and 'it' is an iterator created with the copy constructor.\n"; | ||||||
|     it++; |     ++it; | ||||||
|   } |   } | ||||||
|   EXPECT_TRUE(it == generator.end()) |   EXPECT_TRUE(it == generator.end()) | ||||||
|         << "At the presumed end of sequence when accessing via an iterator " |         << "At the presumed end of sequence when accessing via an iterator " | ||||||
| @@ -161,7 +161,7 @@ void VerifyGenerator(const ParamGenerator<T>& generator, | |||||||
|         << ", expected_values[i] is " << PrintValue(expected_values[i]) |         << ", expected_values[i] is " << PrintValue(expected_values[i]) | ||||||
|         << ", *it is " << PrintValue(*it) |         << ", *it is " << PrintValue(*it) | ||||||
|         << ", and 'it' is an iterator created with the copy constructor.\n"; |         << ", and 'it' is an iterator created with the copy constructor.\n"; | ||||||
|     it++; |     ++it; | ||||||
|   } |   } | ||||||
|   EXPECT_TRUE(it == generator.end()) |   EXPECT_TRUE(it == generator.end()) | ||||||
|         << "At the presumed end of sequence when accessing via an iterator " |         << "At the presumed end of sequence when accessing via an iterator " | ||||||
| @@ -196,7 +196,7 @@ TEST(IteratorTest, ParamIteratorConformsToForwardIteratorConcept) { | |||||||
|                            << "element same as its source points to"; |                            << "element same as its source points to"; | ||||||
|  |  | ||||||
|   // Verifies that iterator assignment works as expected. |   // Verifies that iterator assignment works as expected. | ||||||
|   it++; |   ++it; | ||||||
|   EXPECT_FALSE(*it == *it2); |   EXPECT_FALSE(*it == *it2); | ||||||
|   it2 = it; |   it2 = it; | ||||||
|   EXPECT_TRUE(*it == *it2) << "Assigned iterators must point to the " |   EXPECT_TRUE(*it == *it2) << "Assigned iterators must point to the " | ||||||
| @@ -215,7 +215,7 @@ TEST(IteratorTest, ParamIteratorConformsToForwardIteratorConcept) { | |||||||
|   // Verifies that prefix and postfix operator++() advance an iterator |   // Verifies that prefix and postfix operator++() advance an iterator | ||||||
|   // all the same. |   // all the same. | ||||||
|   it2 = it; |   it2 = it; | ||||||
|   it++; |   ++it; | ||||||
|   ++it2; |   ++it2; | ||||||
|   EXPECT_TRUE(*it == *it2); |   EXPECT_TRUE(*it == *it2); | ||||||
| } | } | ||||||
|   | |||||||
| @@ -7655,7 +7655,7 @@ TEST(NativeArrayTest, MethodsWork) { | |||||||
|   EXPECT_EQ(0, *it); |   EXPECT_EQ(0, *it); | ||||||
|   ++it; |   ++it; | ||||||
|   EXPECT_EQ(1, *it); |   EXPECT_EQ(1, *it); | ||||||
|   it++; |   ++it; | ||||||
|   EXPECT_EQ(2, *it); |   EXPECT_EQ(2, *it); | ||||||
|   ++it; |   ++it; | ||||||
|   EXPECT_EQ(na.end(), it); |   EXPECT_EQ(na.end(), it); | ||||||
|   | |||||||
							
								
								
									
										21
									
								
								travis.sh
									
									
									
									
									
								
							
							
						
						
									
										21
									
								
								travis.sh
									
									
									
									
									
								
							| @@ -1,5 +1,25 @@ | |||||||
| #!/usr/bin/env sh | #!/usr/bin/env sh | ||||||
| set -evx | set -evx | ||||||
|  |  | ||||||
|  | # if possible, ask for the precise number of processors, | ||||||
|  | # otherwise take 2 processors as reasonable default; see | ||||||
|  | # https://docs.travis-ci.com/user/speeding-up-the-build/#Makefile-optimization | ||||||
|  | if [ -x /usr/bin/getconf ]; then | ||||||
|  |     NPROCESSORS=$(/usr/bin/getconf _NPROCESSORS_ONLN) | ||||||
|  | else | ||||||
|  |     NPROCESSORS=2 | ||||||
|  | fi | ||||||
|  | # as of 2017-09-04 Travis CI reports 32 processors, but GCC build | ||||||
|  | # crashes if parallelized too much (maybe memory consumption problem), | ||||||
|  | # so limit to 4 processors for the time being. | ||||||
|  | if [ $NPROCESSORS -gt 4 ] ; then | ||||||
|  | 	echo "$0:Note: Limiting processors to use by make from $NPROCESSORS to 4." | ||||||
|  | 	NPROCESSORS=4 | ||||||
|  | fi | ||||||
|  | # Tell make to use the processors. No preceding '-' required. | ||||||
|  | MAKEFLAGS="j${NPROCESSORS}" | ||||||
|  | export MAKEFLAGS | ||||||
|  |  | ||||||
| env | sort | env | sort | ||||||
|  |  | ||||||
| mkdir build || true | mkdir build || true | ||||||
| @@ -8,6 +28,7 @@ cmake -Dgtest_build_samples=ON \ | |||||||
|       -Dgtest_build_tests=ON \ |       -Dgtest_build_tests=ON \ | ||||||
|       -Dgmock_build_tests=ON \ |       -Dgmock_build_tests=ON \ | ||||||
|       -DCMAKE_CXX_FLAGS=$CXX_FLAGS \ |       -DCMAKE_CXX_FLAGS=$CXX_FLAGS \ | ||||||
|  |       -DCMAKE_BUILD_TYPE=$BUILD_TYPE \ | ||||||
|       .. |       .. | ||||||
| make | make | ||||||
| CTEST_OUTPUT_ON_FAILURE=1 make test | CTEST_OUTPUT_ON_FAILURE=1 make test | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Gasprd Petit
					Gasprd Petit