Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/snikulov/google-test-examples
Short example how to use Google Test with CMake project
https://github.com/snikulov/google-test-examples
c-plus-plus cmake cpp docker-container gtest
Last synced: 2 days ago
JSON representation
Short example how to use Google Test with CMake project
- Host: GitHub
- URL: https://github.com/snikulov/google-test-examples
- Owner: snikulov
- Created: 2011-05-19T11:52:40.000Z (over 13 years ago)
- Default Branch: master
- Last Pushed: 2023-12-31T13:56:28.000Z (about 1 year ago)
- Last Synced: 2025-01-13T02:08:40.666Z (10 days ago)
- Topics: c-plus-plus, cmake, cpp, docker-container, gtest
- Language: CMake
- Homepage:
- Size: 25.4 KB
- Stars: 273
- Watchers: 23
- Forks: 78
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Short sample how-to use Google C++ Test Framework in cmakeable projects
1. Google test will be downloaded from GitHub and built with your project
## How to use:
1. git clone https://github.com/snikulov/google-test-examples.git
2. cd google-test-examples
3. mkdir build
4. cd build
5. cmake ..
6. cmake --build .
7. ctest -VV## CI status:
[![Build Status](https://travis-ci.org/snikulov/google-test-examples.svg?branch=master)](https://travis-ci.org/snikulov/google-test-examples) | [![Build status](https://ci.appveyor.com/api/projects/status/t30uakdk0awxy88p/branch/master?svg=true)](https://ci.appveyor.com/project/snikulov/google-test-examples/branch/master)
## Known issues:
- TBD
---# How to use (alternativ with docker containers)
## Get repo
```bash
$ git clone https://github.com/snikulov/google-test-examples.git
$ cd google-test-examples
```## CMake
We can use CMake to configure/build/running tests:### Host side
```bash
$ cmake -P build.cmake
```### Docker Containers side
```bash
cmake -P build_with_docker.cmake
```## Makefile
### Targets
```bash
$ make [tab]
make all
all build/Makefile configure google-test-examples_test
build clean DOCKER_COMMAND run
build_directory clean_docker_image docker_image
build_docker_image CMAKE_COMMAND DOCKER_IMAGE
```### Configure/Build/Running tests (with docker containers)
```bash
$ make all
docker build -t atty/google-test-examples:latest --file docker/Dockerfile .
Sending build context to Docker daemon 221.2kB
Step 1/1 : FROM rikorose/gcc-cmake:latest
...
1/1 Test #1: test1 ............................ Passed 0.00 sec
100% tests passed, 0 tests failed out of 1Total Test time (real) = 0.00 sec
```## Screencast recording
[![asciicast](https://asciinema.org/a/a03v5lmsoph7l0lhish1jkwqo.png)](https://asciinema.org/a/a03v5lmsoph7l0lhish1jkwqo)