Skip to content
Snippets Groups Projects
Commit b5f5c596 authored by Gennadiy Civil's avatar Gennadiy Civil
Browse files

Merge pull request #2000 from ciband:feat/add_support_platformio

PiperOrigin-RevId: 225552792
parents c6cb7e03 31eb5e9b
No related branches found
No related tags found
No related merge requests found
...@@ -10,6 +10,13 @@ language: cpp ...@@ -10,6 +10,13 @@ language: cpp
# It is more tedious, but grants us far more flexibility. # It is more tedious, but grants us far more flexibility.
matrix: matrix:
include: include:
- os: linux
dist: trusty
sudo: required
group: deprecated-2017Q3
before_install: chmod -R +x ./ci/*platformio.sh
install: ./ci/install-platformio.sh
script: ./ci/build-platformio.sh
- os: linux - os: linux
compiler: gcc compiler: gcc
sudo : true sudo : true
...@@ -44,18 +51,6 @@ matrix: ...@@ -44,18 +51,6 @@ matrix:
env: BUILD_TYPE=Release VERBOSE=1 CXX_FLAGS=-std=c++11 env: BUILD_TYPE=Release VERBOSE=1 CXX_FLAGS=-std=c++11
if: type != pull_request if: type != pull_request
before_install:
- |
if [ "$TRAVIS_OS_NAME" != "osx" ] && [ ! -f ${TRAVIS_BUILD_DIR}/apt-cache/pkgcache.bin ]; then
mkdir -p ${TRAVIS_BUILD_DIR}/apt-cache/archives/partial
mkdir -p ${TRAVIS_BUILD_DIR}/apt-cache/partial
mkdir -p ${TRAVIS_BUILD_DIR}/apt-cache/lists
sudo apt-get -y -o Dir::cache=${TRAVIS_BUILD_DIR}/apt-cache -o Dir::State::Lists=${TRAVIS_BUILD_DIR}/apt-cache/lists update
sudo apt-get install --download-only -o Dir::cache=${TRAVIS_BUILD_DIR}/apt-cache -o Dir::State::Lists=${TRAVIS_BUILD_DIR}/apt-cache/lists g++-4.9 clang-3.9
fi
- if [ "$TRAVIS_OS_NAME" != "osx" ]; then sudo apt-get install --no-download -o Dir::cache=${TRAVIS_BUILD_DIR}/apt-cache -o Dir::State::Lists=${TRAVIS_BUILD_DIR}/apt-cache/lists g++-4.9 clang-3.9; fi
- if [ "$TRAVIS_OS_NAME" != "osx" ]; then sudo chown -R $USER ${TRAVIS_BUILD_DIR}/apt-cache; fi
# These are the install and build (script) phases for the most common entries in the matrix. They could be included # These are the install and build (script) phases for the most common entries in the matrix. They could be included
# in each entry in the matrix, but that is just repetitive. # in each entry in the matrix, but that is just repetitive.
install: install:
...@@ -75,10 +70,9 @@ addons: ...@@ -75,10 +70,9 @@ addons:
sources: sources:
- ubuntu-toolchain-r-test - ubuntu-toolchain-r-test
- llvm-toolchain-precise-3.9 - llvm-toolchain-precise-3.9
packages:
cache: - g++-4.9
directories: - clang-3.9
- apt-cache
notifications: notifications:
email: false email: false
# Google Test # # Google Test #
[![Build Status](https://api.travis-ci.org/google/googletest.svg?branch=master)](https://travis-ci.org/google/googletest) [![Build Status](https://api.travis-ci.org/abseil/googletest.svg?branch=master)](https://travis-ci.org/abseil/googletest)
[![Build status](https://ci.appveyor.com/api/projects/status/4o38plt0xbo1ubc8/branch/master?svg=true)](https://ci.appveyor.com/project/GoogleTestAppVeyor/googletest/branch/master) [![Build status](https://ci.appveyor.com/api/projects/status/4o38plt0xbo1ubc8/branch/master?svg=true)](https://ci.appveyor.com/project/GoogleTestAppVeyor/googletest/branch/master)
**Future Plans**: **Future Plans**:
...@@ -16,7 +16,7 @@ This repository is a merger of the formerly separate GoogleTest and ...@@ -16,7 +16,7 @@ This repository is a merger of the formerly separate GoogleTest and
GoogleMock projects. These were so closely related that it makes sense to GoogleMock projects. These were so closely related that it makes sense to
maintain and release them together. maintain and release them together.
Please the mailing list at googletestframework@googlegroups.com for questions, discussions, and development. Please subscribe to the mailing list at googletestframework@googlegroups.com for questions, discussions, and development.
There is also an IRC channel on [OFTC](https://webchat.oftc.net/) (irc.oftc.net) #gtest available. There is also an IRC channel on [OFTC](https://webchat.oftc.net/) (irc.oftc.net) #gtest available.
Getting started information for **Google Test** is available in the Getting started information for **Google Test** is available in the
......
# run PlatformIO builds
platformio run
# install PlatformIO
sudo pip install -U platformio
# update PlatformIO
platformio update
...@@ -32,6 +32,22 @@ ...@@ -32,6 +32,22 @@
#include "gmock/gmock.h" #include "gmock/gmock.h"
#include "gtest/gtest.h" #include "gtest/gtest.h"
#ifdef ARDUINO
void setup() {
// Since Arduino doesn't have a command line, fake out the argc/argv arguments
int argc = 1;
const auto arg0 = "PlatformIO";
char* argv0 = const_cast<char*>(arg0);
char** argv = &argv0;
// Since Google Mock depends on Google Test, InitGoogleMock() is
// also responsible for initializing Google Test. Therefore there's
// no need for calling testing::InitGoogleTest() separately.
testing::InitGoogleMock(&argc, argv);
}
void loop() { RUN_ALL_TESTS(); }
#else
// MS C++ compiler/linker has a bug on Windows (not on Windows CE), which // MS C++ compiler/linker has a bug on Windows (not on Windows CE), which
// causes a link error when _tmain is defined in a static library and UNICODE // causes a link error when _tmain is defined in a static library and UNICODE
// is enabled. For this reason instead of _tmain, main function is used on // is enabled. For this reason instead of _tmain, main function is used on
...@@ -52,3 +68,4 @@ GTEST_API_ int main(int argc, char** argv) { ...@@ -52,3 +68,4 @@ GTEST_API_ int main(int argc, char** argv) {
testing::InitGoogleMock(&argc, argv); testing::InitGoogleMock(&argc, argv);
return RUN_ALL_TESTS(); return RUN_ALL_TESTS();
} }
#endif
...@@ -30,8 +30,24 @@ ...@@ -30,8 +30,24 @@
#include <stdio.h> #include <stdio.h>
#include "gtest/gtest.h" #include "gtest/gtest.h"
#ifdef ARDUINO
void setup() {
// Since Arduino doesn't have a command line, fake out the argc/argv arguments
int argc = 1;
const auto arg0 = "PlatformIO";
char* argv0 = const_cast<char*>(arg0);
char** argv = &argv0;
testing::InitGoogleTest(&argc, argv);
}
void loop() { RUN_ALL_TESTS(); }
#else
GTEST_API_ int main(int argc, char **argv) { GTEST_API_ int main(int argc, char **argv) {
printf("Running main() from %s\n", __FILE__); printf("Running main() from %s\n", __FILE__);
testing::InitGoogleTest(&argc, argv); testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS(); return RUN_ALL_TESTS();
} }
#endif
{
"name": "googletest",
"keywords": "unittest, unit, test, gtest, gmock",
"description": "googletest is a testing framework developed by the Testing Technology team with Google's specific requirements and constraints in mind. No matter whether you work on Linux, Windows, or a Mac, if you write C++ code, googletest can help you. And it supports any kind of tests, not just unit tests.",
"license": "BSD-3-Clause",
"homepage": "https://github.com/abseil/googletest/blob/master/README.md",
"repository": {
"type": "git",
"url": "https://github.com/abseil/googletest.git"
},
"version": "1.8.1",
"exclude": [
"ci",
"googlemock/build-aux",
"googlemock/cmake",
"googlemock/make",
"googlemock/msvc",
"googlemock/scripts",
"googlemock/test",
"googlemock/CMakeLists.txt",
"googlemock/Makefile.am",
"googlemock/configure.ac",
"googletest/cmake",
"googletest/codegear",
"googletest/m4",
"googletest/make",
"googletest/msvc",
"googletest/scripts",
"googletest/test",
"googletest/xcode",
"googletest/CMakeLists.txt",
"googletest/Makefile.am",
"googletest/configure.ac",
],
"frameworks": "arduino",
"platforms": [
"espressif32"
],
"export": {
"include": [
"googlemock/include/*",
"googletest/include/*"
]
},
"build": {
"flags": [
"-I googlemock/include",
"-I googletest/include"
]
}
}
; PlatformIO Project Configuration File
;
; Build options: build flags, source filter
; Upload options: custom upload port, speed and extra flags
; Library options: dependencies, extra library storages
; Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; http://docs.platformio.org/page/projectconf.html
[platformio]
#src_dir = ./googlemock
#src_dir = ./googletest
src_dir = .
[env:googletest_esp32]
platform = espressif32
board = esp32dev
framework = arduino
build_flags = -I./googletest/include -I./googletest
src_filter = +<*> -<.git/> -<googlemock> -<googletest/codegear/> -<googletest/samples> -<googletest/test/> -<googletest/xcode> -<googletest/src> +<googletest/src/gtest-all.cc> +<googletest/src/gtest_main.cc>
upload_speed = 921600
[env:googlemock_esp32]
platform = espressif32
board = esp32dev
framework = arduino
build_flags = -I./googlemock/include -I./googletest/include -I./googletest -I./googlemock
src_filter = +<*> -<.git/> -<googletest> -<googlemock/test/> -<googlemock/src> +<googlemock/src/gmock-all.cc> +<googlemock/src/gmock_main.cc> +<googletest/src/gtest-all.cc>
upload_speed = 921600
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment