Travis-CI additions:

* Address sanitizer target
* Code coverage target
* Results for codecov.io
This commit is contained in:
Nicholas Dudfield
2016-04-27 14:58:07 +07:00
committed by Vinnie Falco
parent e552ba7c2d
commit cdde9b5ef1
11 changed files with 257 additions and 56 deletions

View File

@ -1,4 +1,3 @@
sudo: false
language: cpp
env:
@ -8,55 +7,107 @@ env:
# Note that for simplicity, BOOST_ROOT's final
# namepart must match the folder name internal
# to boost's .tar.gz.
- LCOV_ROOT=$HOME/lcov
- VALGRIND_ROOT=$HOME/valgrind-install
- BOOST_ROOT=$HOME/boost_1_60_0
- BOOST_URL='http://downloads.sourceforge.net/project/boost/boost/1.60.0/boost_1_60_0.tar.gz?r=https%3A%2F%2Fsourceforge.net%2Fprojects%2Fboost%2Ffiles%2Fboost%2F1.60.0%2Fboost_1_60_0.tar.gz&ts=1460417589&use_mirror=netix'
packages: &gcc5_pkgs
- gcc-5
- g++-5
# - gcc-5-multilib
# - g++-5-multilib
# - gcc-multilib
# - g++-multilib
# - libgd2-xpm
# - ia32-libs
# - ia32-libs-multiarch
- python-software-properties
- protobuf-compiler
- libssl-dev
- libffi-dev
- libstdc++6
- binutils-gold
# Provides a backtrace if the unittests crash
- gdb
# Needed for installing valgrind
- subversion
- automake
- autotools-dev
- libc6-dbg
packages: &clang36_pkgs
- clang-3.6
- g++-5
- python-software-properties
- libssl-dev
- libffi-dev
- libstdc++6
- binutils-gold
# Provides a backtrace if the unittests crash
- gdb
# Needed for installing valgrind
- subversion
- automake
- autotools-dev
- libc6-dbg
matrix:
include:
# GCC/Debug
- compiler: gcc
env: GCC_VER=5 VARIANT=debug
env: GCC_VER=5 VARIANT=debug ADDRESS_MODEL=64
addons: &ao_gcc5
apt:
sources: ['ubuntu-toolchain-r-test']
packages: *gcc5_pkgs
# - compiler: gcc
# env: GCC_VER=5 VARIANT=debug ADDRESS_MODEL=32
# addons: *ao_gcc5
# GCC/Release
- compiler: gcc
env: GCC_VER=5 VARIANT=release
env: GCC_VER=5 VARIANT=release ADDRESS_MODEL=64
addons: *ao_gcc5
# # - compiler: gcc
# # env: GCC_VER=5 VARIANT=release ADDRESS_MODEL=32
# # addons: *ao_gcc5
# Clang/Debug
- compiler: clang
env: GCC_VER=5 VARIANT=debug CLANG_VER=3.6
env: GCC_VER=5 VARIANT=debug CLANG_VER=3.6 ADDRESS_MODEL=64
addons: &ao_clang36
apt:
sources: ['ubuntu-toolchain-r-test', 'llvm-toolchain-precise-3.6']
packages: *clang36_pkgs
# # - compiler: clang
# # env: GCC_VER=5 VARIANT=debug CLANG_VER=3.6 ADDRESS_MODEL=32
# # addons: *ao_clang36
# Clang/Release
- compiler: clang
env: GCC_VER=5 VARIANT=release CLANG_VER=3.6
env: GCC_VER=5 VARIANT=release CLANG_VER=3.6 ADDRESS_MODEL=64
addons: *ao_clang36
# # - compiler: clang
# # env: GCC_VER=5 VARIANT=release CLANG_VER=3.6 ADDRESS_MODEL=32
# # addons: *ao_clang36
# Coverage
- compiler: gcc
env: GCC_VER=5 VARIANT=coverage ADDRESS_MODEL=64
addons: *ao_gcc5
# ASAN
- compiler: gcc
env: GCC_VER=5 VARIANT=asan ADDRESS_MODEL=64
addons: *ao_gcc5
cache:
directories:
- $BOOST_ROOT
- $VALGRIND_ROOT
before_install:
- scripts/install-dependencies.sh
@ -64,6 +115,9 @@ before_install:
script:
- scripts/build-and-test.sh
after_script:
- cat nohup.out || echo "nohup.out already deleted"
notifications:
email:
false

16
Jamroot
View File

@ -45,6 +45,22 @@ else
lib crypto ;
}
variant coverage
:
debug
:
<cxxflags>"-fprofile-arcs -ftest-coverage"
<linkflags>"-lgcov"
;
variant asan
:
release
:
<cxxflags>"-fsanitize=address -fno-omit-frame-pointer"
<linkflags>"-fsanitize=address"
;
project beast
: requirements
<include>.

View File

@ -1,4 +1,4 @@
# Beast [![Build Status](https://travis-ci.org/vinniefalco/Beast.svg?branch=master)](https://travis-ci.org/vinniefalco/Beast)
# Beast [![Build Status](https://travis-ci.org/vinniefalco/Beast.svg?branch=master)](https://travis-ci.org/vinniefalco/Beast) [![codecov](https://codecov.io/gh/sublimator/Beast/branch/master/graph/badge.svg)](https://codecov.io/gh/sublimator/Beast)
Beast provides implementations of the HTTP and WebSocket protocols
built on top of Boost.Asio and other parts of boost.

View File

