From e49429051272141a91ce898caa176f4366c5209e Mon Sep 17 00:00:00 2001 From: Tanzinul Islam Date: Mon, 19 Jun 2017 01:33:58 +0100 Subject: Allow death test child to bypass WER under MinGW The mechanics of suppressing debugger trapping and Windows Error Reporting for the crashed child process in a death test are currently guarded under the `GTEST_HAS_SEH` macro. This seems unnecessary, as the logic does not call any APIs related to Structured Error Handling. Replace the guarding macro with the more permissive `GTEST_OS_WINDOWS`, so that Windows toolchains without SEH support (e.g. MinGW) can benefit from it. Fixes: #1116 --- googletest/src/gtest.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/googletest/src/gtest.cc b/googletest/src/gtest.cc index 3a18f25d..dc5f54d8 100644 --- a/googletest/src/gtest.cc +++ b/googletest/src/gtest.cc @@ -4214,7 +4214,7 @@ int UnitTest::Run() { // used for the duration of the program. impl()->set_catch_exceptions(GTEST_FLAG(catch_exceptions)); -#if GTEST_HAS_SEH +#if GTEST_OS_WINDOWS // Either the user wants Google Test to catch exceptions thrown by the // tests or this is executing in the context of death test child // process. In either case the user does not want to see pop-up dialogs @@ -4251,7 +4251,7 @@ int UnitTest::Run() { _WRITE_ABORT_MSG | _CALL_REPORTFAULT); // pop-up window, core dump. # endif } -#endif // GTEST_HAS_SEH +#endif // GTEST_OS_WINDOWS return internal::HandleExceptionsInMethodIfSupported( impl(), -- cgit v1.2.3 From c958e26fd02d43a916ff297c89eee22166fe7be7 Mon Sep 17 00:00:00 2001 From: Scott Slack-Smith Date: Fri, 30 Jun 2017 17:12:56 +0100 Subject: *Silence false positive memory leaks reported by Microsoft's debug CRT* MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add a new RAII MemoryIsNotDeallocated class that excludes memory allocations from Microsoft’s debug CRT leak detection report. We use this RAII class to silence 2 false positive leaks that are caused by memory allocations that are intentionally never deallocated. *Background* The MS debug CRT has a lightweight memory leak detection mechanism that can only detect if a memory allocation is missing a matching deallocation. Consequently, it will report a false positive leak for memory that’s intentionally never deallocated. For example, memory that’s reachable for the entire lifetime of a app. Note the MS debug CRT is always tracking memory allocations but the final memory leak report is disabled by default. As you can’t avoid paying for its cost, you may as well use it. The memory leak report can be enabled by calling the following function #ifdef _MSC_VER _CrtSetDbgFlag(_CrtSetDbgFlag(_CRTDBG_REPORT_FLAG) | _CRTDBG_LEAK_CHECK_DF); #endif // _MSC_VER anywhere before exiting main. For example, the following are the false positive leaks reported before this change; Detected memory leaks! Dumping objects -> {750} normal block at 0x015DF938, 8 bytes long. Data: < ] > 00 F9 5D 01 00 00 00 00 {749} normal block at 0x015DEE60, 32 bytes long. Data: <` ] ` ] ` ] > 60 EE 5D 01 60 EE 5D 01 60 EE 5D 01 01 01 CD CD {748} normal block at 0x015DF900, 12 bytes long. Data: <8 ] ` ] > 38 F9 5D 01 60 EE 5D 01 00 00 00 00 {747} normal block at 0x015DA0F8, 24 bytes long. Data: < > FF FF FF FF FF FF FF FF 00 00 00 00 00 00 00 00 Object dump complete. As you can see from above it’s not easy to identify the above are false positives. Consequently, if false positive leaks are not fixed or silenced, then it becomes impractical to identify real memory leaks. --- googletest/src/gtest-port.cc | 52 ++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 50 insertions(+), 2 deletions(-) diff --git a/googletest/src/gtest-port.cc b/googletest/src/gtest-port.cc index d80bd80c..edd115df 100644 --- a/googletest/src/gtest-port.cc +++ b/googletest/src/gtest-port.cc @@ -279,6 +279,43 @@ void Mutex::AssertHeld() { << "The current thread is not holding the mutex @" << this; } +namespace { + +// Use the RAII idiom to flag mem allocs that are intentionally never +// deallocated. The motivation is to silence the false positive mem leaks +// that are reported by the debug version of MS's CRT which can only detect +// if an alloc is missing a matching deallocation. +// Example: +// MemoryIsNotDeallocated memory_is_not_deallocated; +// critical_section_ = new CRITICAL_SECTION; +// +class MemoryIsNotDeallocated +{ +public: + MemoryIsNotDeallocated() : old_crtdbg_flag_(0) { +#ifdef _MSC_VER + old_crtdbg_flag_ = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG); + // Set heap allocation block type to _IGNORE_BLOCK so that MS debug CRT + // doesn't report mem leak if there's no matching deallocation. + _CrtSetDbgFlag(old_crtdbg_flag_ & ~_CRTDBG_ALLOC_MEM_DF); +#endif // _MSC_VER + } + + ~MemoryIsNotDeallocated() { +#ifdef _MSC_VER + // Restore the original _CRTDBG_ALLOC_MEM_DF flag + _CrtSetDbgFlag(old_crtdbg_flag_); +#endif // _MSC_VER + } + +private: + int old_crtdbg_flag_; + + GTEST_DISALLOW_COPY_AND_ASSIGN_(MemoryIsNotDeallocated); +}; + +} // namespace + // Initializes owner_thread_id_ and critical_section_ in static mutexes. void Mutex::ThreadSafeLazyInit() { // Dynamic mutexes are initialized in the constructor. @@ -289,7 +326,11 @@ void Mutex::ThreadSafeLazyInit() { // If critical_section_init_phase_ was 0 before the exchange, we // are the first to test it and need to perform the initialization. owner_thread_id_ = 0; - critical_section_ = new CRITICAL_SECTION; + { + // Use RAII to flag that following mem alloc is never deallocated. + MemoryIsNotDeallocated memory_is_not_deallocated; + critical_section_ = new CRITICAL_SECTION; + } ::InitializeCriticalSection(critical_section_); // Updates the critical_section_init_phase_ to 2 to signal // initialization complete. @@ -528,10 +569,17 @@ class ThreadLocalRegistryImpl { return 0; } + // Return a newly constructed ThreadIdToThreadLocals that's intentionally never deleted + static ThreadIdToThreadLocals* NewThreadIdToThreadLocals() { + // Use RAII to flag that following mem alloc is never deallocated. + MemoryIsNotDeallocated memory_is_not_deallocated; + return new ThreadIdToThreadLocals; + } + // Returns map of thread local instances. static ThreadIdToThreadLocals* GetThreadLocalsMapLocked() { mutex_.AssertHeld(); - static ThreadIdToThreadLocals* map = new ThreadIdToThreadLocals; + static ThreadIdToThreadLocals* map = NewThreadIdToThreadLocals(); return map; } -- cgit v1.2.3 From ad383b274db2696cf2d4bdea9d477c463992f2fc Mon Sep 17 00:00:00 2001 From: Conor Burgess Date: Thu, 7 Dec 2017 10:53:13 +0000 Subject: Fix value pointed to by `_NSGetArgc()` on macOS --- googletest/src/gtest.cc | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/googletest/src/gtest.cc b/googletest/src/gtest.cc index 749e8299..41ed48bb 100644 --- a/googletest/src/gtest.cc +++ b/googletest/src/gtest.cc @@ -146,6 +146,12 @@ # define vsnprintf _vsnprintf #endif // GTEST_OS_WINDOWS +#if GTEST_OS_MAC +# ifndef GTEST_OS_IOS +# include +# endif +#endif + namespace testing { using internal::CountIf; @@ -5341,6 +5347,16 @@ void ParseGoogleTestFlagsOnlyImpl(int* argc, CharType** argv) { } } +// Fix the value of *_NSGetArgc() on macOS, but iff +// *_NSGetArgv() == argv +#if GTEST_OS_MAC +# ifndef GTEST_OS_IOS + if (*_NSGetArgv() == argv) { + *_NSGetArgc() = *argc; + } +# endif +#endif + if (g_help_flag) { // We print the help here instead of in RUN_ALL_TESTS(), as the // latter may not be called at all if the user is using Google -- cgit v1.2.3 From 4d50715c2bf9c727573a397cfb02bd551d4aa3b0 Mon Sep 17 00:00:00 2001 From: Conor Burgess Date: Thu, 7 Dec 2017 11:49:33 +0000 Subject: Fix location of `_NSGetArgv` correction. --- googletest/src/gtest.cc | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/googletest/src/gtest.cc b/googletest/src/gtest.cc index 41ed48bb..3c94381c 100644 --- a/googletest/src/gtest.cc +++ b/googletest/src/gtest.cc @@ -5347,16 +5347,6 @@ void ParseGoogleTestFlagsOnlyImpl(int* argc, CharType** argv) { } } -// Fix the value of *_NSGetArgc() on macOS, but iff -// *_NSGetArgv() == argv -#if GTEST_OS_MAC -# ifndef GTEST_OS_IOS - if (*_NSGetArgv() == argv) { - *_NSGetArgc() = *argc; - } -# endif -#endif - if (g_help_flag) { // We print the help here instead of in RUN_ALL_TESTS(), as the // latter may not be called at all if the user is using Google @@ -5369,6 +5359,17 @@ void ParseGoogleTestFlagsOnlyImpl(int* argc, CharType** argv) { // other parts of Google Test. void ParseGoogleTestFlagsOnly(int* argc, char** argv) { ParseGoogleTestFlagsOnlyImpl(argc, argv); + + // Fix the value of *_NSGetArgc() on macOS, but iff + // *_NSGetArgv() == argv + // Only applicable to char** version of argv +#if GTEST_OS_MAC +# ifndef GTEST_OS_IOS + if (*_NSGetArgv() == argv) { + *_NSGetArgc() = *argc; + } +# endif +#endif } void ParseGoogleTestFlagsOnly(int* argc, wchar_t** argv) { ParseGoogleTestFlagsOnlyImpl(argc, argv); -- cgit v1.2.3 From b22e8dec408935a7f76420026a738eeb61f8af38 Mon Sep 17 00:00:00 2001 From: Henry Fredrick Schreiner Date: Thu, 5 Apr 2018 13:38:33 +0200 Subject: Clean up cache non-advanced variable for subproject --- googlemock/CMakeLists.txt | 18 ++++++++++++++---- googletest/CMakeLists.txt | 25 ++++++++++++++++++++----- 2 files changed, 34 insertions(+), 9 deletions(-) diff --git a/googlemock/CMakeLists.txt b/googlemock/CMakeLists.txt index bac2e3bf..7d66eb28 100644 --- a/googlemock/CMakeLists.txt +++ b/googlemock/CMakeLists.txt @@ -5,10 +5,6 @@ # ctest. You can select which tests to run using 'ctest -R regex'. # For more options, run 'ctest --help'. -# BUILD_SHARED_LIBS is a standard CMake variable, but we declare it here to -# make it prominent in the GUI. -option(BUILD_SHARED_LIBS "Build shared libraries (DLLs)." OFF) - option(gmock_build_tests "Build all of Google Mock's own tests." OFF) # A directory to find Google Test sources. @@ -55,6 +51,20 @@ endif() # if they are the same (the default). add_subdirectory("${gtest_dir}" "${gmock_BINARY_DIR}/gtest") + +# These commands only run if this is the main project +if(CMAKE_PROJECT_NAME STREQUAL "gmock" OR CMAKE_PROJECT_NAME STREQUAL "googletest-distribution") + + # BUILD_SHARED_LIBS is a standard CMake variable, but we declare it here to + # make it prominent in the GUI. + option(BUILD_SHARED_LIBS "Build shared libraries (DLLs)." OFF) + +else() + + mark_as_advanced(gmock_build_tests) + +endif() + # Although Google Test's CMakeLists.txt calls this function, the # changes there don't affect the current scope. Therefore we have to # call it again here. diff --git a/googletest/CMakeLists.txt b/googletest/CMakeLists.txt index b09c46ed..2a9b9898 100644 --- a/googletest/CMakeLists.txt +++ b/googletest/CMakeLists.txt @@ -5,10 +5,6 @@ # ctest. You can select which tests to run using 'ctest -R regex'. # For more options, run 'ctest --help'. -# BUILD_SHARED_LIBS is a standard CMake variable, but we declare it here to -# make it prominent in the GUI. -option(BUILD_SHARED_LIBS "Build shared libraries (DLLs)." OFF) - # When other libraries are using a shared version of runtime libraries, # Google Test also has to use one. option( @@ -60,6 +56,25 @@ if (COMMAND set_up_hermetic_build) set_up_hermetic_build() endif() +# These commands only run if this is the main project +if(CMAKE_PROJECT_NAME STREQUAL "gtest" OR CMAKE_PROJECT_NAME STREQUAL "googletest-distribution") + + # BUILD_SHARED_LIBS is a standard CMake variable, but we declare it here to + # make it prominent in the GUI. + option(BUILD_SHARED_LIBS "Build shared libraries (DLLs)." OFF) + +else() + + mark_as_advanced( + gtest_force_shared_crt + gtest_build_tests + gtest_build_samples + gtest_disable_pthreads + gtest_hide_internal_symbols) + +endif() + + if (gtest_hide_internal_symbols) set(CMAKE_CXX_VISIBILITY_PRESET hidden) set(CMAKE_VISIBILITY_INLINES_HIDDEN 1) @@ -86,7 +101,7 @@ include_directories( if (MSVC AND MSVC_VERSION EQUAL 1700) add_definitions(/D _VARIADIC_MAX=10) endif() - + ######################################################################## # # Defines the gtest & gtest_main libraries. User tests should link -- cgit v1.2.3 From dfddc987186100c98d93a830d6ca88fa66ab3dbc Mon Sep 17 00:00:00 2001 From: tisi1988 Date: Wed, 27 Jun 2018 22:47:18 +0200 Subject: FIX: Compilation warning with GCC regarding a non-initialised member from MutexBase class. --- googletest/include/gtest/internal/gtest-port.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/googletest/include/gtest/internal/gtest-port.h b/googletest/include/gtest/internal/gtest-port.h index 437a4ed7..08c50494 100644 --- a/googletest/include/gtest/internal/gtest-port.h +++ b/googletest/include/gtest/internal/gtest-port.h @@ -2093,7 +2093,7 @@ class MutexBase { // This allows initialization to work whether pthread_t is a scalar or struct. // The flag -Wmissing-field-initializers must not be specified for this to work. # define GTEST_DEFINE_STATIC_MUTEX_(mutex) \ - ::testing::internal::MutexBase mutex = { PTHREAD_MUTEX_INITIALIZER, false } + ::testing::internal::MutexBase mutex = { PTHREAD_MUTEX_INITIALIZER, false, 0 } // The Mutex class can only be used for mutexes created at runtime. It // shares its API with MutexBase otherwise. -- cgit v1.2.3 From b50b2f775ed0268af9c83a96b285e296778d0743 Mon Sep 17 00:00:00 2001 From: medithe <40990424+medithe@users.noreply.github.com> Date: Mon, 9 Jul 2018 13:36:46 +0200 Subject: Cast the tr1::tuple_element template parameter to int MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Because in `std::tr1::tuple_element` the first template parameter should be of type int (https://gcc.gnu.org/onlinedocs/libstdc++/libstdc++-html-USERS-4.4/a00547.html), but the code inserts a size_t, the first template parameter should be casted to int before, to get rid of the following errors: googletest-src/googletest/include/gtest/gtest-printers.h:957:60: error: conversion from ‘long unsigned int’ to ‘int’ may change value [-Werror=conversion] struct tuple_element : ::std::tr1::tuple_element {}; and googletest-src/googletest/include/gtest/gtest-printers.h:961:56: error: conversion from ‘long unsigned int’ to ‘int’ may change value [-Werror=conversion] const typename ::std::tr1::tuple_element::type>::type get( --- googletest/include/gtest/gtest-printers.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/googletest/include/gtest/gtest-printers.h b/googletest/include/gtest/gtest-printers.h index 373946b9..fa465c38 100644 --- a/googletest/include/gtest/gtest-printers.h +++ b/googletest/include/gtest/gtest-printers.h @@ -954,11 +954,11 @@ struct TuplePolicy { static const size_t tuple_size = ::std::tr1::tuple_size::value; template - struct tuple_element : ::std::tr1::tuple_element {}; + struct tuple_element : ::std::tr1::tuple_element(I), Tuple> {}; template static typename AddReference< - const typename ::std::tr1::tuple_element::type>::type get( + const typename ::std::tr1::tuple_element(I), Tuple>::type>::type get( const Tuple& tuple) { return ::std::tr1::get(tuple); } -- cgit v1.2.3 From 421e7b4f29fc761c66d2773a1fc318a738a6d3da Mon Sep 17 00:00:00 2001 From: Wojciech Kaluza Date: Sat, 26 May 2018 01:40:06 +0100 Subject: Remove default /EHsc compiler flag This prevents warning D9025 (one command-line option overrides another) on MSVC builds: some test targets are built with the /EHs-c- which conflicts with /EHsc. --- googletest/cmake/internal_utils.cmake | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/googletest/cmake/internal_utils.cmake b/googletest/cmake/internal_utils.cmake index 6448918f..3a9b5bc4 100644 --- a/googletest/cmake/internal_utils.cmake +++ b/googletest/cmake/internal_utils.cmake @@ -38,6 +38,11 @@ macro(fix_default_compiler_settings_) # We prefer more strict warning checking for building Google Test. # Replaces /W3 with /W4 in defaults. string(REPLACE "/W3" "/W4" ${flag_var} "${${flag_var}}") + + # Prevent D9025 warning for targets that have exception handling + # turned off (/EHs-c- flag). Where required, exceptions are explicitly + # re-enabled using the cxx_exception_flags variable. + string(REPLACE "/EHsc" "" ${flag_var} "${${flag_var}}") endforeach() endif() endmacro() -- cgit v1.2.3 From c38f4b9f2c542d16611b59e37b5e4d2ec0c8f924 Mon Sep 17 00:00:00 2001 From: Gennadiy Civil Date: Thu, 16 Aug 2018 13:18:13 -0400 Subject: Small style changes. Just small style changes and we can accept this PR --- googletest/src/gtest-port.cc | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/googletest/src/gtest-port.cc b/googletest/src/gtest-port.cc index f6bc125c..fecb5d11 100644 --- a/googletest/src/gtest-port.cc +++ b/googletest/src/gtest-port.cc @@ -296,8 +296,8 @@ void Mutex::AssertHeld() { namespace { -// Use the RAII idiom to flag mem allocs that are intentionally never -// deallocated. The motivation is to silence the false positive mem leaks +// Use the RAII idiom to flag mem allocs that are intentionally never +// deallocated. The motivation is to silence the false positive mem leaks // that are reported by the debug version of MS's CRT which can only detect // if an alloc is missing a matching deallocation. // Example: @@ -306,24 +306,24 @@ namespace { // class MemoryIsNotDeallocated { -public: + public: MemoryIsNotDeallocated() : old_crtdbg_flag_(0) { #ifdef _MSC_VER old_crtdbg_flag_ = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG); // Set heap allocation block type to _IGNORE_BLOCK so that MS debug CRT // doesn't report mem leak if there's no matching deallocation. _CrtSetDbgFlag(old_crtdbg_flag_ & ~_CRTDBG_ALLOC_MEM_DF); -#endif // _MSC_VER +#endif // _MSC_VER } ~MemoryIsNotDeallocated() { #ifdef _MSC_VER // Restore the original _CRTDBG_ALLOC_MEM_DF flag _CrtSetDbgFlag(old_crtdbg_flag_); -#endif // _MSC_VER +#endif // _MSC_VER } -private: + private: int old_crtdbg_flag_; GTEST_DISALLOW_COPY_AND_ASSIGN_(MemoryIsNotDeallocated); @@ -584,17 +584,11 @@ class ThreadLocalRegistryImpl { return 0; } - // Return a newly constructed ThreadIdToThreadLocals that's intentionally never deleted - static ThreadIdToThreadLocals* NewThreadIdToThreadLocals() { - // Use RAII to flag that following mem alloc is never deallocated. - MemoryIsNotDeallocated memory_is_not_deallocated; - return new ThreadIdToThreadLocals; - } - // Returns map of thread local instances. static ThreadIdToThreadLocals* GetThreadLocalsMapLocked() { mutex_.AssertHeld(); - static ThreadIdToThreadLocals* map = NewThreadIdToThreadLocals(); + MemoryIsNotDeallocated memory_is_not_deallocated; + static ThreadIdToThreadLocals* map = new ThreadIdToThreadLocals(); return map; } -- cgit v1.2.3 From b1bfdf0bf48bb2288ba73bc8f423de2831e0032f Mon Sep 17 00:00:00 2001 From: Gennadiy Civil Date: Thu, 16 Aug 2018 15:10:07 -0400 Subject: Small formatting change And then we can merge --- googletest/include/gtest/internal/gtest-port.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/googletest/include/gtest/internal/gtest-port.h b/googletest/include/gtest/internal/gtest-port.h index 1d5b24b8..786497d8 100644 --- a/googletest/include/gtest/internal/gtest-port.h +++ b/googletest/include/gtest/internal/gtest-port.h @@ -2107,8 +2107,8 @@ class MutexBase { // particular, the owner_ field (a pthread_t) is not explicitly initialized. // This allows initialization to work whether pthread_t is a scalar or struct. // The flag -Wmissing-field-initializers must not be specified for this to work. -# define GTEST_DEFINE_STATIC_MUTEX_(mutex) \ - ::testing::internal::MutexBase mutex = { PTHREAD_MUTEX_INITIALIZER, false, 0 } +#define GTEST_DEFINE_STATIC_MUTEX_(mutex) \ + ::testing::internal::MutexBase mutex = {PTHREAD_MUTEX_INITIALIZER, false, 0} // The Mutex class can only be used for mutexes created at runtime. It // shares its API with MutexBase otherwise. -- cgit v1.2.3 -- cgit v1.2.3 From 88cd66513c6414cdc6f1d4f7733bd520337864a9 Mon Sep 17 00:00:00 2001 From: Gennadiy Civil Date: Fri, 17 Aug 2018 13:25:52 -0400 Subject: Minor formatting/style changes --- googletest/src/gtest.cc | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/googletest/src/gtest.cc b/googletest/src/gtest.cc index 7832aa31..a229549f 100644 --- a/googletest/src/gtest.cc +++ b/googletest/src/gtest.cc @@ -138,11 +138,10 @@ # define vsnprintf _vsnprintf #endif // GTEST_OS_WINDOWS - #if GTEST_OS_MAC -# ifndef GTEST_OS_IOS -# include -# endif +#ifndef GTEST_OS_IOS +#include +#endif #endif #if GTEST_HAS_ABSL @@ -5832,16 +5831,16 @@ void ParseGoogleTestFlagsOnlyImpl(int* argc, CharType** argv) { // other parts of Google Test. void ParseGoogleTestFlagsOnly(int* argc, char** argv) { ParseGoogleTestFlagsOnlyImpl(argc, argv); - - // Fix the value of *_NSGetArgc() on macOS, but iff + + // Fix the value of *_NSGetArgc() on macOS, but iff // *_NSGetArgv() == argv // Only applicable to char** version of argv #if GTEST_OS_MAC -# ifndef GTEST_OS_IOS +#ifndef GTEST_OS_IOS if (*_NSGetArgv() == argv) { *_NSGetArgc() = *argc; } -# endif +#endif #endif } void ParseGoogleTestFlagsOnly(int* argc, wchar_t** argv) { -- cgit v1.2.3 From cda442da0b6027bdaf3b37e4df1b1b280e5732ab Mon Sep 17 00:00:00 2001 From: Gennadiy Civil Date: Fri, 17 Aug 2018 13:44:48 -0400 Subject: Formatting --- googletest/include/gtest/gtest-printers.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/googletest/include/gtest/gtest-printers.h b/googletest/include/gtest/gtest-printers.h index 491bcc9c..51865f84 100644 --- a/googletest/include/gtest/gtest-printers.h +++ b/googletest/include/gtest/gtest-printers.h @@ -978,12 +978,13 @@ struct TuplePolicy { static const size_t tuple_size = ::std::tr1::tuple_size::value; template - struct tuple_element : ::std::tr1::tuple_element(I), Tuple> {}; + struct tuple_element : ::std::tr1::tuple_element(I), Tuple> { + }; template - static typename AddReference< - const typename ::std::tr1::tuple_element(I), Tuple>::type>::type get( - const Tuple& tuple) { + static typename AddReference(I), Tuple>::type>::type + get(const Tuple& tuple) { return ::std::tr1::get(tuple); } }; -- cgit v1.2.3 From 079641531492b0f5b87e08278aa229d047bea1e5 Mon Sep 17 00:00:00 2001 From: Vadim Berezniker Date: Fri, 17 Aug 2018 10:49:10 -0700 Subject: std references shouldn't be fully qualified --- googletest/docs/advanced.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/googletest/docs/advanced.md b/googletest/docs/advanced.md index 0a92e524..3a097f1b 100644 --- a/googletest/docs/advanced.md +++ b/googletest/docs/advanced.md @@ -572,7 +572,7 @@ namespace foo { class Bar { // We want googletest to be able to print instances of this. ... // Create a free inline friend function. - friend ::std::ostream& operator<<(::std::ostream& os, const Bar& bar) { + friend std::ostream& operator<<(std::ostream& os, const Bar& bar) { return os << bar.DebugString(); // whatever needed to print bar to os } }; @@ -580,7 +580,7 @@ class Bar { // We want googletest to be able to print instances of this. // If you can't declare the function in the class it's important that the // << operator is defined in the SAME namespace that defines Bar. C++'s look-up // rules rely on that. -::std::ostream& operator<<(::std::ostream& os, const Bar& bar) { +std::ostream& operator<<(std::ostream& os, const Bar& bar) { return os << bar.DebugString(); // whatever needed to print bar to os } @@ -601,7 +601,7 @@ namespace foo { class Bar { ... - friend void PrintTo(const Bar& bar, ::std::ostream* os) { + friend void PrintTo(const Bar& bar, std::ostream* os) { *os << bar.DebugString(); // whatever needed to print bar to os } }; @@ -609,7 +609,7 @@ class Bar { // If you can't declare the function in the class it's important that PrintTo() // is defined in the SAME namespace that defines Bar. C++'s look-up rules rely // on that. -void PrintTo(const Bar& bar, ::std::ostream* os) { +void PrintTo(const Bar& bar, std::ostream* os) { *os << bar.DebugString(); // whatever needed to print bar to os } -- cgit v1.2.3 From 02c4f1af9d3cebdb963387a9450f33d22cc29e8f Mon Sep 17 00:00:00 2001 From: Vadim Kotov Date: Mon, 20 Aug 2018 15:31:55 +0300 Subject: docs: fixed broken references to sections in Advanced guide --- googletest/docs/advanced.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/googletest/docs/advanced.md b/googletest/docs/advanced.md index 3a097f1b..599b8fb7 100644 --- a/googletest/docs/advanced.md +++ b/googletest/docs/advanced.md @@ -649,7 +649,7 @@ _death tests_. More generally, any test that checks that a program terminates Note that if a piece of code throws an exception, we don't consider it "death" for the purpose of death tests, as the caller of the code could catch the exception and avoid the crash. If you want to verify exceptions thrown by your -code, see [Exception Assertions](#ExceptionAssertions). +code, see [Exception Assertions](#exception-assertions). If you want to test `EXPECT_*()/ASSERT_*()` failures in your test code, see Catching Failures @@ -2120,7 +2120,7 @@ $ foo_test --gtest_repeat=1000 --gtest_filter=FooBar.* Repeat the tests whose name matches the filter 1000 times. ``` -If your test program contains [global set-up/tear-down](#GlobalSetUp) code, it +If your test program contains [global set-up/tear-down](#global-set-up-and-tear-down) code, it will be repeated in each iteration as well, as the flakiness may be in it. You can also specify the repeat count by setting the `GTEST_REPEAT` environment variable. -- cgit v1.2.3 From ddc618ab31c8b683b52e26304bfd7bd9b4a3bb0f Mon Sep 17 00:00:00 2001 From: Vadim Kotov Date: Mon, 20 Aug 2018 16:20:14 +0300 Subject: docs: fix more broken links to sections in Advanced guide --- googletest/docs/advanced.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/googletest/docs/advanced.md b/googletest/docs/advanced.md index 599b8fb7..8065d196 100644 --- a/googletest/docs/advanced.md +++ b/googletest/docs/advanced.md @@ -1147,7 +1147,7 @@ test has at least one failure of either kind. In your test code, you can call `RecordProperty("key", value)` to log additional information, where `value` can be either a string or an `int`. The *last* value -recorded for a key will be emitted to the [XML output](#XmlReport) if you +recorded for a key will be emitted to the [XML output](#generating-an-xml-report) if you specify one. For example, the test ```c++ @@ -1424,7 +1424,7 @@ will have these names: * `InstantiationName/FooTest.HasBlahBlah/1` for `"miny"` * `InstantiationName/FooTest.HasBlahBlah/2` for `"moe"` -You can use these names in [`--gtest_filter`](#TestFilter). +You can use these names in [`--gtest_filter`](#running-a-subset-of-the-tests). This statement will instantiate all tests from `FooTest` again, each with parameter values `"cat"` and `"dog"`: @@ -1674,7 +1674,7 @@ To test them, we use the following special techniques: * Both static functions and definitions/declarations in an unnamed namespace are only visible within the same translation unit. To test them, you can `#include` the entire `.cc` file being tested in your `*_test.cc` file. - (#including `.cc` files is not a good way to reuse code - you should not do + (including `.cc` files is not a good way to reuse code - you should not do this in production code!) However, a better approach is to move the private code into the -- cgit v1.2.3 From 72a810596642bceff31b33ea2588902c66fa8e08 Mon Sep 17 00:00:00 2001 From: Gennadiy Civil Date: Mon, 20 Aug 2018 14:10:58 -0400 Subject: Testing, adding to sample4 unittest --- mybuild/CMakeCache.txt | 491 ++++++++++++++++++++++++++++ mybuild/Testing/Temporary/CTestCostData.txt | 1 + mybuild/Testing/Temporary/LastTest.log | 3 + mybuild/googlemock/gmock.pc | 9 + mybuild/googlemock/gmock_main.pc | 9 + mybuild/googlemock/gtest/gtest.pc | 9 + mybuild/googlemock/gtest/gtest_main.pc | 10 + mybuild/googlemock/gtest/libgtest.a | Bin 0 -> 1849908 bytes mybuild/googlemock/gtest/libgtest_main.a | Bin 0 -> 4124 bytes mybuild/googlemock/gtest/sample4_unittest | Bin 0 -> 1006728 bytes 10 files changed, 532 insertions(+) create mode 100644 mybuild/CMakeCache.txt create mode 100644 mybuild/Testing/Temporary/CTestCostData.txt create mode 100644 mybuild/Testing/Temporary/LastTest.log create mode 100644 mybuild/googlemock/gmock.pc create mode 100644 mybuild/googlemock/gmock_main.pc create mode 100644 mybuild/googlemock/gtest/gtest.pc create mode 100644 mybuild/googlemock/gtest/gtest_main.pc create mode 100644 mybuild/googlemock/gtest/libgtest.a create mode 100644 mybuild/googlemock/gtest/libgtest_main.a create mode 100755 mybuild/googlemock/gtest/sample4_unittest diff --git a/mybuild/CMakeCache.txt b/mybuild/CMakeCache.txt new file mode 100644 index 00000000..7ce5e871 --- /dev/null +++ b/mybuild/CMakeCache.txt @@ -0,0 +1,491 @@ +# This is the CMakeCache file. +# For build in directory: /usr/local/google/home/misterg/projects/MY_FORKS/googletest/mybuild +# It was generated by CMake: /usr/bin/cmake +# You can edit this file to change values found and used by cmake. +# If you do not want to change any of the values, simply exit the editor. +# If you do want to change a value, simply edit, save, and exit the editor. +# The syntax for the file is as follows: +# KEY:TYPE=VALUE +# KEY is the name of a variable in the cache. +# TYPE is a hint to GUIs for the type of VALUE, DO NOT EDIT TYPE!. +# VALUE is the current value for the KEY. + +######################## +# EXTERNAL cache entries +######################## + +//Builds the googlemock subproject +BUILD_GMOCK:BOOL=ON + +//Builds the googletest subproject +BUILD_GTEST:BOOL=OFF + +//Build shared libraries (DLLs). +BUILD_SHARED_LIBS:BOOL=OFF + +//Path to a program. +CMAKE_AR:FILEPATH=/usr/bin/ar + +//Choose the type of build, options are: None(CMAKE_CXX_FLAGS or +// CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel. +CMAKE_BUILD_TYPE:STRING= + +//Enable/Disable color output during build. +CMAKE_COLOR_MAKEFILE:BOOL=ON + +//CXX compiler +CMAKE_CXX_COMPILER:FILEPATH=/usr/bin/c++ + +//A wrapper around 'ar' adding the appropriate '--plugin' option +// for the GCC compiler +CMAKE_CXX_COMPILER_AR:FILEPATH=/usr/bin/gcc-ar-7 + +//A wrapper around 'ranlib' adding the appropriate '--plugin' option +// for the GCC compiler +CMAKE_CXX_COMPILER_RANLIB:FILEPATH=/usr/bin/gcc-ranlib-7 + +//Flags used by the compiler during all build types. +CMAKE_CXX_FLAGS:STRING= + +//Flags used by the compiler during debug builds. +CMAKE_CXX_FLAGS_DEBUG:STRING=-g + +//Flags used by the compiler during release builds for minimum +// size. +CMAKE_CXX_FLAGS_MINSIZEREL:STRING=-Os -DNDEBUG + +//Flags used by the compiler during release builds. +CMAKE_CXX_FLAGS_RELEASE:STRING=-O3 -DNDEBUG + +//Flags used by the compiler during release builds with debug info. +CMAKE_CXX_FLAGS_RELWITHDEBINFO:STRING=-O2 -g -DNDEBUG + +//C compiler +CMAKE_C_COMPILER:FILEPATH=/usr/bin/cc + +//A wrapper around 'ar' adding the appropriate '--plugin' option +// for the GCC compiler +CMAKE_C_COMPILER_AR:FILEPATH=/usr/bin/gcc-ar-7 + +//A wrapper around 'ranlib' adding the appropriate '--plugin' option +// for the GCC compiler +CMAKE_C_COMPILER_RANLIB:FILEPATH=/usr/bin/gcc-ranlib-7 + +//Flags used by the compiler during all build types. +CMAKE_C_FLAGS:STRING= + +//Flags used by the compiler during debug builds. +CMAKE_C_FLAGS_DEBUG:STRING=-g + +//Flags used by the compiler during release builds for minimum +// size. +CMAKE_C_FLAGS_MINSIZEREL:STRING=-Os -DNDEBUG + +//Flags used by the compiler during release builds. +CMAKE_C_FLAGS_RELEASE:STRING=-O3 -DNDEBUG + +//Flags used by the compiler during release builds with debug info. +CMAKE_C_FLAGS_RELWITHDEBINFO:STRING=-O2 -g -DNDEBUG + +//Flags used by the linker. +CMAKE_EXE_LINKER_FLAGS:STRING= + +//Flags used by the linker during debug builds. +CMAKE_EXE_LINKER_FLAGS_DEBUG:STRING= + +//Flags used by the linker during release minsize builds. +CMAKE_EXE_LINKER_FLAGS_MINSIZEREL:STRING= + +//Flags used by the linker during release builds. +CMAKE_EXE_LINKER_FLAGS_RELEASE:STRING= + +//Flags used by the linker during Release with Debug Info builds. +CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO:STRING= + +//Enable/Disable output of compile commands during generation. +CMAKE_EXPORT_COMPILE_COMMANDS:BOOL=OFF + +//User executables (bin) +CMAKE_INSTALL_BINDIR:PATH=bin + +//Read-only architecture-independent data (DATAROOTDIR) +CMAKE_INSTALL_DATADIR:PATH= + +//Read-only architecture-independent data root (share) +CMAKE_INSTALL_DATAROOTDIR:PATH=share + +//Documentation root (DATAROOTDIR/doc/PROJECT_NAME) +CMAKE_INSTALL_DOCDIR:PATH= + +//C header files (include) +CMAKE_INSTALL_INCLUDEDIR:PATH=include + +//Info documentation (DATAROOTDIR/info) +CMAKE_INSTALL_INFODIR:PATH= + +//Object code libraries (lib) +CMAKE_INSTALL_LIBDIR:PATH=lib + +//Program executables (libexec) +CMAKE_INSTALL_LIBEXECDIR:PATH=libexec + +//Locale-dependent data (DATAROOTDIR/locale) +CMAKE_INSTALL_LOCALEDIR:PATH= + +//Modifiable single-machine data (var) +CMAKE_INSTALL_LOCALSTATEDIR:PATH=var + +//Man documentation (DATAROOTDIR/man) +CMAKE_INSTALL_MANDIR:PATH= + +//C header files for non-gcc (/usr/include) +CMAKE_INSTALL_OLDINCLUDEDIR:PATH=/usr/include + +//Install path prefix, prepended onto install directories. +CMAKE_INSTALL_PREFIX:PATH=/usr/local + +//Run-time variable data (LOCALSTATEDIR/run) +CMAKE_INSTALL_RUNSTATEDIR:PATH= + +//System admin executables (sbin) +CMAKE_INSTALL_SBINDIR:PATH=sbin + +//Modifiable architecture-independent data (com) +CMAKE_INSTALL_SHAREDSTATEDIR:PATH=com + +//Read-only single-machine data (etc) +CMAKE_INSTALL_SYSCONFDIR:PATH=etc + +//Path to a program. +CMAKE_LINKER:FILEPATH=/usr/bin/ld + +//Path to a program. +CMAKE_MAKE_PROGRAM:FILEPATH=/usr/bin/make + +//Flags used by the linker during the creation of modules. +CMAKE_MODULE_LINKER_FLAGS:STRING= + +//Flags used by the linker during debug builds. +CMAKE_MODULE_LINKER_FLAGS_DEBUG:STRING= + +//Flags used by the linker during release minsize builds. +CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL:STRING= + +//Flags used by the linker during release builds. +CMAKE_MODULE_LINKER_FLAGS_RELEASE:STRING= + +//Flags used by the linker during Release with Debug Info builds. +CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO:STRING= + +//Path to a program. +CMAKE_NM:FILEPATH=/usr/bin/nm + +//Path to a program. +CMAKE_OBJCOPY:FILEPATH=/usr/bin/objcopy + +//Path to a program. +CMAKE_OBJDUMP:FILEPATH=/usr/bin/objdump + +//Value Computed by CMake +CMAKE_PROJECT_NAME:STATIC=googletest-distribution + +//Path to a program. +CMAKE_RANLIB:FILEPATH=/usr/bin/ranlib + +//Flags used by the linker during the creation of dll's. +CMAKE_SHARED_LINKER_FLAGS:STRING= + +//Flags used by the linker during debug builds. +CMAKE_SHARED_LINKER_FLAGS_DEBUG:STRING= + +//Flags used by the linker during release minsize builds. +CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL:STRING= + +//Flags used by the linker during release builds. +CMAKE_SHARED_LINKER_FLAGS_RELEASE:STRING= + +//Flags used by the linker during Release with Debug Info builds. +CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO:STRING= + +//If set, runtime paths are not added when installing shared libraries, +// but are added when building. +CMAKE_SKIP_INSTALL_RPATH:BOOL=NO + +//If set, runtime paths are not added when using shared libraries. +CMAKE_SKIP_RPATH:BOOL=NO + +//Flags used by the linker during the creation of static libraries. +CMAKE_STATIC_LINKER_FLAGS:STRING= + +//Flags used by the linker during debug builds. +CMAKE_STATIC_LINKER_FLAGS_DEBUG:STRING= + +//Flags used by the linker during release minsize builds. +CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL:STRING= + +//Flags used by the linker during release builds. +CMAKE_STATIC_LINKER_FLAGS_RELEASE:STRING= + +//Flags used by the linker during Release with Debug Info builds. +CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO:STRING= + +//Path to a program. +CMAKE_STRIP:FILEPATH=/usr/bin/strip + +//If this value is on, makefiles will be generated without the +// .SILENT directive, and all commands will be echoed to the console +// during the make. This is useful for debugging only. With Visual +// Studio IDE projects all commands are done without /nologo. +CMAKE_VERBOSE_MAKEFILE:BOOL=FALSE + +//Enable installation of googlemock. (Projects embedding googlemock +// may want to turn this OFF.) +INSTALL_GMOCK:BOOL=ON + +//Enable installation of googletest. (Projects embedding googletest +// may want to turn this OFF.) +INSTALL_GTEST:BOOL=ON + +//Path to a program. +PYTHON_EXECUTABLE:FILEPATH=/usr/bin/python + +//Value Computed by CMake +gmock_BINARY_DIR:STATIC=/usr/local/google/home/misterg/projects/MY_FORKS/googletest/mybuild/googlemock + +//Dependencies for the target +gmock_LIB_DEPENDS:STATIC=general;-pthread;general;gtest; + +//Value Computed by CMake +gmock_SOURCE_DIR:STATIC=/usr/local/google/home/misterg/projects/MY_FORKS/googletest/googlemock + +//Build all of Google Mock's own tests. +gmock_build_tests:BOOL=OFF + +//Dependencies for the target +gmock_main_LIB_DEPENDS:STATIC=general;-pthread;general;gmock; + +//Value Computed by CMake +googletest-distribution_BINARY_DIR:STATIC=/usr/local/google/home/misterg/projects/MY_FORKS/googletest/mybuild + +//Value Computed by CMake +googletest-distribution_SOURCE_DIR:STATIC=/usr/local/google/home/misterg/projects/MY_FORKS/googletest + +//Value Computed by CMake +gtest_BINARY_DIR:STATIC=/usr/local/google/home/misterg/projects/MY_FORKS/googletest/mybuild/googlemock/gtest + +//Dependencies for the target +gtest_LIB_DEPENDS:STATIC=general;-pthread; + +//Value Computed by CMake +gtest_SOURCE_DIR:STATIC=/usr/local/google/home/misterg/projects/MY_FORKS/googletest/googletest + +//Build gtest's sample programs. +gtest_build_samples:BOOL=ON + +//Build all of gtest's own tests. +gtest_build_tests:BOOL=OFF + +//Disable uses of pthreads in gtest. +gtest_disable_pthreads:BOOL=OFF + +//Use shared (DLL) run-time lib even when Google Test is built +// as static lib. +gtest_force_shared_crt:BOOL=OFF + +//Build gtest with internal symbols hidden in shared libraries. +gtest_hide_internal_symbols:BOOL=OFF + +//Dependencies for the target +gtest_main_LIB_DEPENDS:STATIC=general;-pthread;general;gtest; + + +######################## +# INTERNAL cache entries +######################## + +//ADVANCED property for variable: CMAKE_AR +CMAKE_AR-ADVANCED:INTERNAL=1 +//This is the directory where this CMakeCache.txt was created +CMAKE_CACHEFILE_DIR:INTERNAL=/usr/local/google/home/misterg/projects/MY_FORKS/googletest/mybuild +//Major version of cmake used to create the current loaded cache +CMAKE_CACHE_MAJOR_VERSION:INTERNAL=3 +//Minor version of cmake used to create the current loaded cache +CMAKE_CACHE_MINOR_VERSION:INTERNAL=9 +//Patch version of cmake used to create the current loaded cache +CMAKE_CACHE_PATCH_VERSION:INTERNAL=0 +//ADVANCED property for variable: CMAKE_COLOR_MAKEFILE +CMAKE_COLOR_MAKEFILE-ADVANCED:INTERNAL=1 +//Path to CMake executable. +CMAKE_COMMAND:INTERNAL=/usr/bin/cmake +//Path to cpack program executable. +CMAKE_CPACK_COMMAND:INTERNAL=/usr/bin/cpack +//Path to ctest program executable. +CMAKE_CTEST_COMMAND:INTERNAL=/usr/bin/ctest +//ADVANCED property for variable: CMAKE_CXX_COMPILER +CMAKE_CXX_COMPILER-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_CXX_COMPILER_AR +CMAKE_CXX_COMPILER_AR-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_CXX_COMPILER_RANLIB +CMAKE_CXX_COMPILER_RANLIB-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_CXX_FLAGS +CMAKE_CXX_FLAGS-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_CXX_FLAGS_DEBUG +CMAKE_CXX_FLAGS_DEBUG-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_CXX_FLAGS_MINSIZEREL +CMAKE_CXX_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_CXX_FLAGS_RELEASE +CMAKE_CXX_FLAGS_RELEASE-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_CXX_FLAGS_RELWITHDEBINFO +CMAKE_CXX_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_COMPILER +CMAKE_C_COMPILER-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_COMPILER_AR +CMAKE_C_COMPILER_AR-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_COMPILER_RANLIB +CMAKE_C_COMPILER_RANLIB-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_FLAGS +CMAKE_C_FLAGS-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_FLAGS_DEBUG +CMAKE_C_FLAGS_DEBUG-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_FLAGS_MINSIZEREL +CMAKE_C_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_FLAGS_RELEASE +CMAKE_C_FLAGS_RELEASE-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_FLAGS_RELWITHDEBINFO +CMAKE_C_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 +//Path to cache edit program executable. +CMAKE_EDIT_COMMAND:INTERNAL=/usr/bin/ccmake +//Executable file format +CMAKE_EXECUTABLE_FORMAT:INTERNAL=ELF +//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS +CMAKE_EXE_LINKER_FLAGS-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_DEBUG +CMAKE_EXE_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_MINSIZEREL +CMAKE_EXE_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_RELEASE +CMAKE_EXE_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO +CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_EXPORT_COMPILE_COMMANDS +CMAKE_EXPORT_COMPILE_COMMANDS-ADVANCED:INTERNAL=1 +//Name of external makefile project generator. +CMAKE_EXTRA_GENERATOR:INTERNAL= +//Name of generator. +CMAKE_GENERATOR:INTERNAL=Unix Makefiles +//Name of generator platform. +CMAKE_GENERATOR_PLATFORM:INTERNAL= +//Name of generator toolset. +CMAKE_GENERATOR_TOOLSET:INTERNAL= +//Have symbol pthread_create +CMAKE_HAVE_LIBC_CREATE:INTERNAL= +//Have include pthread.h +CMAKE_HAVE_PTHREAD_H:INTERNAL=1 +//Source directory with the top level CMakeLists.txt file for this +// project +CMAKE_HOME_DIRECTORY:INTERNAL=/usr/local/google/home/misterg/projects/MY_FORKS/googletest +//ADVANCED property for variable: CMAKE_INSTALL_BINDIR +CMAKE_INSTALL_BINDIR-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_INSTALL_DATADIR +CMAKE_INSTALL_DATADIR-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_INSTALL_DATAROOTDIR +CMAKE_INSTALL_DATAROOTDIR-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_INSTALL_DOCDIR +CMAKE_INSTALL_DOCDIR-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_INSTALL_INCLUDEDIR +CMAKE_INSTALL_INCLUDEDIR-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_INSTALL_INFODIR +CMAKE_INSTALL_INFODIR-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_INSTALL_LIBDIR +CMAKE_INSTALL_LIBDIR-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_INSTALL_LIBEXECDIR +CMAKE_INSTALL_LIBEXECDIR-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_INSTALL_LOCALEDIR +CMAKE_INSTALL_LOCALEDIR-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_INSTALL_LOCALSTATEDIR +CMAKE_INSTALL_LOCALSTATEDIR-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_INSTALL_MANDIR +CMAKE_INSTALL_MANDIR-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_INSTALL_OLDINCLUDEDIR +CMAKE_INSTALL_OLDINCLUDEDIR-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_INSTALL_RUNSTATEDIR +CMAKE_INSTALL_RUNSTATEDIR-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_INSTALL_SBINDIR +CMAKE_INSTALL_SBINDIR-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_INSTALL_SHAREDSTATEDIR +CMAKE_INSTALL_SHAREDSTATEDIR-ADVANCED:INTERNAL=1 +//Install .so files without execute permission. +CMAKE_INSTALL_SO_NO_EXE:INTERNAL=1 +//ADVANCED property for variable: CMAKE_INSTALL_SYSCONFDIR +CMAKE_INSTALL_SYSCONFDIR-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_LINKER +CMAKE_LINKER-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_MAKE_PROGRAM +CMAKE_MAKE_PROGRAM-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS +CMAKE_MODULE_LINKER_FLAGS-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_DEBUG +CMAKE_MODULE_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL +CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_RELEASE +CMAKE_MODULE_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO +CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_NM +CMAKE_NM-ADVANCED:INTERNAL=1 +//number of local generators +CMAKE_NUMBER_OF_MAKEFILES:INTERNAL=3 +//ADVANCED property for variable: CMAKE_OBJCOPY +CMAKE_OBJCOPY-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_OBJDUMP +CMAKE_OBJDUMP-ADVANCED:INTERNAL=1 +//Platform information initialized +CMAKE_PLATFORM_INFO_INITIALIZED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_RANLIB +CMAKE_RANLIB-ADVANCED:INTERNAL=1 +//Path to CMake installation. +CMAKE_ROOT:INTERNAL=/usr/share/cmake-3.9 +//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS +CMAKE_SHARED_LINKER_FLAGS-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_DEBUG +CMAKE_SHARED_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL +CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_RELEASE +CMAKE_SHARED_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO +CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_SKIP_INSTALL_RPATH +CMAKE_SKIP_INSTALL_RPATH-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_SKIP_RPATH +CMAKE_SKIP_RPATH-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS +CMAKE_STATIC_LINKER_FLAGS-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_DEBUG +CMAKE_STATIC_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL +CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_RELEASE +CMAKE_STATIC_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO +CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_STRIP +CMAKE_STRIP-ADVANCED:INTERNAL=1 +//uname command +CMAKE_UNAME:INTERNAL=/bin/uname +//ADVANCED property for variable: CMAKE_VERBOSE_MAKEFILE +CMAKE_VERBOSE_MAKEFILE-ADVANCED:INTERNAL=1 +//Details about finding PythonInterp +FIND_PACKAGE_MESSAGE_DETAILS_PythonInterp:INTERNAL=[/usr/bin/python][v2.7.13()] +//Details about finding Threads +FIND_PACKAGE_MESSAGE_DETAILS_Threads:INTERNAL=[TRUE][v()] +//ADVANCED property for variable: PYTHON_EXECUTABLE +PYTHON_EXECUTABLE-ADVANCED:INTERNAL=1 +//Result of TRY_COMPILE +THREADS_HAVE_PTHREAD_ARG:INTERNAL=TRUE +//Result of TRY_RUN +THREADS_PTHREAD_ARG:INTERNAL=2 +//CMAKE_INSTALL_PREFIX during last run +_GNUInstallDirs_LAST_CMAKE_INSTALL_PREFIX:INTERNAL=/usr/local + diff --git a/mybuild/Testing/Temporary/CTestCostData.txt b/mybuild/Testing/Temporary/CTestCostData.txt new file mode 100644 index 00000000..ed97d539 --- /dev/null +++ b/mybuild/Testing/Temporary/CTestCostData.txt @@ -0,0 +1 @@ +--- diff --git a/mybuild/Testing/Temporary/LastTest.log b/mybuild/Testing/Temporary/LastTest.log new file mode 100644 index 00000000..c95a7c3a --- /dev/null +++ b/mybuild/Testing/Temporary/LastTest.log @@ -0,0 +1,3 @@ +Start testing: Aug 20 14:07 EDT +---------------------------------------------------------- +End testing: Aug 20 14:07 EDT diff --git a/mybuild/googlemock/gmock.pc b/mybuild/googlemock/gmock.pc new file mode 100644 index 00000000..d4242cfa --- /dev/null +++ b/mybuild/googlemock/gmock.pc @@ -0,0 +1,9 @@ +libdir=/usr/local/lib +includedir=/usr/local/include + +Name: gmock +Description: GoogleMock (without main() function) +Version: 1.9.0 +URL: https://github.com/google/googletest +Libs: -L${libdir} -lgmock -pthread +Cflags: -I${includedir} -DGTEST_HAS_PTHREAD=1 -pthread diff --git a/mybuild/googlemock/gmock_main.pc b/mybuild/googlemock/gmock_main.pc new file mode 100644 index 00000000..2da4fbcc --- /dev/null +++ b/mybuild/googlemock/gmock_main.pc @@ -0,0 +1,9 @@ +libdir=/usr/local/lib +includedir=/usr/local/include + +Name: gmock_main +Description: GoogleMock (with main() function) +Version: 1.9.0 +URL: https://github.com/google/googletest +Libs: -L${libdir} -lgmock_main -pthread +Cflags: -I${includedir} -DGTEST_HAS_PTHREAD=1 -pthread diff --git a/mybuild/googlemock/gtest/gtest.pc b/mybuild/googlemock/gtest/gtest.pc new file mode 100644 index 00000000..a9931b8b --- /dev/null +++ b/mybuild/googlemock/gtest/gtest.pc @@ -0,0 +1,9 @@ +libdir=/usr/local/lib +includedir=/usr/local/include + +Name: gtest +Description: GoogleTest (without main() function) +Version: 1.9.0 +URL: https://github.com/google/googletest +Libs: -L${libdir} -lgtest -pthread +Cflags: -I${includedir} -DGTEST_HAS_PTHREAD=1 -pthread diff --git a/mybuild/googlemock/gtest/gtest_main.pc b/mybuild/googlemock/gtest/gtest_main.pc new file mode 100644 index 00000000..57948c76 --- /dev/null +++ b/mybuild/googlemock/gtest/gtest_main.pc @@ -0,0 +1,10 @@ +libdir=/usr/local/lib +includedir=/usr/local/include + +Name: gtest_main +Description: GoogleTest (with main() function) +Version: 1.9.0 +URL: https://github.com/google/googletest +Requires: gtest +Libs: -L${libdir} -lgtest_main -pthread +Cflags: -I${includedir} -DGTEST_HAS_PTHREAD=1 -pthread diff --git a/mybuild/googlemock/gtest/libgtest.a b/mybuild/googlemock/gtest/libgtest.a new file mode 100644 index 00000000..46029a9b Binary files /dev/null and b/mybuild/googlemock/gtest/libgtest.a differ diff --git a/mybuild/googlemock/gtest/libgtest_main.a b/mybuild/googlemock/gtest/libgtest_main.a new file mode 100644 index 00000000..f76d51ce Binary files /dev/null and b/mybuild/googlemock/gtest/libgtest_main.a differ diff --git a/mybuild/googlemock/gtest/sample4_unittest b/mybuild/googlemock/gtest/sample4_unittest new file mode 100755 index 00000000..b4355c0a Binary files /dev/null and b/mybuild/googlemock/gtest/sample4_unittest differ -- cgit v1.2.3 From cfc0d5fb0c59b6e15a991f21cf970e557a698e22 Mon Sep 17 00:00:00 2001 From: Gennadiy Civil Date: Mon, 20 Aug 2018 14:17:38 -0400 Subject: Testing, adding a few line to sample4 --- googletest/samples/sample4.cc | 10 + googletest/samples/sample4.h | 4 + googletest/samples/sample4_unittest.cc | 7 + mybuild/CMakeCache.txt | 491 ---------------------------- mybuild/Testing/Temporary/CTestCostData.txt | 1 - mybuild/Testing/Temporary/LastTest.log | 3 - mybuild/googlemock/gmock.pc | 9 - mybuild/googlemock/gmock_main.pc | 9 - mybuild/googlemock/gtest/gtest.pc | 9 - mybuild/googlemock/gtest/gtest_main.pc | 10 - mybuild/googlemock/gtest/libgtest.a | Bin 1849908 -> 0 bytes mybuild/googlemock/gtest/libgtest_main.a | Bin 4124 -> 0 bytes mybuild/googlemock/gtest/sample4_unittest | Bin 1006728 -> 0 bytes 13 files changed, 21 insertions(+), 532 deletions(-) delete mode 100644 mybuild/CMakeCache.txt delete mode 100644 mybuild/Testing/Temporary/CTestCostData.txt delete mode 100644 mybuild/Testing/Temporary/LastTest.log delete mode 100644 mybuild/googlemock/gmock.pc delete mode 100644 mybuild/googlemock/gmock_main.pc delete mode 100644 mybuild/googlemock/gtest/gtest.pc delete mode 100644 mybuild/googlemock/gtest/gtest_main.pc delete mode 100644 mybuild/googlemock/gtest/libgtest.a delete mode 100644 mybuild/googlemock/gtest/libgtest_main.a delete mode 100755 mybuild/googlemock/gtest/sample4_unittest diff --git a/googletest/samples/sample4.cc b/googletest/samples/sample4.cc index 2f7c87aa..724bcb54 100644 --- a/googletest/samples/sample4.cc +++ b/googletest/samples/sample4.cc @@ -38,6 +38,16 @@ int Counter::Increment() { return counter_++; } +// Returns the current counter value, and decrements it. +// counter can not be less than 0, return 0 in this case + int Counter::Decrement() { + if (counter_==0){ + return counter_; + } + else + return counter_--; + } + // Prints the current counter value to STDOUT. void Counter::Print() const { printf("%d", counter_); diff --git a/googletest/samples/sample4.h b/googletest/samples/sample4.h index fda5f335..a9679ff1 100644 --- a/googletest/samples/sample4.h +++ b/googletest/samples/sample4.h @@ -43,6 +43,10 @@ class Counter { // Returns the current counter value, and increments it. int Increment(); +// Returns the current counter value, and decrements it. + int Decrement(); + + // Prints the current counter value to STDOUT. void Print() const; }; diff --git a/googletest/samples/sample4_unittest.cc b/googletest/samples/sample4_unittest.cc index 079a70d8..ee655c66 100644 --- a/googletest/samples/sample4_unittest.cc +++ b/googletest/samples/sample4_unittest.cc @@ -37,12 +37,19 @@ namespace { TEST(Counter, Increment) { Counter c; + // Test that counter 0 returns 0 + EXPECT_EQ(0, c.Decrement()); + + // EXPECT_EQ() evaluates its arguments exactly once, so they // can have side effects. EXPECT_EQ(0, c.Increment()); EXPECT_EQ(1, c.Increment()); EXPECT_EQ(2, c.Increment()); + + EXPECT_EQ(3, c.Decrement()); + } } // namespace diff --git a/mybuild/CMakeCache.txt b/mybuild/CMakeCache.txt deleted file mode 100644 index 7ce5e871..00000000 --- a/mybuild/CMakeCache.txt +++ /dev/null @@ -1,491 +0,0 @@ -# This is the CMakeCache file. -# For build in directory: /usr/local/google/home/misterg/projects/MY_FORKS/googletest/mybuild -# It was generated by CMake: /usr/bin/cmake -# You can edit this file to change values found and used by cmake. -# If you do not want to change any of the values, simply exit the editor. -# If you do want to change a value, simply edit, save, and exit the editor. -# The syntax for the file is as follows: -# KEY:TYPE=VALUE -# KEY is the name of a variable in the cache. -# TYPE is a hint to GUIs for the type of VALUE, DO NOT EDIT TYPE!. -# VALUE is the current value for the KEY. - -######################## -# EXTERNAL cache entries -######################## - -//Builds the googlemock subproject -BUILD_GMOCK:BOOL=ON - -//Builds the googletest subproject -BUILD_GTEST:BOOL=OFF - -//Build shared libraries (DLLs). -BUILD_SHARED_LIBS:BOOL=OFF - -//Path to a program. -CMAKE_AR:FILEPATH=/usr/bin/ar - -//Choose the type of build, options are: None(CMAKE_CXX_FLAGS or -// CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel. -CMAKE_BUILD_TYPE:STRING= - -//Enable/Disable color output during build. -CMAKE_COLOR_MAKEFILE:BOOL=ON - -//CXX compiler -CMAKE_CXX_COMPILER:FILEPATH=/usr/bin/c++ - -//A wrapper around 'ar' adding the appropriate '--plugin' option -// for the GCC compiler -CMAKE_CXX_COMPILER_AR:FILEPATH=/usr/bin/gcc-ar-7 - -//A wrapper around 'ranlib' adding the appropriate '--plugin' option -// for the GCC compiler -CMAKE_CXX_COMPILER_RANLIB:FILEPATH=/usr/bin/gcc-ranlib-7 - -//Flags used by the compiler during all build types. -CMAKE_CXX_FLAGS:STRING= - -//Flags used by the compiler during debug builds. -CMAKE_CXX_FLAGS_DEBUG:STRING=-g - -//Flags used by the compiler during release builds for minimum -// size. -CMAKE_CXX_FLAGS_MINSIZEREL:STRING=-Os -DNDEBUG - -//Flags used by the compiler during release builds. -CMAKE_CXX_FLAGS_RELEASE:STRING=-O3 -DNDEBUG - -//Flags used by the compiler during release builds with debug info. -CMAKE_CXX_FLAGS_RELWITHDEBINFO:STRING=-O2 -g -DNDEBUG - -//C compiler -CMAKE_C_COMPILER:FILEPATH=/usr/bin/cc - -//A wrapper around 'ar' adding the appropriate '--plugin' option -// for the GCC compiler -CMAKE_C_COMPILER_AR:FILEPATH=/usr/bin/gcc-ar-7 - -//A wrapper around 'ranlib' adding the appropriate '--plugin' option -// for the GCC compiler -CMAKE_C_COMPILER_RANLIB:FILEPATH=/usr/bin/gcc-ranlib-7 - -//Flags used by the compiler during all build types. -CMAKE_C_FLAGS:STRING= - -//Flags used by the compiler during debug builds. -CMAKE_C_FLAGS_DEBUG:STRING=-g - -//Flags used by the compiler during release builds for minimum -// size. -CMAKE_C_FLAGS_MINSIZEREL:STRING=-Os -DNDEBUG - -//Flags used by the compiler during release builds. -CMAKE_C_FLAGS_RELEASE:STRING=-O3 -DNDEBUG - -//Flags used by the compiler during release builds with debug info. -CMAKE_C_FLAGS_RELWITHDEBINFO:STRING=-O2 -g -DNDEBUG - -//Flags used by the linker. -CMAKE_EXE_LINKER_FLAGS:STRING= - -//Flags used by the linker during debug builds. -CMAKE_EXE_LINKER_FLAGS_DEBUG:STRING= - -//Flags used by the linker during release minsize builds. -CMAKE_EXE_LINKER_FLAGS_MINSIZEREL:STRING= - -//Flags used by the linker during release builds. -CMAKE_EXE_LINKER_FLAGS_RELEASE:STRING= - -//Flags used by the linker during Release with Debug Info builds. -CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO:STRING= - -//Enable/Disable output of compile commands during generation. -CMAKE_EXPORT_COMPILE_COMMANDS:BOOL=OFF - -//User executables (bin) -CMAKE_INSTALL_BINDIR:PATH=bin - -//Read-only architecture-independent data (DATAROOTDIR) -CMAKE_INSTALL_DATADIR:PATH= - -//Read-only architecture-independent data root (share) -CMAKE_INSTALL_DATAROOTDIR:PATH=share - -//Documentation root (DATAROOTDIR/doc/PROJECT_NAME) -CMAKE_INSTALL_DOCDIR:PATH= - -//C header files (include) -CMAKE_INSTALL_INCLUDEDIR:PATH=include - -//Info documentation (DATAROOTDIR/info) -CMAKE_INSTALL_INFODIR:PATH= - -//Object code libraries (lib) -CMAKE_INSTALL_LIBDIR:PATH=lib - -//Program executables (libexec) -CMAKE_INSTALL_LIBEXECDIR:PATH=libexec - -//Locale-dependent data (DATAROOTDIR/locale) -CMAKE_INSTALL_LOCALEDIR:PATH= - -//Modifiable single-machine data (var) -CMAKE_INSTALL_LOCALSTATEDIR:PATH=var - -//Man documentation (DATAROOTDIR/man) -CMAKE_INSTALL_MANDIR:PATH= - -//C header files for non-gcc (/usr/include) -CMAKE_INSTALL_OLDINCLUDEDIR:PATH=/usr/include - -//Install path prefix, prepended onto install directories. -CMAKE_INSTALL_PREFIX:PATH=/usr/local - -//Run-time variable data (LOCALSTATEDIR/run) -CMAKE_INSTALL_RUNSTATEDIR:PATH= - -//System admin executables (sbin) -CMAKE_INSTALL_SBINDIR:PATH=sbin - -//Modifiable architecture-independent data (com) -CMAKE_INSTALL_SHAREDSTATEDIR:PATH=com - -//Read-only single-machine data (etc) -CMAKE_INSTALL_SYSCONFDIR:PATH=etc - -//Path to a program. -CMAKE_LINKER:FILEPATH=/usr/bin/ld - -//Path to a program. -CMAKE_MAKE_PROGRAM:FILEPATH=/usr/bin/make - -//Flags used by the linker during the creation of modules. -CMAKE_MODULE_LINKER_FLAGS:STRING= - -//Flags used by the linker during debug builds. -CMAKE_MODULE_LINKER_FLAGS_DEBUG:STRING= - -//Flags used by the linker during release minsize builds. -CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL:STRING= - -//Flags used by the linker during release builds. -CMAKE_MODULE_LINKER_FLAGS_RELEASE:STRING= - -//Flags used by the linker during Release with Debug Info builds. -CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO:STRING= - -//Path to a program. -CMAKE_NM:FILEPATH=/usr/bin/nm - -//Path to a program. -CMAKE_OBJCOPY:FILEPATH=/usr/bin/objcopy - -//Path to a program. -CMAKE_OBJDUMP:FILEPATH=/usr/bin/objdump - -//Value Computed by CMake -CMAKE_PROJECT_NAME:STATIC=googletest-distribution - -//Path to a program. -CMAKE_RANLIB:FILEPATH=/usr/bin/ranlib - -//Flags used by the linker during the creation of dll's. -CMAKE_SHARED_LINKER_FLAGS:STRING= - -//Flags used by the linker during debug builds. -CMAKE_SHARED_LINKER_FLAGS_DEBUG:STRING= - -//Flags used by the linker during release minsize builds. -CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL:STRING= - -//Flags used by the linker during release builds. -CMAKE_SHARED_LINKER_FLAGS_RELEASE:STRING= - -//Flags used by the linker during Release with Debug Info builds. -CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO:STRING= - -//If set, runtime paths are not added when installing shared libraries, -// but are added when building. -CMAKE_SKIP_INSTALL_RPATH:BOOL=NO - -//If set, runtime paths are not added when using shared libraries. -CMAKE_SKIP_RPATH:BOOL=NO - -//Flags used by the linker during the creation of static libraries. -CMAKE_STATIC_LINKER_FLAGS:STRING= - -//Flags used by the linker during debug builds. -CMAKE_STATIC_LINKER_FLAGS_DEBUG:STRING= - -//Flags used by the linker during release minsize builds. -CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL:STRING= - -//Flags used by the linker during release builds. -CMAKE_STATIC_LINKER_FLAGS_RELEASE:STRING= - -//Flags used by the linker during Release with Debug Info builds. -CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO:STRING= - -//Path to a program. -CMAKE_STRIP:FILEPATH=/usr/bin/strip - -//If this value is on, makefiles will be generated without the -// .SILENT directive, and all commands will be echoed to the console -// during the make. This is useful for debugging only. With Visual -// Studio IDE projects all commands are done without /nologo. -CMAKE_VERBOSE_MAKEFILE:BOOL=FALSE - -//Enable installation of googlemock. (Projects embedding googlemock -// may want to turn this OFF.) -INSTALL_GMOCK:BOOL=ON - -//Enable installation of googletest. (Projects embedding googletest -// may want to turn this OFF.) -INSTALL_GTEST:BOOL=ON - -//Path to a program. -PYTHON_EXECUTABLE:FILEPATH=/usr/bin/python - -//Value Computed by CMake -gmock_BINARY_DIR:STATIC=/usr/local/google/home/misterg/projects/MY_FORKS/googletest/mybuild/googlemock - -//Dependencies for the target -gmock_LIB_DEPENDS:STATIC=general;-pthread;general;gtest; - -//Value Computed by CMake -gmock_SOURCE_DIR:STATIC=/usr/local/google/home/misterg/projects/MY_FORKS/googletest/googlemock - -//Build all of Google Mock's own tests. -gmock_build_tests:BOOL=OFF - -//Dependencies for the target -gmock_main_LIB_DEPENDS:STATIC=general;-pthread;general;gmock; - -//Value Computed by CMake -googletest-distribution_BINARY_DIR:STATIC=/usr/local/google/home/misterg/projects/MY_FORKS/googletest/mybuild - -//Value Computed by CMake -googletest-distribution_SOURCE_DIR:STATIC=/usr/local/google/home/misterg/projects/MY_FORKS/googletest - -//Value Computed by CMake -gtest_BINARY_DIR:STATIC=/usr/local/google/home/misterg/projects/MY_FORKS/googletest/mybuild/googlemock/gtest - -//Dependencies for the target -gtest_LIB_DEPENDS:STATIC=general;-pthread; - -//Value Computed by CMake -gtest_SOURCE_DIR:STATIC=/usr/local/google/home/misterg/projects/MY_FORKS/googletest/googletest - -//Build gtest's sample programs. -gtest_build_samples:BOOL=ON - -//Build all of gtest's own tests. -gtest_build_tests:BOOL=OFF - -//Disable uses of pthreads in gtest. -gtest_disable_pthreads:BOOL=OFF - -//Use shared (DLL) run-time lib even when Google Test is built -// as static lib. -gtest_force_shared_crt:BOOL=OFF - -//Build gtest with internal symbols hidden in shared libraries. -gtest_hide_internal_symbols:BOOL=OFF - -//Dependencies for the target -gtest_main_LIB_DEPENDS:STATIC=general;-pthread;general;gtest; - - -######################## -# INTERNAL cache entries -######################## - -//ADVANCED property for variable: CMAKE_AR -CMAKE_AR-ADVANCED:INTERNAL=1 -//This is the directory where this CMakeCache.txt was created -CMAKE_CACHEFILE_DIR:INTERNAL=/usr/local/google/home/misterg/projects/MY_FORKS/googletest/mybuild -//Major version of cmake used to create the current loaded cache -CMAKE_CACHE_MAJOR_VERSION:INTERNAL=3 -//Minor version of cmake used to create the current loaded cache -CMAKE_CACHE_MINOR_VERSION:INTERNAL=9 -//Patch version of cmake used to create the current loaded cache -CMAKE_CACHE_PATCH_VERSION:INTERNAL=0 -//ADVANCED property for variable: CMAKE_COLOR_MAKEFILE -CMAKE_COLOR_MAKEFILE-ADVANCED:INTERNAL=1 -//Path to CMake executable. -CMAKE_COMMAND:INTERNAL=/usr/bin/cmake -//Path to cpack program executable. -CMAKE_CPACK_COMMAND:INTERNAL=/usr/bin/cpack -//Path to ctest program executable. -CMAKE_CTEST_COMMAND:INTERNAL=/usr/bin/ctest -//ADVANCED property for variable: CMAKE_CXX_COMPILER -CMAKE_CXX_COMPILER-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_CXX_COMPILER_AR -CMAKE_CXX_COMPILER_AR-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_CXX_COMPILER_RANLIB -CMAKE_CXX_COMPILER_RANLIB-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_CXX_FLAGS -CMAKE_CXX_FLAGS-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_CXX_FLAGS_DEBUG -CMAKE_CXX_FLAGS_DEBUG-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_CXX_FLAGS_MINSIZEREL -CMAKE_CXX_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_CXX_FLAGS_RELEASE -CMAKE_CXX_FLAGS_RELEASE-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_CXX_FLAGS_RELWITHDEBINFO -CMAKE_CXX_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_C_COMPILER -CMAKE_C_COMPILER-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_C_COMPILER_AR -CMAKE_C_COMPILER_AR-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_C_COMPILER_RANLIB -CMAKE_C_COMPILER_RANLIB-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_C_FLAGS -CMAKE_C_FLAGS-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_C_FLAGS_DEBUG -CMAKE_C_FLAGS_DEBUG-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_C_FLAGS_MINSIZEREL -CMAKE_C_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_C_FLAGS_RELEASE -CMAKE_C_FLAGS_RELEASE-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_C_FLAGS_RELWITHDEBINFO -CMAKE_C_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 -//Path to cache edit program executable. -CMAKE_EDIT_COMMAND:INTERNAL=/usr/bin/ccmake -//Executable file format -CMAKE_EXECUTABLE_FORMAT:INTERNAL=ELF -//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS -CMAKE_EXE_LINKER_FLAGS-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_DEBUG -CMAKE_EXE_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_MINSIZEREL -CMAKE_EXE_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_RELEASE -CMAKE_EXE_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO -CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_EXPORT_COMPILE_COMMANDS -CMAKE_EXPORT_COMPILE_COMMANDS-ADVANCED:INTERNAL=1 -//Name of external makefile project generator. -CMAKE_EXTRA_GENERATOR:INTERNAL= -//Name of generator. -CMAKE_GENERATOR:INTERNAL=Unix Makefiles -//Name of generator platform. -CMAKE_GENERATOR_PLATFORM:INTERNAL= -//Name of generator toolset. -CMAKE_GENERATOR_TOOLSET:INTERNAL= -//Have symbol pthread_create -CMAKE_HAVE_LIBC_CREATE:INTERNAL= -//Have include pthread.h -CMAKE_HAVE_PTHREAD_H:INTERNAL=1 -//Source directory with the top level CMakeLists.txt file for this -// project -CMAKE_HOME_DIRECTORY:INTERNAL=/usr/local/google/home/misterg/projects/MY_FORKS/googletest -//ADVANCED property for variable: CMAKE_INSTALL_BINDIR -CMAKE_INSTALL_BINDIR-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_INSTALL_DATADIR -CMAKE_INSTALL_DATADIR-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_INSTALL_DATAROOTDIR -CMAKE_INSTALL_DATAROOTDIR-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_INSTALL_DOCDIR -CMAKE_INSTALL_DOCDIR-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_INSTALL_INCLUDEDIR -CMAKE_INSTALL_INCLUDEDIR-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_INSTALL_INFODIR -CMAKE_INSTALL_INFODIR-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_INSTALL_LIBDIR -CMAKE_INSTALL_LIBDIR-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_INSTALL_LIBEXECDIR -CMAKE_INSTALL_LIBEXECDIR-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_INSTALL_LOCALEDIR -CMAKE_INSTALL_LOCALEDIR-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_INSTALL_LOCALSTATEDIR -CMAKE_INSTALL_LOCALSTATEDIR-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_INSTALL_MANDIR -CMAKE_INSTALL_MANDIR-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_INSTALL_OLDINCLUDEDIR -CMAKE_INSTALL_OLDINCLUDEDIR-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_INSTALL_RUNSTATEDIR -CMAKE_INSTALL_RUNSTATEDIR-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_INSTALL_SBINDIR -CMAKE_INSTALL_SBINDIR-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_INSTALL_SHAREDSTATEDIR -CMAKE_INSTALL_SHAREDSTATEDIR-ADVANCED:INTERNAL=1 -//Install .so files without execute permission. -CMAKE_INSTALL_SO_NO_EXE:INTERNAL=1 -//ADVANCED property for variable: CMAKE_INSTALL_SYSCONFDIR -CMAKE_INSTALL_SYSCONFDIR-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_LINKER -CMAKE_LINKER-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_MAKE_PROGRAM -CMAKE_MAKE_PROGRAM-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS -CMAKE_MODULE_LINKER_FLAGS-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_DEBUG -CMAKE_MODULE_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL -CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_RELEASE -CMAKE_MODULE_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO -CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_NM -CMAKE_NM-ADVANCED:INTERNAL=1 -//number of local generators -CMAKE_NUMBER_OF_MAKEFILES:INTERNAL=3 -//ADVANCED property for variable: CMAKE_OBJCOPY -CMAKE_OBJCOPY-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_OBJDUMP -CMAKE_OBJDUMP-ADVANCED:INTERNAL=1 -//Platform information initialized -CMAKE_PLATFORM_INFO_INITIALIZED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_RANLIB -CMAKE_RANLIB-ADVANCED:INTERNAL=1 -//Path to CMake installation. -CMAKE_ROOT:INTERNAL=/usr/share/cmake-3.9 -//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS -CMAKE_SHARED_LINKER_FLAGS-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_DEBUG -CMAKE_SHARED_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL -CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_RELEASE -CMAKE_SHARED_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO -CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_SKIP_INSTALL_RPATH -CMAKE_SKIP_INSTALL_RPATH-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_SKIP_RPATH -CMAKE_SKIP_RPATH-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS -CMAKE_STATIC_LINKER_FLAGS-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_DEBUG -CMAKE_STATIC_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL -CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_RELEASE -CMAKE_STATIC_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO -CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_STRIP -CMAKE_STRIP-ADVANCED:INTERNAL=1 -//uname command -CMAKE_UNAME:INTERNAL=/bin/uname -//ADVANCED property for variable: CMAKE_VERBOSE_MAKEFILE -CMAKE_VERBOSE_MAKEFILE-ADVANCED:INTERNAL=1 -//Details about finding PythonInterp -FIND_PACKAGE_MESSAGE_DETAILS_PythonInterp:INTERNAL=[/usr/bin/python][v2.7.13()] -//Details about finding Threads -FIND_PACKAGE_MESSAGE_DETAILS_Threads:INTERNAL=[TRUE][v()] -//ADVANCED property for variable: PYTHON_EXECUTABLE -PYTHON_EXECUTABLE-ADVANCED:INTERNAL=1 -//Result of TRY_COMPILE -THREADS_HAVE_PTHREAD_ARG:INTERNAL=TRUE -//Result of TRY_RUN -THREADS_PTHREAD_ARG:INTERNAL=2 -//CMAKE_INSTALL_PREFIX during last run -_GNUInstallDirs_LAST_CMAKE_INSTALL_PREFIX:INTERNAL=/usr/local - diff --git a/mybuild/Testing/Temporary/CTestCostData.txt b/mybuild/Testing/Temporary/CTestCostData.txt deleted file mode 100644 index ed97d539..00000000 --- a/mybuild/Testing/Temporary/CTestCostData.txt +++ /dev/null @@ -1 +0,0 @@ ---- diff --git a/mybuild/Testing/Temporary/LastTest.log b/mybuild/Testing/Temporary/LastTest.log deleted file mode 100644 index c95a7c3a..00000000 --- a/mybuild/Testing/Temporary/LastTest.log +++ /dev/null @@ -1,3 +0,0 @@ -Start testing: Aug 20 14:07 EDT ----------------------------------------------------------- -End testing: Aug 20 14:07 EDT diff --git a/mybuild/googlemock/gmock.pc b/mybuild/googlemock/gmock.pc deleted file mode 100644 index d4242cfa..00000000 --- a/mybuild/googlemock/gmock.pc +++ /dev/null @@ -1,9 +0,0 @@ -libdir=/usr/local/lib -includedir=/usr/local/include - -Name: gmock -Description: GoogleMock (without main() function) -Version: 1.9.0 -URL: https://github.com/google/googletest -Libs: -L${libdir} -lgmock -pthread -Cflags: -I${includedir} -DGTEST_HAS_PTHREAD=1 -pthread diff --git a/mybuild/googlemock/gmock_main.pc b/mybuild/googlemock/gmock_main.pc deleted file mode 100644 index 2da4fbcc..00000000 --- a/mybuild/googlemock/gmock_main.pc +++ /dev/null @@ -1,9 +0,0 @@ -libdir=/usr/local/lib -includedir=/usr/local/include - -Name: gmock_main -Description: GoogleMock (with main() function) -Version: 1.9.0 -URL: https://github.com/google/googletest -Libs: -L${libdir} -lgmock_main -pthread -Cflags: -I${includedir} -DGTEST_HAS_PTHREAD=1 -pthread diff --git a/mybuild/googlemock/gtest/gtest.pc b/mybuild/googlemock/gtest/gtest.pc deleted file mode 100644 index a9931b8b..00000000 --- a/mybuild/googlemock/gtest/gtest.pc +++ /dev/null @@ -1,9 +0,0 @@ -libdir=/usr/local/lib -includedir=/usr/local/include - -Name: gtest -Description: GoogleTest (without main() function) -Version: 1.9.0 -URL: https://github.com/google/googletest -Libs: -L${libdir} -lgtest -pthread -Cflags: -I${includedir} -DGTEST_HAS_PTHREAD=1 -pthread diff --git a/mybuild/googlemock/gtest/gtest_main.pc b/mybuild/googlemock/gtest/gtest_main.pc deleted file mode 100644 index 57948c76..00000000 --- a/mybuild/googlemock/gtest/gtest_main.pc +++ /dev/null @@ -1,10 +0,0 @@ -libdir=/usr/local/lib -includedir=/usr/local/include - -Name: gtest_main -Description: GoogleTest (with main() function) -Version: 1.9.0 -URL: https://github.com/google/googletest -Requires: gtest -Libs: -L${libdir} -lgtest_main -pthread -Cflags: -I${includedir} -DGTEST_HAS_PTHREAD=1 -pthread diff --git a/mybuild/googlemock/gtest/libgtest.a b/mybuild/googlemock/gtest/libgtest.a deleted file mode 100644 index 46029a9b..00000000 Binary files a/mybuild/googlemock/gtest/libgtest.a and /dev/null differ diff --git a/mybuild/googlemock/gtest/libgtest_main.a b/mybuild/googlemock/gtest/libgtest_main.a deleted file mode 100644 index f76d51ce..00000000 Binary files a/mybuild/googlemock/gtest/libgtest_main.a and /dev/null differ diff --git a/mybuild/googlemock/gtest/sample4_unittest b/mybuild/googlemock/gtest/sample4_unittest deleted file mode 100755 index b4355c0a..00000000 Binary files a/mybuild/googlemock/gtest/sample4_unittest and /dev/null differ -- cgit v1.2.3 From 5891bb530736c39568f61ba0bf1a45d60d40f76e Mon Sep 17 00:00:00 2001 From: misterg Date: Mon, 20 Aug 2018 14:48:03 -0400 Subject: googletest export - 209457486 Import of OSS PR, https://github.com/google/googletest/pu... by misterg PiperOrigin-RevId: 209457486 --- googletest/samples/sample4.cc | 10 ++++++++++ googletest/samples/sample4.h | 3 +++ googletest/samples/sample4_unittest.cc | 5 +++++ 3 files changed, 18 insertions(+) diff --git a/googletest/samples/sample4.cc b/googletest/samples/sample4.cc index 2f7c87aa..b0ee6093 100644 --- a/googletest/samples/sample4.cc +++ b/googletest/samples/sample4.cc @@ -38,6 +38,16 @@ int Counter::Increment() { return counter_++; } +// Returns the current counter value, and decrements it. +// counter can not be less than 0, return 0 in this case +int Counter::Decrement() { + if (counter_ == 0) { + return counter_; + } else { + return counter_--; + } +} + // Prints the current counter value to STDOUT. void Counter::Print() const { printf("%d", counter_); diff --git a/googletest/samples/sample4.h b/googletest/samples/sample4.h index fda5f335..e256f406 100644 --- a/googletest/samples/sample4.h +++ b/googletest/samples/sample4.h @@ -43,6 +43,9 @@ class Counter { // Returns the current counter value, and increments it. int Increment(); + // Returns the current counter value, and decrements it. + int Decrement(); + // Prints the current counter value to STDOUT. void Print() const; }; diff --git a/googletest/samples/sample4_unittest.cc b/googletest/samples/sample4_unittest.cc index 079a70d8..d5144c0d 100644 --- a/googletest/samples/sample4_unittest.cc +++ b/googletest/samples/sample4_unittest.cc @@ -37,12 +37,17 @@ namespace { TEST(Counter, Increment) { Counter c; + // Test that counter 0 returns 0 + EXPECT_EQ(0, c.Decrement()); + // EXPECT_EQ() evaluates its arguments exactly once, so they // can have side effects. EXPECT_EQ(0, c.Increment()); EXPECT_EQ(1, c.Increment()); EXPECT_EQ(2, c.Increment()); + + EXPECT_EQ(3, c.Decrement()); } } // namespace -- cgit v1.2.3 From df428ec11891f12c81e2872c0432e342b5403a34 Mon Sep 17 00:00:00 2001 From: misterg Date: Mon, 20 Aug 2018 14:48:45 -0400 Subject: googletest export - 209457654 Import of OSS PR, https://github.com/google/googletest/pu... by misterg PiperOrigin-RevId: 209457654 --- googlemock/include/gmock/gmock-cardinalities.h | 5 +++++ googlemock/include/gmock/gmock-matchers.h | 5 +++++ googlemock/include/gmock/gmock-spec-builders.h | 15 +++++++-------- googletest/include/gtest/gtest-message.h | 5 +++++ googletest/include/gtest/gtest-spi.h | 5 +++++ googletest/include/gtest/gtest-test-part.h | 7 ++++++- googletest/include/gtest/gtest.h | 5 +++++ .../include/gtest/internal/gtest-death-test-internal.h | 5 +++++ googletest/include/gtest/internal/gtest-filepath.h | 5 +++++ googletest/include/gtest/internal/gtest-internal.h | 10 ++++++++++ googletest/src/gtest-internal-inl.h | 5 +++++ 11 files changed, 63 insertions(+), 9 deletions(-) diff --git a/googlemock/include/gmock/gmock-cardinalities.h b/googlemock/include/gmock/gmock-cardinalities.h index bf3ae557..f9169315 100644 --- a/googlemock/include/gmock/gmock-cardinalities.h +++ b/googlemock/include/gmock/gmock-cardinalities.h @@ -44,6 +44,9 @@ #include "gmock/internal/gmock-port.h" #include "gtest/gtest.h" +GTEST_DISABLE_MSC_WARNINGS_PUSH_(4251 \ +/* class A needs to have dll-interface to be used by clients of class B */) + namespace testing { // To implement a cardinality Foo, define: @@ -145,4 +148,6 @@ inline Cardinality MakeCardinality(const CardinalityInterface* c) { } // namespace testing +GTEST_DISABLE_MSC_WARNINGS_POP_() // 4251 + #endif // GMOCK_INCLUDE_GMOCK_GMOCK_CARDINALITIES_H_ diff --git a/googlemock/include/gmock/gmock-matchers.h b/googlemock/include/gmock/gmock-matchers.h index a0018505..3336eff2 100644 --- a/googlemock/include/gmock/gmock-matchers.h +++ b/googlemock/include/gmock/gmock-matchers.h @@ -56,6 +56,9 @@ # include // NOLINT -- must be after gtest.h #endif +GTEST_DISABLE_MSC_WARNINGS_PUSH_(4251 \ +/* class A needs to have dll-interface to be used by clients of class B */) + namespace testing { // To implement a matcher Foo for type T, define: @@ -5266,6 +5269,8 @@ PolymorphicMatcher > VariantWith( } // namespace testing +GTEST_DISABLE_MSC_WARNINGS_POP_() // 4251 + // Include any custom callback matchers added by the local installation. // We must include this header at the end to make sure it can use the // declarations from this file. diff --git a/googlemock/include/gmock/gmock-spec-builders.h b/googlemock/include/gmock/gmock-spec-builders.h index 0d83cd6f..436e2d8b 100644 --- a/googlemock/include/gmock/gmock-spec-builders.h +++ b/googlemock/include/gmock/gmock-spec-builders.h @@ -77,6 +77,9 @@ # include // NOLINT #endif +GTEST_DISABLE_MSC_WARNINGS_PUSH_(4251 \ +/* class A needs to have dll-interface to be used by clients of class B */) + namespace testing { // An abstract handle of an expectation. @@ -1357,11 +1360,7 @@ class ReferenceOrValueWrapper { // we need to temporarily disable the warning. We have to do it for // the entire class to suppress the warning, even though it's about // the constructor only. - -#ifdef _MSC_VER -# pragma warning(push) // Saves the current warning state. -# pragma warning(disable:4355) // Temporarily disables warning 4355. -#endif // _MSV_VER +GTEST_DISABLE_MSC_WARNINGS_PUSH_(4355) // C++ treats the void type specially. For example, you cannot define // a void-typed variable or pass a void value to a function. @@ -1797,9 +1796,7 @@ class FunctionMockerBase : public UntypedFunctionMockerBase { GTEST_DISALLOW_COPY_AND_ASSIGN_(FunctionMockerBase); }; // class FunctionMockerBase -#ifdef _MSC_VER -# pragma warning(pop) // Restores the warning state. -#endif // _MSV_VER +GTEST_DISABLE_MSC_WARNINGS_POP_() // 4355 // Implements methods of FunctionMockerBase. @@ -1844,6 +1841,8 @@ inline Expectation::Expectation(internal::ExpectationBase& exp) // NOLINT } // namespace testing +GTEST_DISABLE_MSC_WARNINGS_POP_() // 4251 + // Implementation for ON_CALL and EXPECT_CALL macros. A separate macro is // required to avoid compile errors when the name of the method used in call is // a result of macro expansion. See CompilesWithMethodNameExpandedFromMacro diff --git a/googletest/include/gtest/gtest-message.h b/googletest/include/gtest/gtest-message.h index 107a55c0..5ca04161 100644 --- a/googletest/include/gtest/gtest-message.h +++ b/googletest/include/gtest/gtest-message.h @@ -51,6 +51,9 @@ #include "gtest/internal/gtest-port.h" +GTEST_DISABLE_MSC_WARNINGS_PUSH_(4251 \ +/* class A needs to have dll-interface to be used by clients of class B */) + // Ensures that there is at least one operator<< in the global namespace. // See Message& operator<<(...) below for why. void operator<<(const testing::internal::Secret&, int); @@ -247,4 +250,6 @@ std::string StreamableToString(const T& streamable) { } // namespace internal } // namespace testing +GTEST_DISABLE_MSC_WARNINGS_POP_() // 4251 + #endif // GTEST_INCLUDE_GTEST_GTEST_MESSAGE_H_ diff --git a/googletest/include/gtest/gtest-spi.h b/googletest/include/gtest/gtest-spi.h index 26b4aa5d..1e898393 100644 --- a/googletest/include/gtest/gtest-spi.h +++ b/googletest/include/gtest/gtest-spi.h @@ -38,6 +38,9 @@ #include "gtest/gtest.h" +GTEST_DISABLE_MSC_WARNINGS_PUSH_(4251 \ +/* class A needs to have dll-interface to be used by clients of class B */) + namespace testing { // This helper class can be used to mock out Google Test failure reporting @@ -112,6 +115,8 @@ class GTEST_API_ SingleFailureChecker { } // namespace testing +GTEST_DISABLE_MSC_WARNINGS_POP_() // 4251 + // A set of macros for testing Google Test assertions or code that's expected // to generate Google Test fatal failures. It verifies that the given // statement will cause exactly one fatal Google Test failure with 'substr' diff --git a/googletest/include/gtest/gtest-test-part.h b/googletest/include/gtest/gtest-test-part.h index 66c7db64..1c7b89e0 100644 --- a/googletest/include/gtest/gtest-test-part.h +++ b/googletest/include/gtest/gtest-test-part.h @@ -37,6 +37,9 @@ #include "gtest/internal/gtest-internal.h" #include "gtest/internal/gtest-string.h" +GTEST_DISABLE_MSC_WARNINGS_PUSH_(4251 \ +/* class A needs to have dll-interface to be used by clients of class B */) + namespace testing { // A copyable object representing the result of a test part (i.e. an @@ -142,7 +145,7 @@ class GTEST_API_ TestPartResultArray { }; // This interface knows how to report a test part result. -class TestPartResultReporterInterface { +class GTEST_API_ TestPartResultReporterInterface { public: virtual ~TestPartResultReporterInterface() {} @@ -175,4 +178,6 @@ class GTEST_API_ HasNewFatalFailureHelper } // namespace testing +GTEST_DISABLE_MSC_WARNINGS_POP_() // 4251 + #endif // GTEST_INCLUDE_GTEST_GTEST_TEST_PART_H_ diff --git a/googletest/include/gtest/gtest.h b/googletest/include/gtest/gtest.h index 65bd9cb4..2be8b112 100644 --- a/googletest/include/gtest/gtest.h +++ b/googletest/include/gtest/gtest.h @@ -66,6 +66,9 @@ #include "gtest/gtest-test-part.h" #include "gtest/gtest-typed-test.h" +GTEST_DISABLE_MSC_WARNINGS_PUSH_(4251 \ +/* class A needs to have dll-interface to be used by clients of class B */) + // Depending on the platform, different string classes are available. // On Linux, in addition to ::std::string, Google also makes use of // class ::string, which has the same interface as ::std::string, but @@ -2330,4 +2333,6 @@ inline int RUN_ALL_TESTS() { return ::testing::UnitTest::GetInstance()->Run(); } +GTEST_DISABLE_MSC_WARNINGS_POP_() // 4251 + #endif // GTEST_INCLUDE_GTEST_GTEST_H_ diff --git a/googletest/include/gtest/internal/gtest-death-test-internal.h b/googletest/include/gtest/internal/gtest-death-test-internal.h index 55e3029f..0a9b42c8 100644 --- a/googletest/include/gtest/internal/gtest-death-test-internal.h +++ b/googletest/include/gtest/internal/gtest-death-test-internal.h @@ -52,6 +52,9 @@ const char kInternalRunDeathTestFlag[] = "internal_run_death_test"; #if GTEST_HAS_DEATH_TEST +GTEST_DISABLE_MSC_WARNINGS_PUSH_(4251 \ +/* class A needs to have dll-interface to be used by clients of class B */) + // DeathTest is a class that hides much of the complexity of the // GTEST_DEATH_TEST_ macro. It is abstract; its static Create method // returns a concrete class that depends on the prevailing death test @@ -135,6 +138,8 @@ class GTEST_API_ DeathTest { GTEST_DISALLOW_COPY_AND_ASSIGN_(DeathTest); }; +GTEST_DISABLE_MSC_WARNINGS_POP_() // 4251 + // Factory interface for death tests. May be mocked out for testing. class DeathTestFactory { public: diff --git a/googletest/include/gtest/internal/gtest-filepath.h b/googletest/include/gtest/internal/gtest-filepath.h index c2601a37..ae38d95b 100644 --- a/googletest/include/gtest/internal/gtest-filepath.h +++ b/googletest/include/gtest/internal/gtest-filepath.h @@ -42,6 +42,9 @@ #include "gtest/internal/gtest-string.h" +GTEST_DISABLE_MSC_WARNINGS_PUSH_(4251 \ +/* class A needs to have dll-interface to be used by clients of class B */) + namespace testing { namespace internal { @@ -203,4 +206,6 @@ class GTEST_API_ FilePath { } // namespace internal } // namespace testing +GTEST_DISABLE_MSC_WARNINGS_POP_() // 4251 + #endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_FILEPATH_H_ diff --git a/googletest/include/gtest/internal/gtest-internal.h b/googletest/include/gtest/internal/gtest-internal.h index aa36693c..9593a45a 100644 --- a/googletest/include/gtest/internal/gtest-internal.h +++ b/googletest/include/gtest/internal/gtest-internal.h @@ -141,6 +141,9 @@ GTEST_API_ std::string AppendUserMessage( #if GTEST_HAS_EXCEPTIONS +GTEST_DISABLE_MSC_WARNINGS_PUSH_(4275 \ +/* an exported class was derived from a class that was not exported */) + // This exception is thrown by (and only by) a failed Google Test // assertion when GTEST_FLAG(throw_on_failure) is true (if exceptions // are enabled). We derive it from std::runtime_error, which is for @@ -152,6 +155,8 @@ class GTEST_API_ GoogleTestFailureException : public ::std::runtime_error { explicit GoogleTestFailureException(const TestPartResult& failure); }; +GTEST_DISABLE_MSC_WARNINGS_POP_() // 4275 + #endif // GTEST_HAS_EXCEPTIONS namespace edit_distance { @@ -528,6 +533,9 @@ GTEST_API_ bool SkipPrefix(const char* prefix, const char** pstr); #if GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P +GTEST_DISABLE_MSC_WARNINGS_PUSH_(4251 \ +/* class A needs to have dll-interface to be used by clients of class B */) + // State of the definition of a type-parameterized test case. class GTEST_API_ TypedTestCasePState { public: @@ -573,6 +581,8 @@ class GTEST_API_ TypedTestCasePState { RegisteredTestsMap registered_tests_; }; +GTEST_DISABLE_MSC_WARNINGS_POP_() // 4251 + // Skips to the first non-space char after the first comma in 'str'; // returns NULL if no comma is found in 'str'. inline const char* SkipComma(const char* str) { diff --git a/googletest/src/gtest-internal-inl.h b/googletest/src/gtest-internal-inl.h index 43effbf0..47900414 100644 --- a/googletest/src/gtest-internal-inl.h +++ b/googletest/src/gtest-internal-inl.h @@ -59,6 +59,9 @@ #include "gtest/gtest.h" #include "gtest/gtest-spi.h" +GTEST_DISABLE_MSC_WARNINGS_PUSH_(4251 \ +/* class A needs to have dll-interface to be used by clients of class B */) + namespace testing { // Declares the flags. @@ -1179,4 +1182,6 @@ class StreamingListener : public EmptyTestEventListener { } // namespace internal } // namespace testing +GTEST_DISABLE_MSC_WARNINGS_POP_() // 4251 + #endif // GTEST_SRC_GTEST_INTERNAL_INL_H_ -- cgit v1.2.3 From 735bd75f69f8a1c6240c95915edfa091bfa976ac Mon Sep 17 00:00:00 2001 From: Gennadiy Civil Date: Mon, 20 Aug 2018 16:08:33 -0400 Subject: Update CONTRIBUTING.md --- CONTRIBUTING.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 0ebdfcc6..4dfdd95c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -19,6 +19,11 @@ Follow either of the two links above to access the appropriate CLA and instructions for how to sign and return it. Once we receive it, we'll be able to accept your pull requests. +## Are you a Googler? +If you are a Googler, please create an internal change and +have it reviewed and submitted. The maintainers will normally be in position to upstream the changes. + + ## Contributing A Patch 1. Submit an issue describing your proposed change to the @@ -39,10 +44,6 @@ accept your pull requests. 1. Ensure that your code has an appropriate set of unit tests which all pass. 1. Submit a pull request. -If you are a Googler, it is preferable to first create an internal change and -have it reviewed and submitted, and then create an upstreaming pull -request here. - ## The Google Test and Google Mock Communities ## The Google Test community exists primarily through the -- cgit v1.2.3