mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-15 08:35:51 +00:00
Add coverage tracking via codecov.io
Conflicts: .travis.yml
This commit is contained in:
committed by
Edward Hennis
parent
8df88238cd
commit
f4fe55caff
5
.gitignore
vendored
5
.gitignore
vendored
@@ -24,6 +24,11 @@ bin/rippled
|
|||||||
Debug/*.*
|
Debug/*.*
|
||||||
Release/*.*
|
Release/*.*
|
||||||
|
|
||||||
|
# Ignore coverage files.
|
||||||
|
*.gcno
|
||||||
|
*.gcda
|
||||||
|
*.gcov
|
||||||
|
|
||||||
# Ignore locally installed node_modules
|
# Ignore locally installed node_modules
|
||||||
/node_modules
|
/node_modules
|
||||||
|
|
||||||
|
|||||||
59
.travis.yml
59
.travis.yml
@@ -19,12 +19,21 @@ env:
|
|||||||
# Env vars are not translated there.
|
# Env vars are not translated there.
|
||||||
- GCC_VER=4.8
|
- GCC_VER=4.8
|
||||||
matrix:
|
matrix:
|
||||||
|
- TARGET=coverage
|
||||||
- TARGET=debug
|
- TARGET=debug
|
||||||
- TARGET=debug.nounity
|
- TARGET=debug.nounity
|
||||||
# We can specify any combination of builds here, for example, to
|
# We can specify any combination of builds here, for example, to
|
||||||
# include release builds, too, uncomment the following lines.
|
# include release builds, too, uncomment the following lines.
|
||||||
#- TARGET=release
|
#- TARGET=release
|
||||||
#- TARGET=release.nounity
|
#- TARGET=release.nounity
|
||||||
|
matrix:
|
||||||
|
exclude:
|
||||||
|
# Because gcov won't work (easily) with clang
|
||||||
|
- env: TARGET=coverage
|
||||||
|
compiler: clang
|
||||||
|
# Because coverage target is basically debug + --coverage flags
|
||||||
|
- env: TARGET=debug
|
||||||
|
compiler: gcc
|
||||||
|
|
||||||
addons:
|
addons:
|
||||||
apt:
|
apt:
|
||||||
@@ -34,6 +43,7 @@ addons:
|
|||||||
- python-software-properties
|
- python-software-properties
|
||||||
# See also GCC_VER.
|
# See also GCC_VER.
|
||||||
- g++-4.8
|
- g++-4.8
|
||||||
|
- gcc-4.8
|
||||||
- protobuf-compiler
|
- protobuf-compiler
|
||||||
- libprotobuf-dev
|
- libprotobuf-dev
|
||||||
- libssl-dev
|
- libssl-dev
|
||||||
@@ -48,55 +58,10 @@ cache:
|
|||||||
- $BOOST_ROOT
|
- $BOOST_ROOT
|
||||||
|
|
||||||
before_install:
|
before_install:
|
||||||
# Override gcc version to $GCC_VER.
|
- bin/ci/ubuntu/install-dependencies.sh
|
||||||
# Put an appropriate symlink at the front of the path.
|
|
||||||
- mkdir -v $HOME/bin
|
|
||||||
- test -x $( type -p gcc-$GCC_VER )
|
|
||||||
- ln -sv $(type -p gcc-$GCC_VER) $HOME/bin/gcc
|
|
||||||
- test -x $( type -p g++-$GCC_VER )
|
|
||||||
- ln -sv $(type -p g++-$GCC_VER) $HOME/bin/g++
|
|
||||||
- export PATH=$PWD/bin:$PATH
|
|
||||||
|
|
||||||
# What versions are we ACTUALLY running?
|
|
||||||
- g++ -v
|
|
||||||
- clang -v
|
|
||||||
# Avoid `spurious errors` caused by ~/.npm permission issues
|
|
||||||
# Does it already exist? Who owns? What permissions?
|
|
||||||
- ls -lah ~/.npm || mkdir ~/.npm
|
|
||||||
# Make sure we own it
|
|
||||||
- chown -Rc $USER ~/.npm
|
|
||||||
|
|
||||||
- bash bin/sh/install-boost.sh
|
|
||||||
|
|
||||||
script:
|
script:
|
||||||
# Set so any failing command will abort the build
|
- bin/ci/ubuntu/build-and-test.sh
|
||||||
- set -e
|
|
||||||
# Make sure vcxproj is up to date
|
|
||||||
- scons vcxproj
|
|
||||||
- git diff --exit-code
|
|
||||||
# $CC will be either `clang` or `gcc`
|
|
||||||
# http://docs.travis-ci.com/user/migrating-from-legacy/?utm_source=legacy-notice&utm_medium=banner&utm_campaign=legacy-upgrade
|
|
||||||
# indicates that 2 cores are available to containers.
|
|
||||||
- scons -j2 $CC.$TARGET
|
|
||||||
# We can be sure we're using the build/$CC.$TARGET variant (-f so never err)
|
|
||||||
- rm -f build/rippled
|
|
||||||
- export RIPPLED_PATH="$PWD/build/$CC.$TARGET/rippled"
|
|
||||||
# See what we've actually built
|
|
||||||
- ldd $RIPPLED_PATH
|
|
||||||
# Run unittests (under gdb)
|
|
||||||
- | # create gdb script
|
|
||||||
echo "set env MALLOC_CHECK_=3" > script.gdb
|
|
||||||
echo "run" >> script.gdb
|
|
||||||
echo "backtrace full" >> script.gdb
|
|
||||||
# gdb --help
|
|
||||||
- cat script.gdb | gdb --ex 'set print thread-events off' --return-child-result --args $RIPPLED_PATH --unittest
|
|
||||||
- npm install
|
|
||||||
# Use build/(gcc|clang).$TARGET/rippled
|
|
||||||
- |
|
|
||||||
echo "exports.default_server_config = {\"rippled_path\" : \"$RIPPLED_PATH\"};" > test/config.js
|
|
||||||
|
|
||||||
# Run integration tests
|
|
||||||
- npm test
|
|
||||||
|
|
||||||
notifications:
|
notifications:
|
||||||
email:
|
email:
|
||||||
|
|||||||
21
SConstruct
21
SConstruct
@@ -15,11 +15,13 @@
|
|||||||
|
|
||||||
clang All clang variants
|
clang All clang variants
|
||||||
clang.debug clang debug variant
|
clang.debug clang debug variant
|
||||||
|
clang.coverage clang coverage variant
|
||||||
clang.release clang release variant
|
clang.release clang release variant
|
||||||
clang.profile clang profile variant
|
clang.profile clang profile variant
|
||||||
|
|
||||||
gcc All gcc variants
|
gcc All gcc variants
|
||||||
gcc.debug gcc debug variant
|
gcc.debug gcc debug variant
|
||||||
|
gcc.coverage gcc coverage variant
|
||||||
gcc.release gcc release variant
|
gcc.release gcc release variant
|
||||||
gcc.profile gcc profile variant
|
gcc.profile gcc profile variant
|
||||||
|
|
||||||
@@ -250,6 +252,9 @@ def print_coms(target, source, env):
|
|||||||
# TODO Add 'PROTOCCOM' to this list and make it work
|
# TODO Add 'PROTOCCOM' to this list and make it work
|
||||||
Beast.print_coms(['CXXCOM', 'CCCOM', 'LINKCOM'], env)
|
Beast.print_coms(['CXXCOM', 'CCCOM', 'LINKCOM'], env)
|
||||||
|
|
||||||
|
def is_debug_variant(variant):
|
||||||
|
return variant in ('debug', 'coverage')
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------------
|
||||||
|
|
||||||
# Set construction variables for the base environment
|
# Set construction variables for the base environment
|
||||||
@@ -311,7 +316,7 @@ def config_base(env):
|
|||||||
|
|
||||||
# Set toolchain and variant specific construction variables
|
# Set toolchain and variant specific construction variables
|
||||||
def config_env(toolchain, variant, env):
|
def config_env(toolchain, variant, env):
|
||||||
if variant == 'debug':
|
if is_debug_variant(variant):
|
||||||
env.Append(CPPDEFINES=['DEBUG', '_DEBUG'])
|
env.Append(CPPDEFINES=['DEBUG', '_DEBUG'])
|
||||||
|
|
||||||
elif variant == 'release' or variant == 'profile':
|
elif variant == 'release' or variant == 'profile':
|
||||||
@@ -416,6 +421,12 @@ def config_env(toolchain, variant, env):
|
|||||||
'-fno-strict-aliasing'
|
'-fno-strict-aliasing'
|
||||||
])
|
])
|
||||||
|
|
||||||
|
if variant == 'coverage':
|
||||||
|
env.Append(CXXFLAGS=[
|
||||||
|
'-fprofile-arcs', '-ftest-coverage'])
|
||||||
|
env.Append(LINKFLAGS=[
|
||||||
|
'-fprofile-arcs', '-ftest-coverage'])
|
||||||
|
|
||||||
if toolchain == 'clang':
|
if toolchain == 'clang':
|
||||||
if Beast.system.osx:
|
if Beast.system.osx:
|
||||||
env.Replace(CC='clang', CXX='clang++', LINK='clang++')
|
env.Replace(CC='clang', CXX='clang++', LINK='clang++')
|
||||||
@@ -443,7 +454,7 @@ def config_env(toolchain, variant, env):
|
|||||||
# If we are in debug mode, use GCC-specific functionality to add
|
# If we are in debug mode, use GCC-specific functionality to add
|
||||||
# extra error checking into the code (e.g. std::vector will throw
|
# extra error checking into the code (e.g. std::vector will throw
|
||||||
# for out-of-bounds conditions)
|
# for out-of-bounds conditions)
|
||||||
if variant == 'debug':
|
if is_debug_variant(variant):
|
||||||
env.Append(CPPDEFINES={
|
env.Append(CPPDEFINES={
|
||||||
'_FORTIFY_SOURCE': 2
|
'_FORTIFY_SOURCE': 2
|
||||||
})
|
})
|
||||||
@@ -562,7 +573,7 @@ base.Decider('MD5-timestamp')
|
|||||||
set_implicit_cache()
|
set_implicit_cache()
|
||||||
|
|
||||||
# Configure the toolchains, variants, default toolchain, and default target
|
# Configure the toolchains, variants, default toolchain, and default target
|
||||||
variants = ['debug', 'release', 'profile']
|
variants = ['debug', 'coverage', 'release', 'profile']
|
||||||
all_toolchains = ['clang', 'gcc', 'msvc']
|
all_toolchains = ['clang', 'gcc', 'msvc']
|
||||||
if Beast.system.osx:
|
if Beast.system.osx:
|
||||||
toolchains = ['clang']
|
toolchains = ['clang']
|
||||||
@@ -684,7 +695,7 @@ def get_classic_sources(toolchain):
|
|||||||
append_sources(result, *list_sources('src/ripple/shamap', '.cpp'))
|
append_sources(result, *list_sources('src/ripple/shamap', '.cpp'))
|
||||||
append_sources(result, *list_sources('src/ripple/test', '.cpp'))
|
append_sources(result, *list_sources('src/ripple/test', '.cpp'))
|
||||||
append_sources(result, *list_sources('src/ripple/unl', '.cpp'))
|
append_sources(result, *list_sources('src/ripple/unl', '.cpp'))
|
||||||
|
|
||||||
append_sources(
|
append_sources(
|
||||||
result,
|
result,
|
||||||
*list_sources('src/ripple/nodestore', '.cpp'),
|
*list_sources('src/ripple/nodestore', '.cpp'),
|
||||||
@@ -802,7 +813,7 @@ for tu_style in ['classic', 'unity']:
|
|||||||
for variant in variants:
|
for variant in variants:
|
||||||
if not should_prepare_targets(tu_style, toolchain, variant):
|
if not should_prepare_targets(tu_style, toolchain, variant):
|
||||||
continue
|
continue
|
||||||
if variant == 'profile' and toolchain == 'msvc':
|
if variant in ['profile', 'coverage'] and toolchain == 'msvc':
|
||||||
continue
|
continue
|
||||||
# Configure this variant's construction environment
|
# Configure this variant's construction environment
|
||||||
env = base.Clone()
|
env = base.Clone()
|
||||||
|
|||||||
36
bin/ci/ubuntu/build-and-test.sh
Executable file
36
bin/ci/ubuntu/build-and-test.sh
Executable file
@@ -0,0 +1,36 @@
|
|||||||
|
#!/bin/bash -u
|
||||||
|
# We use set -e and bash with -u to bail on first non zero exit code of any
|
||||||
|
# processes launched or upon any unbound variable
|
||||||
|
set -e
|
||||||
|
__dirname=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
|
||||||
|
echo "using CC: $CC"
|
||||||
|
echo "using TARGET: $TARGET"
|
||||||
|
export RIPPLED_PATH="$PWD/build/$CC.$TARGET/rippled"
|
||||||
|
echo "using RIPPLED_PATH: $RIPPLED_PATH"
|
||||||
|
# Make sure vcxproj is up to date
|
||||||
|
scons vcxproj
|
||||||
|
git diff --exit-code
|
||||||
|
# $CC will be either `clang` or `gcc`
|
||||||
|
# http://docs.travis-ci.com/user/migrating-from-legacy/?utm_source=legacy-notice&utm_medium=banner&utm_campaign=legacy-upgrade
|
||||||
|
# indicates that 2 cores are available to containers.
|
||||||
|
scons -j${NUM_PROCESSORS:-2} $CC.$TARGET
|
||||||
|
# We can be sure we're using the build/$CC.$TARGET variant
|
||||||
|
# (-f so never err)
|
||||||
|
rm -f build/rippled
|
||||||
|
|
||||||
|
# See what we've actually built
|
||||||
|
ldd $RIPPLED_PATH
|
||||||
|
if [[ $TARGET == "coverage" ]]; then
|
||||||
|
$RIPPLED_PATH --unittest
|
||||||
|
# We pass along -p to keep path segments so as to avoid collisions
|
||||||
|
codecov --gcov-args=-p --gcov-source-match='^src/(ripple|beast)'
|
||||||
|
else
|
||||||
|
# Run unittests (under gdb)
|
||||||
|
cat $__dirname/unittests.gdb | gdb \
|
||||||
|
--return-child-result \
|
||||||
|
--args $RIPPLED_PATH --unittest
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Run NPM tests
|
||||||
|
npm install
|
||||||
|
npm test --rippled=$RIPPLED_PATH
|
||||||
25
bin/ci/ubuntu/install-dependencies.sh
Executable file
25
bin/ci/ubuntu/install-dependencies.sh
Executable file
@@ -0,0 +1,25 @@
|
|||||||
|
#!/bin/bash -u
|
||||||
|
# Exit if anything fails.
|
||||||
|
set -e
|
||||||
|
# Override gcc version to $GCC_VER.
|
||||||
|
# Put an appropriate symlink at the front of the path.
|
||||||
|
mkdir -v $HOME/bin
|
||||||
|
for g in gcc g++ gcov gcc-ar gcc-nm gcc-ranlib
|
||||||
|
do
|
||||||
|
test -x $( type -p ${g}-$GCC_VER )
|
||||||
|
ln -sv $(type -p ${g}-$GCC_VER) $HOME/bin/${g}
|
||||||
|
done
|
||||||
|
export PATH=$PWD/bin:$PATH
|
||||||
|
|
||||||
|
# What versions are we ACTUALLY running?
|
||||||
|
g++ -v
|
||||||
|
clang -v
|
||||||
|
# Avoid `spurious errors` caused by ~/.npm permission issues
|
||||||
|
# Does it already exist? Who owns? What permissions?
|
||||||
|
ls -lah ~/.npm || mkdir ~/.npm
|
||||||
|
# Make sure we own it
|
||||||
|
chown -Rc $USER ~/.npm
|
||||||
|
# We use this so we can filter the subtrees from our coverage report
|
||||||
|
pip install --user https://github.com/sublimator/codecov-python/zipball/source-match
|
||||||
|
|
||||||
|
bash bin/sh/install-boost.sh
|
||||||
4
bin/ci/ubuntu/unittests.gdb
Normal file
4
bin/ci/ubuntu/unittests.gdb
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
set env MALLOC_CHECK_=3
|
||||||
|
set print thread-events off
|
||||||
|
run
|
||||||
|
backtrace full
|
||||||
Reference in New Issue
Block a user