forked from boostorg/beast
Tidy up Travis for code coverage
This commit is contained in:
24
.travis.yml
24
.travis.yml
@@ -4,11 +4,6 @@ language: cpp
|
|||||||
env:
|
env:
|
||||||
global:
|
global:
|
||||||
- LLVM_VERSION=3.8.0
|
- LLVM_VERSION=3.8.0
|
||||||
# Maintenance note: to move to a new version
|
|
||||||
# of boost, update both BOOST_ROOT and BOOST_URL.
|
|
||||||
# Note that for simplicity, BOOST_ROOT's final
|
|
||||||
# namepart must match the folder name internal
|
|
||||||
# to boost's .tar.gz.
|
|
||||||
- LCOV_ROOT=$HOME/lcov
|
- LCOV_ROOT=$HOME/lcov
|
||||||
- VALGRIND_ROOT=$HOME/valgrind-install
|
- VALGRIND_ROOT=$HOME/valgrind-install
|
||||||
|
|
||||||
@@ -23,11 +18,6 @@ addons:
|
|||||||
- binutils-gold
|
- binutils-gold
|
||||||
# Provides a backtrace if the unittests crash
|
# Provides a backtrace if the unittests crash
|
||||||
- gdb
|
- gdb
|
||||||
# Needed for installing valgrind
|
|
||||||
- subversion
|
|
||||||
- automake
|
|
||||||
- autotools-dev
|
|
||||||
- libc6-dbg
|
|
||||||
|
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
@@ -41,13 +31,12 @@ matrix:
|
|||||||
- VARIANT=coverage
|
- VARIANT=coverage
|
||||||
- ADDRESS_MODEL=64
|
- ADDRESS_MODEL=64
|
||||||
- DO_VALGRIND=false
|
- DO_VALGRIND=false
|
||||||
#- BUILD_SYSTEM=cmake
|
|
||||||
- PATH=$PWD/cmake/bin:$PATH
|
|
||||||
addons:
|
addons:
|
||||||
apt:
|
apt:
|
||||||
packages:
|
packages:
|
||||||
- gcc-6
|
- gcc-6
|
||||||
- g++-6
|
- g++-6
|
||||||
|
- lcov
|
||||||
- libssl-dev
|
- libssl-dev
|
||||||
- *base_packages
|
- *base_packages
|
||||||
sources:
|
sources:
|
||||||
@@ -82,14 +71,13 @@ matrix:
|
|||||||
- VARIANT=release
|
- VARIANT=release
|
||||||
- DO_VALGRIND=true
|
- DO_VALGRIND=true
|
||||||
- ADDRESS_MODEL=64
|
- ADDRESS_MODEL=64
|
||||||
#- BUILD_SYSTEM=cmake
|
|
||||||
- PATH=$PWD/cmake/bin:$PATH
|
|
||||||
addons:
|
addons:
|
||||||
apt:
|
apt:
|
||||||
packages:
|
packages:
|
||||||
- gcc-5
|
- gcc-5
|
||||||
- g++-5
|
- g++-5
|
||||||
- libssl-dev
|
- libssl-dev
|
||||||
|
- valgrind
|
||||||
- *base_packages
|
- *base_packages
|
||||||
sources:
|
sources:
|
||||||
- *base_sources
|
- *base_sources
|
||||||
@@ -106,8 +94,6 @@ matrix:
|
|||||||
- DO_VALGRIND=false
|
- DO_VALGRIND=false
|
||||||
- ADDRESS_MODEL=64
|
- ADDRESS_MODEL=64
|
||||||
- UBSAN_OPTIONS='print_stacktrace=1'
|
- UBSAN_OPTIONS='print_stacktrace=1'
|
||||||
#- BUILD_SYSTEM=cmake
|
|
||||||
- PATH=$PWD/cmake/bin:$PATH
|
|
||||||
- PATH=$PWD/llvm-$LLVM_VERSION/bin:$PATH
|
- PATH=$PWD/llvm-$LLVM_VERSION/bin:$PATH
|
||||||
addons:
|
addons:
|
||||||
apt:
|
apt:
|
||||||
@@ -119,12 +105,6 @@ matrix:
|
|||||||
sources:
|
sources:
|
||||||
- *base_sources
|
- *base_sources
|
||||||
|
|
||||||
cache:
|
|
||||||
directories:
|
|
||||||
- $VALGRIND_ROOT
|
|
||||||
- llvm-$LLVM_VERSION
|
|
||||||
- cmake
|
|
||||||
|
|
||||||
before_install: &base_before_install
|
before_install: &base_before_install
|
||||||
- scripts/install-dependencies.sh
|
- scripts/install-dependencies.sh
|
||||||
|
|
||||||
|
@@ -78,115 +78,51 @@ function run_tests {
|
|||||||
|
|
||||||
function run_tests_with_valgrind {
|
function run_tests_with_valgrind {
|
||||||
for x in $BOOST_ROOT/bin.v2/libs/beast/test/**/$VARIANT/**/fat-tests; do
|
for x in $BOOST_ROOT/bin.v2/libs/beast/test/**/$VARIANT/**/fat-tests; do
|
||||||
if [[ $(basename $x) == "bench-tests" ]]; then
|
|
||||||
$x
|
|
||||||
else
|
|
||||||
# TODO --max-stackframe=8388608
|
# TODO --max-stackframe=8388608
|
||||||
# see: https://travis-ci.org/vinniefalco/Beast/jobs/132486245
|
# see: https://travis-ci.org/vinniefalco/Beast/jobs/132486245
|
||||||
valgrind --suppressions=$BOOST_ROOT/libs/beast/scripts/valgrind.supp --error-exitcode=1 "$x"
|
valgrind --suppressions=$BOOST_ROOT/libs/beast/scripts/valgrind.supp --error-exitcode=1 "$x"
|
||||||
fi
|
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
function build_bjam {
|
function build_bjam {
|
||||||
if [[ $VARIANT == "coverage" ]]; then
|
if [[ $VARIANT == "coverage" ]]; then
|
||||||
bjam libs/beast/test//fat-tests toolset=$TOOLSET variant=$VARIANT address-model=$ADDRESS_MODEL -j${num_jobs}
|
bjam \
|
||||||
|
libs/beast/test/beast/core//fat-tests \
|
||||||
|
libs/beast/test/beast/http//fat-tests \
|
||||||
|
libs/beast/test/beast/websocket//fat-tests \
|
||||||
|
libs/beast/test/beast/zlib//fat-tests \
|
||||||
|
toolset=$TOOLSET variant=$VARIANT address-model=$ADDRESS_MODEL -j${num_jobs}
|
||||||
else
|
else
|
||||||
bjam libs/beast/test//fat-tests toolset=$TOOLSET variant=$VARIANT address-model=$ADDRESS_MODEL -j${num_jobs}
|
bjam \
|
||||||
bjam libs/beast/bench toolset=$TOOLSET variant=$VARIANT address-model=$ADDRESS_MODEL -j${num_jobs}
|
libs/beast/test//fat-tests \
|
||||||
bjam libs/beast/example toolset=$TOOLSET variant=$VARIANT address-model=$ADDRESS_MODEL -j${num_jobs}
|
libs/beast/bench \
|
||||||
|
libs/beast/example \
|
||||||
|
toolset=$TOOLSET variant=$VARIANT address-model=$ADDRESS_MODEL -j${num_jobs}
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function build_cmake {
|
|
||||||
mkdir -p build
|
|
||||||
pushd build > /dev/null
|
|
||||||
cmake -DVARIANT=${VARIANT} ..
|
|
||||||
make -j${num_jobs}
|
|
||||||
mkdir -p ../bin/$VARIANT
|
|
||||||
find . -executable -type f -exec cp {} ../bin/$VARIANT/. \;
|
|
||||||
popd > /dev/null
|
|
||||||
}
|
|
||||||
|
|
||||||
function run_autobahn_test_suite {
|
|
||||||
# Run autobahn tests
|
|
||||||
wsecho=$(find bin -name "websocket-echo" | grep /$VARIANT/)
|
|
||||||
nohup $wsecho&
|
|
||||||
|
|
||||||
# We need to wait a while so wstest can connect!
|
|
||||||
sleep 5
|
|
||||||
# Show the output (if any) as it is generated
|
|
||||||
tail -f nohup.out &
|
|
||||||
cd scripts && wstest -m fuzzingclient
|
|
||||||
cd ..
|
|
||||||
rm nohup.out
|
|
||||||
# Show what jobs are running
|
|
||||||
jobs
|
|
||||||
# Wait a while for things to wind down before issuing a kill
|
|
||||||
sleep 5
|
|
||||||
# Kill it gracefully
|
|
||||||
kill -INT %1
|
|
||||||
kill -INT %2
|
|
||||||
# Wait for all the jobs to finish
|
|
||||||
wait
|
|
||||||
# Parse the test results, with python>=2.5<3 script
|
|
||||||
python scripts/parseautobahn.py scripts/autoresults/index.json
|
|
||||||
}
|
|
||||||
|
|
||||||
##################################### BUILD ####################################
|
|
||||||
|
|
||||||
if [[ ${BUILD_SYSTEM:-} == cmake ]]; then
|
|
||||||
build_cmake
|
|
||||||
else
|
|
||||||
build_bjam
|
build_bjam
|
||||||
fi
|
|
||||||
|
|
||||||
##################################### TESTS ####################################
|
|
||||||
|
|
||||||
|
if [[ $VARIANT == "coverage" ]]; then
|
||||||
# for lcov to work effectively, the paths and includes
|
# for lcov to work effectively, the paths and includes
|
||||||
# passed to the compiler should not contain "." or "..".
|
# passed to the compiler should not contain "." or "..".
|
||||||
|
|
||||||
# (this runs in $BOOST_ROOT)
|
# (this runs in $BOOST_ROOT)
|
||||||
if [[ $VARIANT == "coverage" ]]; then
|
lcov --version
|
||||||
# Remove old files from a previous retry
|
|
||||||
find "$BOOST_ROOT" -name "*.gcda" | xargs rm -f
|
find "$BOOST_ROOT" -name "*.gcda" | xargs rm -f
|
||||||
rm -f "$BOOST_ROOT/*.info"
|
rm -f "$BOOST_ROOT/*.info"
|
||||||
|
|
||||||
# Create baseline coverage data file
|
|
||||||
lcov --no-external -c -i -d "$BOOST_ROOT" -o baseline.info > /dev/null
|
lcov --no-external -c -i -d "$BOOST_ROOT" -o baseline.info > /dev/null
|
||||||
|
|
||||||
# Perform test
|
|
||||||
#if [[ $MAIN_BRANCH == "1" && "$DO_VALGRIND" = true ]]; then
|
|
||||||
# run_tests_with_valgrind
|
|
||||||
# #run_autobahn_test_suite # skip slow autobahn tests
|
|
||||||
#else
|
|
||||||
# echo "skipping autobahn/valgrind tests for feature branch build"
|
|
||||||
run_tests
|
run_tests
|
||||||
#fi
|
# https://bugs.launchpad.net/ubuntu/+source/lcov/+bug/1163758
|
||||||
|
lcov --no-external -c -d "$BOOST_ROOT" -o testrun.info > /dev/null 2>&1
|
||||||
# Create test coverage data file, combine with the
|
|
||||||
# baseline result and filter out things we don't want.
|
|
||||||
#
|
|
||||||
#lcov --no-external -c -d "$BIN_DIR" -d "$LIB_DIR" -o testrun.info > /dev/null
|
|
||||||
lcov --no-external -c -d "$BOOST_ROOT" -o testrun.info > /dev/null
|
|
||||||
lcov -a baseline.info -a testrun.info -o lcov-all.info > /dev/null
|
lcov -a baseline.info -a testrun.info -o lcov-all.info > /dev/null
|
||||||
lcov -e "lcov-all.info" "$INC_DIR/*" -o lcov.info > /dev/null
|
lcov -e "lcov-all.info" "$INC_DIR/*" -o lcov.info > /dev/null
|
||||||
|
|
||||||
# Upload to codecov
|
|
||||||
~/.local/bin/codecov -X gcov -f lcov.info
|
~/.local/bin/codecov -X gcov -f lcov.info
|
||||||
|
|
||||||
# Upload to coveralls
|
|
||||||
#cat lcov.info | node_modules/.bin/coveralls
|
|
||||||
|
|
||||||
# Clean up these stragglers so BOOST_ROOT cache is clean
|
|
||||||
find "$BOOST_ROOT" -name "*.gcda" | xargs rm -f
|
find "$BOOST_ROOT" -name "*.gcda" | xargs rm -f
|
||||||
|
|
||||||
else
|
elif [[ "$DO_VALGRIND" = true ]]; then
|
||||||
if [[ $MAIN_BRANCH == "1" && "$DO_VALGRIND" = true ]]; then
|
|
||||||
run_tests_with_valgrind
|
run_tests_with_valgrind
|
||||||
|
|
||||||
else
|
else
|
||||||
run_tests_with_debugger
|
run_tests_with_debugger
|
||||||
fi
|
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
@@ -28,16 +28,6 @@ if [[ -n ${CLANG_VER:-} ]]; then
|
|||||||
export LLVM_CONFIG="llvm-${LLVM_VERSION}/bin/llvm-config";
|
export LLVM_CONFIG="llvm-${LLVM_VERSION}/bin/llvm-config";
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# There are cases where the directory exists, but the exe is not available.
|
|
||||||
# Use this workaround for now.
|
|
||||||
if [[ ! -x cmake/bin/cmake && -d cmake ]]; then
|
|
||||||
rm -fr cmake
|
|
||||||
fi
|
|
||||||
if [[ ! -d cmake && ${BUILD_SYSTEM:-} == cmake ]]; then
|
|
||||||
CMAKE_URL="http://www.cmake.org/files/v3.8/cmake-3.8.0-Linux-x86_64.tar.gz"
|
|
||||||
mkdir cmake && wget --no-check-certificate -O - ${CMAKE_URL} | tar --strip-components=1 -xz -C cmake
|
|
||||||
fi
|
|
||||||
|
|
||||||
# NOTE, changed from PWD -> HOME
|
# NOTE, changed from PWD -> HOME
|
||||||
export PATH=$HOME/bin:$PATH
|
export PATH=$HOME/bin:$PATH
|
||||||
|
|
||||||
@@ -58,17 +48,14 @@ pip install --user requests==2.13.0
|
|||||||
pip install --user https://github.com/codecov/codecov-python/archive/master.zip
|
pip install --user https://github.com/codecov/codecov-python/archive/master.zip
|
||||||
pip install --user autobahntestsuite
|
pip install --user autobahntestsuite
|
||||||
|
|
||||||
#bash scripts/install-boost.sh
|
|
||||||
bash scripts/install-valgrind.sh
|
|
||||||
|
|
||||||
# Install lcov
|
# Install lcov
|
||||||
# Download the archive
|
# Download the archive
|
||||||
wget http://downloads.sourceforge.net/ltp/lcov-1.12.tar.gz
|
#wget http://downloads.sourceforge.net/ltp/lcov-1.12.tar.gz
|
||||||
# Extract to ~/lcov-1.12
|
# Extract to ~/lcov-1.12
|
||||||
tar xfvz lcov-1.12.tar.gz -C $HOME
|
#tar xfvz lcov-1.12.tar.gz -C $HOME
|
||||||
# Set install path
|
# Set install path
|
||||||
mkdir -p $LCOV_ROOT
|
#mkdir -p $LCOV_ROOT
|
||||||
cd $HOME/lcov-1.12 && make install PREFIX=$LCOV_ROOT
|
#cd $HOME/lcov-1.12 && make install PREFIX=$LCOV_ROOT
|
||||||
|
|
||||||
# Install coveralls reporter
|
# Install coveralls reporter
|
||||||
#cd $HERE
|
#cd $HERE
|
||||||
|
@@ -1,20 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
# Assumptions:
|
|
||||||
# 1) VALGRIND_ROOT is already defined, and contains a valid values
|
|
||||||
set -eu
|
|
||||||
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
|
|
Reference in New Issue
Block a user