File tree 11 files changed +135
-193
lines changed 11 files changed +135
-193
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ CMakeCache.txt
22
22
CMakeFiles
23
23
cmake_install.cmake
24
24
install_manifest.txt
25
+ CTestTestfile.cmake
25
26
26
27
# ignore thumbnails created by windows
27
28
Thumbs.db
@@ -56,5 +57,9 @@ _ReSharper*/
56
57
build * /
57
58
* ~
58
59
59
- # ignore binaries
60
- * _unittest
60
+ # ignore executable binaries
61
+ test /test_all
62
+
63
+ # ignore external lib
64
+ /lib /gmock /gmock /
65
+ /lib /gtest /gtest /
Original file line number Diff line number Diff line change 1
1
language : cpp
2
+ sudo : false
2
3
compiler :
3
- - gcc
4
+ - gcc
4
5
before_install :
5
- - sudo add-apt-repository -y "deb http://archive.ubuntu.com/ubuntu/ trusty main universe"
6
- - sudo apt-get update -qq
7
- - sudo apt-get install astyle=2.03-1 -qq
6
+ # astyle-2.03
7
+ # downloading astyle-2.03
8
+ - mkdir -p .travis-tmp/astyle-2.03
9
+ - wget -P .travis-tmp/astyle-2.03/ http://heanet.dl.sourceforge.net/project/astyle/astyle/astyle%202.03/astyle_2.03_linux.tar.gz
10
+ - tar xvzf .travis-tmp/astyle-2.03/astyle_2.03_linux.tar.gz -C .travis-tmp/astyle-2.03/
11
+ # build astyle-2.03
12
+ - pushd .travis-tmp/astyle-2.03/astyle/build/gcc && make && export PATH=`pwd`/bin:$PATH && popd
13
+ # cmake-3.2.2
14
+ - mkdir -p .travis-tmp/cmake-3.2.2
15
+ - wget --no-check-certificate -P .travis-tmp/cmake-3.2.2/ https://cmake.org/files/v3.2/cmake-3.2.2-Linux-x86_64.sh
16
+ - bash .travis-tmp/cmake-3.2.2/cmake-3.2.2-Linux-x86_64.sh --exclude-subdir --prefix=.travis-tmp/cmake-3.2.2 --skip-license
17
+ - export PATH=`pwd`/.travis-tmp/cmake-3.2.2/bin:$PATH
8
18
script :
9
- - pushd test && make test && popd
19
+ - ./build.sh
10
20
- ./script/travis_format_checcker.sh
Original file line number Diff line number Diff line change
1
+ cmake_minimum_required (VERSION 2.8.8)
2
+ project (arduino_mock)
3
+
4
+ find_package (Threads REQUIRED)
5
+ add_subdirectory (lib/gtest)
6
+ add_subdirectory (lib/gmock)
7
+
8
+ message ("building arduino_mock" )
9
+ message ("Gtest include: ${GTEST_INCLUDE_DIRS} " )
10
+ message ("Gmock include: ${GMOCK_INCLUDE_DIRS} " )
11
+ include_directories (${GTEST_INCLUDE_DIRS} ${GMOCK_INCLUDE_DIRS} include )
12
+ file (GLOB SRC
13
+ "src/ArduinoMockAll.cc"
14
+ )
15
+
16
+ add_library (arduino_mock STATIC ${SRC} )
17
+
18
+ target_include_directories (arduino_mock
19
+ PUBLIC "include"
20
+ )
21
+
22
+ target_link_libraries (arduino_mock
23
+ ${GTEST_LIBS_DIR} /libgtest.a
24
+ ${GMOCK_LIBS_DIR} /libgmock.a
25
+ ${CMAKE_THREAD_LIBS_INIT}
26
+ )
27
+
28
+ set_target_properties ( arduino_mock
29
+ PROPERTIES
30
+ ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR} /dist/lib"
31
+ LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR} /dist/lib"
32
+ RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR} /dist/bin"
33
+ )
34
+
35
+ add_dependencies (arduino_mock gtest gmock)
36
+
37
+ option (test "Build all tests." OFF )
38
+
39
+ if (test )
40
+ enable_testing ()
41
+ add_subdirectory (test )
42
+ endif ()
Original file line number Diff line number Diff line change
1
+ #! /bin/sh
2
+ set -eu
3
+
4
+ cd -- " $( dirname -- " $0 " ) "
5
+ mkdir -p build
6
+ cd build
7
+ cmake -Dtest=ON ..
8
+ make
9
+ ctest -V
Original file line number Diff line number Diff line change
1
+ cmake_minimum_required (VERSION 2.8.8)
2
+ project (gmock_builder C CXX)
3
+ include (ExternalProject)
4
+
5
+ ExternalProject_Add(gmock
6
+ URL https://googlemock.googlecode.com/files /gmock-1.7.0.zip
7
+ PREFIX ${CMAKE_CURRENT_BINARY_DIR} /gmock
8
+ INSTALL_COMMAND ""
9
+ )
10
+
11
+ # Specify include dir
12
+ ExternalProject_Get_Property(gmock source_dir)
13
+ set (GMOCK_INCLUDE_DIRS ${source_dir} /include PARENT_SCOPE)
14
+
15
+ # Specify MainTest's link libraries
16
+ ExternalProject_Get_Property(gmock binary_dir)
17
+ set (GMOCK_LIBS_DIR ${binary_dir} PARENT_SCOPE)
Original file line number Diff line number Diff line change
1
+ message ("in gtest" )
2
+ project (gtest_builder C CXX)
3
+ include (ExternalProject)
4
+
5
+ ExternalProject_Add(gtest
6
+ URL https://googletest.googlecode.com/files /gtest-1.7.0.zip
7
+ PREFIX ${CMAKE_CURRENT_BINARY_DIR} /gtest
8
+ INSTALL_COMMAND ""
9
+ )
10
+
11
+ # Specify include dir
12
+ ExternalProject_Get_Property(gtest source_dir)
13
+ set (GTEST_INCLUDE_DIRS ${source_dir} /include PARENT_SCOPE)
14
+
15
+ # Specify MainTest's link libraries
16
+ ExternalProject_Get_Property(gtest binary_dir)
17
+ set (GTEST_LIBS_DIR ${binary_dir} PARENT_SCOPE)
Original file line number Diff line number Diff line change
1
+ message ("building tests for Arduino Mock" )
2
+ # include_directories(${GTEST_INCLUDE_DIRS})
3
+ file (GLOB SRCS *.cc)
4
+
5
+ add_executable (test_all test_all.cc)
6
+
7
+ target_link_libraries (test_all
8
+ arduino_mock
9
+ ${GTEST_LIBS_DIR} /libgtest.a
10
+ ${GTEST_LIBS_DIR} /libgtest_main.a
11
+ ${GMOCK_LIBS_DIR} /libgmock.a
12
+ ${CMAKE_THREAD_LIBS_INIT}
13
+ )
14
+
15
+ add_dependencies (test_all gtest)
16
+ add_test (arduino_mock_test test_all)
Load Diff This file was deleted.
Submodule
gmock deleted from 896ba0e
Original file line number Diff line number Diff line change
1
+ #include " Arduino_unittest.cc"
2
+ #include " EEPROM_unittest.cc"
3
+ #include " Serial_unittest.cc"
4
+ #include " serialHelper_unittest.cc"
5
+ #include " Spark_unittest.cc"
6
+ #include " WiFi_unittest.cc"
7
+ #include " Wire_unittest.cc"
8
+
9
+ int main (int argc, char * argv[]) {
10
+ ::testing::InitGoogleTest (&argc, argv);
11
+ return RUN_ALL_TESTS ();
12
+ }
You can’t perform that action at this time.
0 commit comments