Skip to content

Commit a509713

Browse files
committed
update googletest
1 parent b121f7f commit a509713

File tree

194 files changed

+5240
-29287
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

194 files changed

+5240
-29287
lines changed

source/tests/googletest/.gitignore

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Ignore CI build directory
2+
build/
3+
xcuserdata
4+
cmake-build-debug/
5+
.idea/
6+
bazel-bin
7+
bazel-genfiles
8+
bazel-googletest
9+
bazel-out
10+
bazel-testlogs
11+
# python
12+
*.pyc
13+
14+
# Visual Studio files
15+
*.sdf
16+
*.opensdf
17+
*.VC.opendb
18+
*.suo
19+
*.user
20+
_ReSharper.Caches/
21+
Win32-Debug/
22+
Win32-Release/
23+
x64-Debug/
24+
x64-Release/

source/tests/googletest/.travis.yml

Lines changed: 54 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,60 @@
33
# This file can be validated on:
44
# http://lint.travis-ci.org/
55

6+
sudo: false
7+
language: cpp
8+
9+
# Define the matrix explicitly, manually expanding the combinations of (os, compiler, env).
10+
# It is more tedious, but grants us far more flexibility.
11+
matrix:
12+
include:
13+
- os: linux
14+
compiler: gcc
15+
sudo: true
16+
cache:
17+
install: ./ci/install-linux.sh && ./ci/log-config.sh
18+
script: ./ci/build-linux-bazel.sh
19+
- os: linux
20+
compiler: clang
21+
sudo: true
22+
cache:
23+
install: ./ci/install-linux.sh && ./ci/log-config.sh
24+
script: ./ci/build-linux-bazel.sh
25+
- os: linux
26+
compiler: gcc
27+
env: BUILD_TYPE=Debug VERBOSE=1
28+
- os: linux
29+
compiler: gcc
30+
env: BUILD_TYPE=Release VERBOSE=1 CXX_FLAGS=-std=c++11
31+
- os: linux
32+
compiler: clang
33+
env: BUILD_TYPE=Debug VERBOSE=1
34+
- os: linux
35+
compiler: clang
36+
env: BUILD_TYPE=Release VERBOSE=1 CXX_FLAGS=-std=c++11
37+
- os: osx
38+
compiler: gcc
39+
env: BUILD_TYPE=Debug VERBOSE=1
40+
- os: osx
41+
compiler: gcc
42+
env: BUILD_TYPE=Release VERBOSE=1 CXX_FLAGS=-std=c++11
43+
- os: osx
44+
compiler: clang
45+
env: BUILD_TYPE=Debug VERBOSE=1
46+
- os: osx
47+
compiler: clang
48+
env: BUILD_TYPE=Release VERBOSE=1 CXX_FLAGS=-std=c++11
49+
50+
# These are the install and build (script) phases for the most common entries in the matrix. They could be included
51+
# in each entry in the matrix, but that is just repetitive.
652
install:
7-
# /usr/bin/gcc is 4.6 always, but gcc-X.Y is available.
8-
- if [ "$CXX" = "g++" ]; then export CXX="g++-4.9" CC="gcc-4.9"; fi
9-
# /usr/bin/clang is 3.4, lets override with modern one.
10-
- if [ "$CXX" = "clang++" ] && [ "$TRAVIS_OS_NAME" = "linux" ]; then export CXX="clang++-3.7" CC="clang-3.7"; fi
11-
- echo ${PATH}
12-
- echo ${CXX}
13-
- ${CXX} --version
14-
- ${CXX} -v
53+
- ./ci/install-${TRAVIS_OS_NAME}.sh
54+
- . ./ci/env-${TRAVIS_OS_NAME}.sh
55+
- ./ci/log-config.sh
56+
57+
script: ./ci/travis.sh
58+
59+
# For sudo=false builds this section installs the necessary dependencies.
1560
addons:
1661
apt:
1762
# List of whitelisted in travis packages for ubuntu-precise can be found here:
@@ -22,25 +67,8 @@ addons:
2267
- ubuntu-toolchain-r-test
2368
- llvm-toolchain-precise-3.7
2469
packages:
25-
- gcc-4.9
2670
- g++-4.9
2771
- clang-3.7
28-
- valgrind
29-
os:
30-
- linux
31-
- osx
32-
language: cpp
33-
compiler:
34-
- gcc
35-
- clang
36-
script: ./travis.sh
37-
env:
38-
matrix:
39-
- GTEST_TARGET=googletest SHARED_LIB=OFF STATIC_LIB=ON CMAKE_PKG=OFF BUILD_TYPE=debug VERBOSE_MAKE=true VERBOSE
40-
- GTEST_TARGET=googlemock SHARED_LIB=OFF STATIC_LIB=ON CMAKE_PKG=OFF BUILD_TYPE=debug VERBOSE_MAKE=true VERBOSE
41-
- GTEST_TARGET=googlemock SHARED_LIB=OFF STATIC_LIB=ON CMAKE_PKG=OFF BUILD_TYPE=debug CXX_FLAGS=-std=c++11 VERBOSE_MAKE=true VERBOSE
42-
# - GTEST_TARGET=googletest SHARED_LIB=ON STATIC_LIB=ON CMAKE_PKG=ON BUILD_TYPE=release VERBOSE_MAKE=false
43-
# - GTEST_TARGET=googlemock SHARED_LIB=ON STATIC_LIB=ON CMAKE_PKG=ON BUILD_TYPE=release VERBOSE_MAKE=false
72+
4473
notifications:
4574
email: false
46-
sudo: false

source/tests/googletest/CMakeLists.txt

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,31 @@
1-
cmake_minimum_required(VERSION 2.6.2)
1+
cmake_minimum_required(VERSION 2.6.4)
2+
3+
if (POLICY CMP0048)
4+
cmake_policy(SET CMP0048 NEW)
5+
endif (POLICY CMP0048)
26

37
project( googletest-distribution )
48

59
enable_testing()
610

11+
include(CMakeDependentOption)
12+
if (CMAKE_VERSION VERSION_LESS 2.8.5)
13+
set(CMAKE_INSTALL_BINDIR "bin" CACHE STRING "User executables (bin)")
14+
set(CMAKE_INSTALL_LIBDIR "lib${LIB_SUFFIX}" CACHE STRING "Object code libraries (lib)")
15+
set(CMAKE_INSTALL_INCLUDEDIR "include" CACHE STRING "C header files (include)")
16+
mark_as_advanced(CMAKE_INSTALL_BINDIR CMAKE_INSTALL_LIBDIR CMAKE_INSTALL_INCLUDEDIR)
17+
else()
18+
include(GNUInstallDirs)
19+
endif()
20+
721
option(BUILD_GTEST "Builds the googletest subproject" OFF)
822

923
#Note that googlemock target already builds googletest
1024
option(BUILD_GMOCK "Builds the googlemock subproject" ON)
1125

26+
cmake_dependent_option(INSTALL_GTEST "Enable installation of googletest. (Projects embedding googletest may want to turn this OFF.)" ON "BUILD_GTEST OR BUILD_GMOCK" OFF)
27+
cmake_dependent_option(INSTALL_GMOCK "Enable installation of googlemock. (Projects embedding googlemock may want to turn this OFF.)" ON "BUILD_GMOCK" OFF)
28+
1229
if(BUILD_GMOCK)
1330
add_subdirectory( googlemock )
1431
elseif(BUILD_GTEST)

source/tests/googletest/README.md

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# Google Test #
33

