Tidy up Travis for code coverage

This commit is contained in:
Vinnie Falco
2017-07-29 06:29:26 -07:00
parent 0e8a2ce3ed
commit 89ac7ecca7
4 changed files with 32 additions and 149 deletions

View File

@@ -4,11 +4,6 @@ language: cpp
env:
global:
- 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
- VALGRIND_ROOT=$HOME/valgrind-install
@@ -23,11 +18,6 @@ addons:
- binutils-gold
# Provides a backtrace if the unittests crash
- gdb
# Needed for installing valgrind
- subversion
- automake
- autotools-dev
- libc6-dbg
matrix:
include:
@@ -41,13 +31,12 @@ matrix:
- VARIANT=coverage
- ADDRESS_MODEL=64
- DO_VALGRIND=false
#- BUILD_SYSTEM=cmake
- PATH=$PWD/cmake/bin:$PATH
addons:
apt:
packages:
- gcc-6
- g++-6
- lcov
- libssl-dev
- *base_packages
sources:
@@ -82,14 +71,13 @@ matrix:
- VARIANT=release
- DO_VALGRIND=true
- ADDRESS_MODEL=64
#- BUILD_SYSTEM=cmake
- PATH=$PWD/cmake/bin:$PATH
addons:
apt:
packages:
- gcc-5
- g++-5
- libssl-dev
- valgrind
- *base_packages
sources:
- *base_sources
@@ -106,8 +94,6 @@ matrix:
- DO_VALGRIND=false
- ADDRESS_MODEL=64
- UBSAN_OPTIONS='print_stacktrace=1'
#- BUILD_SYSTEM=cmake
- PATH=$PWD/cmake/bin:$PATH
- PATH=$PWD/llvm-$LLVM_VERSION/bin:$PATH
addons:
apt:
@@ -119,12 +105,6 @@ matrix:
sources:
- *base_sources
cache:
directories:
- $VALGRIND_ROOT
- llvm-$LLVM_VERSION
- cmake
before_install: &base_before_install
- scripts/install-dependencies.sh

View File

@@ -78,115 +78,51 @@ function run_tests {
function run_tests_with_valgrind {
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
# see: https://travis-ci.org/vinniefalco/Beast/jobs/132486245
valgrind --suppressions=$BOOST_ROOT/libs/beast/scripts/valgrind.supp --error-exitcode=1 "$x"
fi
# TODO --max-stackframe=8388608
# see: https://travis-ci.org/vinniefalco/Beast/jobs/132486245
valgrind --suppressions=$BOOST_ROOT/libs/beast/scripts/valgrind.supp --error-exitcode=1 "$x"
done
}
function build_bjam {
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
bjam libs/beast/test//fat-tests toolset=$TOOLSET variant=$VARIANT address-model=$ADDRESS_MODEL -j${num_jobs}
bjam libs/beast/bench toolset=$TOOLSET variant=$VARIANT address-model=$ADDRESS_MODEL -j${num_jobs}
bjam libs/beast/example toolset=$TOOLSET variant=$VARIANT address-model=$ADDRESS_MODEL -j${num_jobs}
bjam \
libs/beast/test//fat-tests \
libs/beast/bench \
libs/beast/example \
toolset=$TOOLSET variant=$VARIANT address-model=$ADDRESS_MODEL -j${num_jobs}
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
}
build_bjam
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
fi
##################################### TESTS ####################################
# for lcov to work effectively, the paths and includes
# passed to the compiler should not contain "." or "..".
# (this runs in $BOOST_ROOT)
if [[ $VARIANT == "coverage" ]]; then
# Remove old files from a previous retry
# for lcov to work effectively, the paths and includes
# passed to the compiler should not contain "." or "..".
# (this runs in $BOOST_ROOT)
lcov --version
find "$BOOST_ROOT" -name "*.gcda" | xargs rm -f
rm -f "$BOOST_ROOT/*.info"
# Create baseline coverage data file
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
#fi
# 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
run_tests
# https://bugs.launchpad.net/ubuntu/+source/lcov/+bug/1163758
lcov --no-external -c -d "$BOOST_ROOT" -o testrun.info > /dev/null 2>&1
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
# Upload to codecov
~/.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
elif [[ "$DO_VALGRIND" = true ]]; then
run_tests_with_valgrind
else
if [[ $MAIN_BRANCH == "1" && "$DO_VALGRIND" = true ]]; then
run_tests_with_valgrind
else
run_tests_with_debugger
fi
run_tests_with_debugger
fi

View File

@@ -28,16 +28,6 @@ if [[ -n ${CLANG_VER:-} ]]; then
export LLVM_CONFIG="llvm-${LLVM_VERSION}/bin/llvm-config";
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
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 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
#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
#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
#mkdir -p $LCOV_ROOT
#cd $HOME/lcov-1.12 && make install PREFIX=$LCOV_ROOT
# Install coveralls reporter
#cd $HERE

View File

@@ -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