1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

CI: Support codecov

This commit is contained in:
winlin 2019-02-02 21:42:03 +08:00
parent 62087fdb05
commit 7243d8e7b8
5 changed files with 49 additions and 7 deletions

27
trunk/auto/coverage.sh Normal file
View file

@ -0,0 +1,27 @@
#!/bin/bash
# In .circleci/config.yml, generate *.gcno with
# ./configure --gcov --without-research --without-librtmp
# Generate *.gcda
./objs/srs_utest
ret=$?; if [[ $ret -ne 0 ]]; then echo "Run SRS utest failed, ret=$ret"; exit $ret; fi
# Collect all *.gcno and *.gcda to objs/cover.
(mkdir -p objs/cover && cd objs/cover &&
cp -R ../../src . &&
for file in `find ../src -name "*.gcno"`; do cp $file .; done &&
for file in `find ../src -name "*.gcda"`; do cp $file .; done)
ret=$?; if [[ $ret -ne 0 ]]; then echo "Collect *.gcno and *.gcda failed, ret=$ret"; exit $ret; fi
# Generate *.gcov to objs/cover
for file in `find src -name "*.cpp"`; do
(mkdir -p objs/cover && cd objs/cover && gcov ../../$file -o .)
ret=$?; if [[ $ret -ne 0 ]]; then echo "Collect $file failed, ret=$ret"; exit $ret; fi
done
# Upload report with *.gcov
export CODECOV_TOKEN="493bba46-c468-4e73-8b45-8cdd8ff62d96" &&
mkdir -p objs/cover && cd objs/cover &&
bash <(curl -s https://codecov.io/bash)
exit 0

View file

@ -43,16 +43,18 @@ SRS_DVR=YES
#
################################################################
# libraries
SRS_FFMPEG_STUB=RESERVED
SRS_FFMPEG_STUB=NO
# arguments
SRS_PREFIX=/usr/local/srs
SRS_JOBS=1
SRS_STATIC=RESERVED
SRS_STATIC=NO
# whether enable the gcov
SRS_GCOV=NO
# whether enable the log verbose/info/trace level.
# always enable the warn/error level.
SRS_LOG_VERBOSE=RESERVED
SRS_LOG_INFO=RESERVED
SRS_LOG_TRACE=RESERVED
SRS_LOG_VERBOSE=NO
SRS_LOG_INFO=NO
SRS_LOG_TRACE=NO
#
################################################################
# experts
@ -154,7 +156,8 @@ Options:
--without-mips-ubuntu12 do not cross build srs on ubuntu12 for mips.
--prefix=<path> The absolute installation path for srs. Default: $SRS_PREFIX
--static whether add '-static' to link options.
--static Whether add '-static' to link options.
--gcov Whether enable the GCOV compiler options.
--jobs[=N] Allow N jobs at once; infinite jobs with no arg.
used for make in the configure, for example, to make ffmpeg.
--log-verbose whether enable the log verbose level. default: no.
@ -267,6 +270,7 @@ function parse_user_option() {
--log-verbose) SRS_LOG_VERBOSE=YES ;;
--log-info) SRS_LOG_INFO=YES ;;
--log-trace) SRS_LOG_TRACE=YES ;;
--gcov) SRS_GCOV=YES ;;
--x86-x64) SRS_X86_X64=YES ;;
--x86-64) SRS_X86_X64=YES ;;
@ -640,6 +644,7 @@ SRS_AUTO_CONFIGURE="--prefix=${SRS_PREFIX}"
if [ $SRS_LOG_VERBOSE = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --log-verbose"; fi
if [ $SRS_LOG_INFO = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --log-info"; fi
if [ $SRS_LOG_TRACE = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --log-trace"; fi
if [ $SRS_GCOV = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --gcov"; fi
echo "User config: $SRS_AUTO_USER_CONFIGURE"
echo "Detail config: ${SRS_AUTO_CONFIGURE}"
}