44
[![Build Status](https://travis-ci.org/google/googletest.svg?branch=master)](https://travis-ci.org/google/googletest)
5+
[![Build status](https://ci.appveyor.com/api/projects/status/4o38plt0xbo1ubc8/branch/master?svg=true)](https://ci.appveyor.com/project/GoogleTestAppVeyor/googletest/branch/master)
56

67
Welcome to **Google Test**, Google's C++ test framework!
78

@@ -11,9 +12,12 @@ maintain and release them together.
1112

1213
Please see the project page above for more information as well as the
1314
mailing list for questions, discussions, and development. There is
14-
also an IRC channel on OFTC (irc.oftc.net) #gtest available. Please
15+
also an IRC channel on [OFTC](https://webchat.oftc.net/) (irc.oftc.net) #gtest available. Please
1516
join us!
1617

18+
Getting started information for **Google Test** is available in the
19+
[Google Test Primer](googletest/docs/Primer.md) documentation.
20+
1721
**Google Mock** is an extension to Google Test for writing and using C++ mock
1822
classes. See the separate [Google Mock documentation](googlemock/README.md).
1923

@@ -22,7 +26,7 @@ in its interior [googletest/README.md](googletest/README.md) file.
2226

2327
## Features ##
2428

25-
* An [XUnit](https://en.wikipedia.org/wiki/XUnit) test framework.
29+
* An [xUnit](https://en.wikipedia.org/wiki/XUnit) test framework.
2630
* Test discovery.
2731
* A rich set of assertions.
2832
* User-defined assertions.
@@ -56,9 +60,12 @@ the following notable projects:
5660
* [Protocol Buffers](https://github.com/google/protobuf), Google's data
5761
interchange format.
5862
* The [OpenCV](http://opencv.org/) computer vision library.
63+
* [tiny-dnn](https://github.com/tiny-dnn/tiny-dnn): header only, dependency-free deep learning framework in C++11.
5964

6065
## Related Open Source Projects ##
6166

67+
[GTest Runner](https://github.com/nholthaus/gtest-runner) is a Qt5 based automated test-runner and Graphical User Interface with powerful features for Windows and Linux platforms.
68+
6269
[Google Test UI](https://github.com/ospector/gtest-gbar) is test runner that runs
6370
your test binary, allows you to track its progress via a progress bar, and
6471
displays a list of test failures. Clicking on one shows failure text. Google
@@ -69,6 +76,9 @@ listener for Google Test that implements the
6976
[TAP protocol](https://en.wikipedia.org/wiki/Test_Anything_Protocol) for test
7077
result output. If your test runner understands TAP, you may find it useful.
7178

79+
[gtest-parallel](https://github.com/google/gtest-parallel) is a test runner that
80+
runs tests from your binary in parallel to provide significant speed-up.
81+
7282
## Requirements ##
7383

7484
Google Test is designed to have fairly minimal requirements to build
@@ -78,7 +88,7 @@ effort to support other platforms (e.g. Solaris, AIX, and z/OS).
7888
However, since core members of the Google Test project have no access
7989
to these platforms, Google Test may have outstanding issues there. If
8090
you notice any problems on your platform, please notify
81-
<[email protected]>. Patches for fixing them are
91+
[[email protected]](https://groups.google.com/forum/#!forum/googletestframework). Patches for fixing them are
8292
even more welcome!
8393

8494
### Linux Requirements ###
@@ -93,7 +103,7 @@ package (as described below):
93103

94104
### Windows Requirements ###
95105

96-
* Microsoft Visual C++ v7.1 or newer
106+
* Microsoft Visual C++ 2010 or newer
97107

98108
### Cygwin Requirements ###
99109

@@ -102,7 +112,7 @@ package (as described below):
102112
### Mac OS X Requirements ###
103113

104114
* Mac OS X v10.4 Tiger or newer
105-
* XCode Developer Tools
115+
* Xcode Developer Tools
106116

107117
### Requirements for Contributors ###
108118

source/tests/googletest/WORKSPACE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
workspace(name = "com_google_googletest")
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
version: '{build}'
2+
3+
os: Visual Studio 2015
4+
5+
environment:
6+
matrix:
7+
- compiler: msvc-15-seh
8+
generator: "Visual Studio 15 2017"
9+
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
10+
11+
- compiler: msvc-15-seh
12+
generator: "Visual Studio 15 2017 Win64"
13+
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
14+
15+
- compiler: msvc-14-seh
16+
generator: "Visual Studio 14 2015"
17+
18+
- compiler: msvc-14-seh
19+
generator: "Visual Studio 14 2015 Win64"
20+
21+
- compiler: msvc-12-seh
22+
generator: "Visual Studio 12 2013"
23+
24+
- compiler: msvc-12-seh
25+
generator: "Visual Studio 12 2013 Win64"
26+
27+
- compiler: msvc-11-seh
28+
generator: "Visual Studio 11 2012"
29+
30+
- compiler: msvc-11-seh
31+
generator: "Visual Studio 11 2012 Win64"
32+
33+
- compiler: msvc-10-seh
34+
generator: "Visual Studio 10 2010"
35+
36+
- compiler: gcc-5.3.0-posix
37+
generator: "MinGW Makefiles"
38+
cxx_path: 'C:\mingw-w64\i686-5.3.0-posix-dwarf-rt_v4-rev0\mingw32\bin'
39+
40+
- compiler: gcc-6.3.0-posix
41+
generator: "MinGW Makefiles"
42+
cxx_path: 'C:\mingw-w64\i686-6.3.0-posix-dwarf-rt_v5-rev1\mingw32\bin'
43+
44+
configuration:
45+
- Debug
46+
#- Release
47+
48+
build:
49+
verbosity: minimal
50+
51+
install:
52+
- ps: |
53+
Write-Output "Compiler: $env:compiler"
54+
Write-Output "Generator: $env:generator"
55+
56+
# git bash conflicts with MinGW makefiles
57+
if ($env:generator -eq "MinGW Makefiles") {
58+
$env:path = $env:path.replace("C:\Program Files\Git\usr\bin;", "")
59+
if ($env:cxx_path -ne "") {
60+
$env:path += ";$env:cxx_path"
61+
}
62+
}
63+
64+
build_script:
65+
- ps: |
66+
md _build -Force | Out-Null
67+
cd _build
68+
69+
$conf = if ($env:generator -eq "MinGW Makefiles") {"-DCMAKE_BUILD_TYPE=$env:configuration"} else {"-DCMAKE_CONFIGURATION_TYPES=Debug;Release"}
70+
# Disable test for MinGW (gtest tests fail, gmock tests can not build)
71+
$gtest_build_tests = if ($env:generator -eq "MinGW Makefiles") {"-Dgtest_build_tests=OFF"} else {"-Dgtest_build_tests=ON"}
72+
$gmock_build_tests = if ($env:generator -eq "MinGW Makefiles") {"-Dgmock_build_tests=OFF"} else {"-Dgmock_build_tests=ON"}
73+
& cmake -G "$env:generator" $conf -Dgtest_build_samples=ON $gtest_build_tests $gmock_build_tests ..
74+
if ($LastExitCode -ne 0) {
75+
throw "Exec: $ErrorMessage"
76+
}
77+
& cmake --build . --config $env:configuration
78+
if ($LastExitCode -ne 0) {
79+
throw "Exec: $ErrorMessage"
80+
}
81+
82+
test_script:
83+
- ps: |
84+
if ($env:generator -eq "MinGW Makefiles") {
85+
return # No test available for MinGW
86+
}
87+
& ctest -C $env:configuration --timeout 300 --output-on-failure
88+
if ($LastExitCode -ne 0) {
89+
throw "Exec: $ErrorMessage"
90+
}
91+
92+
artifacts:
93+
- path: '_build/CMakeFiles/*.log'
94+
name: logs
95+
- path: '_build/Testing/**/*.xml'
96+
name: test_results
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#!/usr/bin/env bash
2+
# Copyright 2017 Google Inc.
3+
# All Rights Reserved.
4+
#
5+
#
6+
# Redistribution and use in source and binary forms, with or without
7+
# modification, are permitted provided that the following conditions are
8+
# met:
9+
#
10+
# * Redistributions of source code must retain the above copyright
11+
# notice, this list of conditions and the following disclaimer.
12+
# * Redistributions in binary form must reproduce the above
13+
# copyright notice, this list of conditions and the following disclaimer
14+
# in the documentation and/or other materials provided with the
15+
# distribution.
16+
# * Neither the name of Google Inc. nor the names of its
17+
# contributors may be used to endorse or promote products derived from
18+
# this software without specific prior written permission.
19+
#
20+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21+
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22+
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23+
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24+
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25+
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26+
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27+
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28+
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29+
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30+
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31+
32+
#
33+
# This file should be sourced, and not executed as a standalone script.
34+
#
35+
36+
# TODO() - we can check if this is being sourced using $BASH_VERSION and $BASH_SOURCE[0] != ${0}.
37+
38+
if [ "${TRAVIS_OS_NAME}" = "linux" ]; then
39+
if [ "$CXX" = "g++" ]; then export CXX="g++-4.9" CC="gcc-4.9"; fi
40+
if [ "$CXX" = "clang++" ]; then export CXX="clang++-3.7" CC="clang-3.7"; fi
41+
fi

0 commit comments

Comments
 (0)