fix unit test build failed
This commit is contained in:
5
.gitignore
vendored
5
.gitignore
vendored
@@ -1,3 +1,6 @@
|
||||
initCoverage.info
|
||||
testCoverage.info
|
||||
coverageReport/
|
||||
.vscode/
|
||||
|
||||
ut_build/
|
||||
sdk_build/
|
||||
|
||||
14
.travis.yml
14
.travis.yml
@@ -1,20 +1,14 @@
|
||||
dist: xenial
|
||||
sudo: require
|
||||
language: cpp
|
||||
compiler: gcc
|
||||
|
||||
before_install:
|
||||
- sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
|
||||
- sudo apt-get update -qq
|
||||
|
||||
install:
|
||||
- sudo apt-get install -qq g++-5
|
||||
- sudo update-alternatives --install /usr/bin/gcov gcov /usr/bin/gcov-5 90
|
||||
- sudo apt-get install lcov libcurl4-openssl-dev libssl-dev uuid-dev libjsoncpp-dev
|
||||
|
||||
script:
|
||||
- cmake .
|
||||
- ./build.sh
|
||||
- ./travis_qmake_gcc_cpp11_gcov
|
||||
- ./get_code_cov.sh
|
||||
- ./unit_test.sh
|
||||
- ./generate_code_cov.sh
|
||||
|
||||
after_success:
|
||||
- bash <(curl -s https://codecov.io/bash)
|
||||
|
||||
28
generate_code_cov.sh
Executable file
28
generate_code_cov.sh
Executable file
@@ -0,0 +1,28 @@
|
||||
#!/bin/bash
|
||||
|
||||
cd `dirname $0`
|
||||
|
||||
UT_BUILD_DIR=ut_build
|
||||
|
||||
echo '--------- generate initial info ---------------- '
|
||||
lcov -d $UT_BUILD_DIR -z
|
||||
lcov -d $UT_BUILD_DIR -b . --no-external --initial -c -o initCoverage.info
|
||||
|
||||
echo '--------- run test ---------------- '
|
||||
cd $UT_BUILD_DIR
|
||||
ctest --verbose
|
||||
cd ..
|
||||
|
||||
echo '--------- generate post info ---------------- '
|
||||
lcov -d $UT_BUILD_DIR -b . --no-external -c -o testCoverage.info
|
||||
|
||||
echo '--------- generate html report ---------------- '
|
||||
genhtml -o coverageReport --prefix=`pwd` initCoverage.info testCoverage.info
|
||||
|
||||
echo 'check report: ' `pwd`/coverageReport/index.html
|
||||
|
||||
echo ' ------remove tmp file ------'
|
||||
|
||||
rm initCoverage.info
|
||||
rm testCoverage.info
|
||||
|
||||
17
unit_test.sh
Executable file
17
unit_test.sh
Executable file
@@ -0,0 +1,17 @@
|
||||
#!/bin/bash
|
||||
|
||||
cd `dirname $0`
|
||||
echo '-------build unit test----------'
|
||||
|
||||
UT_BUILD_DIR=ut_build
|
||||
rm -rf $UT_BUILD_DIR
|
||||
mkdir $UT_BUILD_DIR
|
||||
cd $UT_BUILD_DIR
|
||||
cmake ..
|
||||
make core_ut
|
||||
make httpserver_for_ut
|
||||
|
||||
echo '------- run unit test -----------'
|
||||
|
||||
ctest --verbose
|
||||
|
||||
Reference in New Issue
Block a user