@ -1,9 +1,83 @@
#!/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 )
shopt -s globstar
set -ex
################################## ENVIRONMENT #################################
export PATH=$VALGRIND_ROOT/bin:$LCOV_ROOT/usr/bin:$PATH
echo "using toolset: $CC"
echo "using variant: $VARIANT"
echo "using address-model: $ADDRESS_MODEL"
echo "using PATH: $PATH"
$BOOST_ROOT/bjam toolset=$CC variant=$VARIANT
#################################### HELPERS ###################################
function run_tests_with_gdb {
for x in bin/**/*-tests; do scripts/run-with-gdb.sh "$x"; done
}
function build_beast {
$BOOST_ROOT/bjam toolset=$CC \
variant=$VARIANT \
address-model=$ADDRESS_MODEL
}
##################################### BUILD ####################################
build_beast
##################################### TESTS ####################################
if [[ $VARIANT == "coverage" ]]; then
find . -name "*.gcda" | xargs rm -f
rm *.info -f
# Create baseline coverage data file
lcov --no-external -c -i -d . -o baseline.info > /dev/null
# Perform test
run_tests_with_gdb
# Run autobahn tests
export SERVER=`find . -name "websocket-echo"`
nohup scripts/run-with-gdb.sh $SERVER&
# We need to wait a while so wstest can connect!
sleep 5
# cd scripts && wstest -m fuzzingclient
# cd ..
# Show the output
cat nohup.out
rm nohup.out
jobs
# Kill it gracefully
kill -INT %1
sleep 1
kill -INT %1 || echo "Dead already"
# Create test coverage data file
lcov --no-external -c -d . -o testrun.info > /dev/null
# Combine baseline and test coverage data
lcov -a baseline.info -a testrun.info -o lcov-all.info > /dev/null
# Extract only include/beast, and don\'t report on examples/test
lcov -e "lcov-all.info" "*/include/beast/*" -o lcov.info > /dev/null
~/.local/bin/codecov -X gcov
else
# TODO: make a function
run_tests_with_gdb
if [[ $VARIANT == "debug" ]]; then
for x in bin/**/*-tests; do
# if [[ $x != "bench-tests" ]]; then
valgrind --error-exitcode=1 "$x"
## declare -i RESULT=$RESULT + $?
# fi
done
echo
fi
fi

View File

@ -0,0 +1,14 @@
{
"outdir": "./autoresults",
"servers": [
{
"url": "ws://127.0.0.1:6000"
},
{
"url": "ws://127.0.0.1:6001"
}
],
"cases": ["*"],
"exclude-cases": [],
"exclude-agent-cases": {}
}

View File

@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash -u
# Assumptions:
# 1) BOOST_ROOT and BOOST_URL are already defined,
# and contain valid values.
@ -13,7 +13,10 @@ then
cd `dirname $BOOST_ROOT`
rm -fr ${BOOST_ROOT}
tar xzf /tmp/boost.tar.gz
params="define=_GLIBCXX_USE_CXX11_ABI=0 --with-program_options --with-system"
params="define=_GLIBCXX_USE_CXX11_ABI=0 \
address-model=$ADDRESS_MODEL --with-program_options \
--with-system --with-coroutine --with-filesystem"
cd $BOOST_ROOT && \
./bootstrap.sh --prefix=$BOOST_ROOT && \
./b2 -d1 $params && \

View File

@ -14,7 +14,8 @@ do
test -x $( type -p ${c}-$CLANG_VER )
ln -sv $(type -p ${c}-$CLANG_VER) $HOME/bin/${c}
done
export PATH=$PWD/bin:$PATH
# NOTE, changed from PWD -> HOME
export PATH=$HOME/bin:$PATH
# What versions are we ACTUALLY running?
if [ -x $HOME/bin/g++ ]; then
@ -29,6 +30,17 @@ 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/vinniefalco/codecov-python/zipball/source-match
pip install --user https://github.com/codecov/codecov-python/archive/master.zip
pip install --user autobahntestsuite
bash scripts/install-boost.sh
bash scripts/install-valgrind.sh
# Install lcov
# Download the archive
wget http://downloads.sourceforge.net/ltp/lcov-1.12.tar.gz
# Extract to ~/lcov-1.12
tar xfvz lcov-1.12.tar.gz -C $HOME
# Set install path
mkdir -p $LCOV_ROOT
cd $HOME/lcov-1.12 && make install PREFIX=$LCOV_ROOT

View File

@ -0,0 +1,20 @@
#!/bin/bash -u
# Assumptions:
# 1) VALGRIND_ROOT is already defined, and contains a valid values
set -e
if [ ! -d "$VALGRIND_ROOT/bin" ]
then
# These are specified in the addons/apt section of .travis.yml
# sudo apt-get install subversion automake autotools-dev libc6-dbg
export PATH=$PATH:$VALGRIND_ROOT/bin
svn co svn://svn.valgrind.org/valgrind/trunk valgrind-co
cd valgrind-co
./autogen.sh
./configure --prefix=$VALGRIND_ROOT
make
make install
# test it
valgrind ls -l
else
echo "Using cached valgrind at $VALGRIND_ROOT"
fi

8
scripts/run-with-gdb.sh Executable file
View File

@ -0,0 +1,8 @@
#!/bin/bash -u
set -e
gdb --silent \
--batch \
--return-child-result \
-ex=run \
-ex="thread apply all bt full" \
--args $@

View File

@ -55,7 +55,7 @@ if (NOT WIN32)
target_link_libraries(http-tests ${Boost_LIBRARIES})
endif()
add_executable (parser-bench
add_executable (bench-tests
${BEAST_INCLUDES}
main.cpp
http/nodejs_parser.cpp

View File

@ -49,7 +49,7 @@ unit-test http-tests :
http/write.cpp
;
unit-test parser-bench :
unit-test bench-tests :
main.cpp
http/nodejs_parser.cpp
http/parser_bench.cpp