Skip to content

Commit

Permalink
[test] Use system googletest
Browse files Browse the repository at this point in the history
Also, add `libgtest-dev` as dependency for travis-ci.
(See Also:
 http://askubuntu.com/questions/145887/why-no-library-files-installed-for-google-test)

Close #43
  • Loading branch information
iblislin committed Mar 19, 2016
1 parent a7eb23a commit 074f02c
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 12 deletions.
10 changes: 7 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,23 @@ before_install:
- sudo add-apt-repository --yes ppa:chewing/chewing
- sudo add-apt-repository --yes ppa:chewing/travis-ci
- sudo apt-get update
# FIXME: We need to instal cmake-data manually to prevent cmake upgrade fails.
- sudo apt-get install --yes cmake-data cmake gcc-4.8 g++-4.8 help2man libchewing3-dev pkg-config qt5-default qttools5-dev-tools
# FIXME: We need to install cmake-data manually to prevent cmake upgrade fails.
- sudo apt-get install --yes cmake-data cmake gcc-4.8 g++-4.8 help2man libchewing3-dev pkg-config qt5-default qttools5-dev-tools libgtest-dev
- sudo ln -fs /usr/bin/gcc-4.8 /usr/bin/gcc
- gcc --version
- sudo ln -fs /usr/bin/g++-4.8 /usr/bin/g++
- g++ --version
- sudo ln -fs /usr/bin/gcov-4.8 /usr/bin/gcov
- gcov --version

# building libgtest on ubuntu
# ref: https://github.com/travis-ci/travis-ci/issues/1294
- "cd /usr/src/gtest && sudo cmake . && sudo cmake --build . && sudo mv libg* /usr/local/lib/ ; cd -"

script:
- cmake $OPTION .
- make -j2
- make -j2 check

after_success:
- if [ x$COVERALLS == xyes ]; then coveralls --exclude gmock --exclude test --exclude-pattern '.*CMake[^/]+\.c(?:pp)?' --exclude-pattern '.*_automoc.cpp'; fi
- if [ x$COVERALLS == xyes ]; then coveralls --exclude test --exclude-pattern '.*CMake[^/]+\.c(?:pp)?' --exclude-pattern '.*_automoc.cpp'; fi
5 changes: 2 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ install(

include_directories(
${PROJECT_BINARY_DIR}/include
${PROJECT_SOURCE_DIR}/gmock/gtest/include
${PROJECT_SOURCE_DIR}/src/exporter
${PROJECT_SOURCE_DIR}/src/importer
${PROJECT_SOURCE_DIR}/src/model
Expand Down Expand Up @@ -226,7 +225,6 @@ endif()

# testing
enable_testing()
add_subdirectory(gmock)

file(GLOB run-test_src
test/*.cpp
Expand All @@ -235,7 +233,8 @@ add_executable(run-test
${run-test_src}
)
target_link_libraries(run-test
gmock
gtest
gtest_main

exporter
importer
Expand Down
2 changes: 1 addition & 1 deletion test/testChewingExporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/

#include "gtest/gtest.h"
#include <gtest/gtest.h>

#include <QDebug>
#include <QFile>
Expand Down
2 changes: 1 addition & 1 deletion test/testChewingImporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/

#include "gtest/gtest.h"
#include <gtest/gtest.h>

#include <QDebug>
#include <QDir>
Expand Down
2 changes: 1 addition & 1 deletion test/testHashImporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/

#include "gtest/gtest.h"
#include <gtest/gtest.h>

#include <QDebug>
#include <QDir>
Expand Down
2 changes: 1 addition & 1 deletion test/testUserphraseImporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/

#include "gtest/gtest.h"
#include <gtest/gtest.h>

#include <QDebug>

Expand Down
2 changes: 1 addition & 1 deletion test/testUserphraseSet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/

#include "gtest/gtest.h"
#include <gtest/gtest.h>

#include "UserphraseSet.h"

Expand Down
2 changes: 1 addition & 1 deletion test/testmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include <QApplication>
#include <QFileInfo>

#include "gtest/gtest.h"
#include <gtest/gtest.h>

bool verbose = false;

Expand Down

0 comments on commit 074f02c

Please sign in to comment.