Tidy up Travis build scripts

This commit is contained in:
Vinnie Falco
2017-07-29 12:52:39 -07:00
parent 89ac7ecca7
commit 009d4f38ab
16 changed files with 217 additions and 288 deletions

View File

@ -1,11 +1,15 @@
sudo: false
language: cpp
#
# Copyright (c) 2013-2017 Vinnie Falco (vinnie dot falco at gmail dot com)
#
# Distributed under the Boost Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#
# Official repository: https://github.com/boostorg/beast
#
env:
global:
- LLVM_VERSION=3.8.0
- LCOV_ROOT=$HOME/lcov
- VALGRIND_ROOT=$HOME/valgrind-install
sudo: false
language: cpp
addons:
apt:
@ -21,20 +25,17 @@ addons:
matrix:
include:
# gcc coverage
- compiler: gcc
# GCC 6.0, Debug + Coverage
- os: linux
compiler: g++-6
env:
- VARIANT=coverage
- TOOLSET=gcc
- COMPILER=g++-6
- CXXSTD=c++11
- GCC_VER=6
- VARIANT=coverage
- ADDRESS_MODEL=64
- DO_VALGRIND=false
addons:
apt:
packages:
- gcc-6
- g++-6
- lcov
- libssl-dev
@ -42,39 +43,18 @@ matrix:
sources:
- *base_sources
# older GCC, release
- compiler: gcc
# GCC 5.0, Release + Valgrind
- os: linux
compiler: g++-5
env:
- TOOLSET=gcc
- COMPILER=g++-4.8
- CXXSTD=c++11
- GCC_VER=4.8
- DO_VALGRIND=true
- VARIANT=release
- DO_VALGRIND=false
- ADDRESS_MODEL=64
addons:
apt:
packages:
- gcc-4.8
- g++-4.8
- *base_packages
sources:
- *base_sources
# later GCC
- compiler: gcc
env:
- TOOLSET=gcc
- COMPILER=g++-5
- CXXSTD=c++11
- GCC_VER=5
- VARIANT=release
- DO_VALGRIND=true
- ADDRESS_MODEL=64
addons:
apt:
packages:
- gcc-5
- g++-5
- libssl-dev
- valgrind
@ -82,31 +62,56 @@ matrix:
sources:
- *base_sources
# clang ubsan+asan
- compiler: clang
# Clang 3.8, UBasan
- os: linux
compiler: clang++-3.8
env:
- TOOLSET=clang
- COMPILER=clang++
- CXXSTD=c++11
- GCC_VER=5
- VARIANT=ubasan
- CLANG_VER=3.8
- DO_VALGRIND=false
- ADDRESS_MODEL=64
- TOOLSET=clang
- COMPILER=clang++-3.8
- CXXSTD=c++11
- UBSAN_OPTIONS='print_stacktrace=1'
- PATH=$PWD/llvm-$LLVM_VERSION/bin:$PATH
addons:
apt:
packages:
- gcc-5
- g++-5
- clang-3.8
- libssl-dev
- *base_packages
sources:
- llvm-toolchain-precise-3.8
- *base_sources
# GCC 4.8, Release
- os: linux
compiler: g++-4.8
env:
- VARIANT=release
- TOOLSET=gcc
- COMPILER=g++-4.8
- CXXSTD=c++11
addons:
apt:
packages:
- g++-4.8
- *base_packages
sources:
- *base_sources
# OSX Clang, C++14, Debug
- os: osx
compiler: clang++
env:
- VARIANT=debug
- TOOLSET=clang
- COMPILER=clang++
- CXXSTD=c++14
# OSX
before_install: &base_before_install
- scripts/install-dependencies.sh
#- build/install-dependencies.sh
- pip install --user https://github.com/codecov/codecov-python/archive/master.zip
install:
- export BOOST_BRANCH=develop && [ "$TRAVIS_BRANCH" == "master" ] && BOOST_BRANCH=master || true
@ -181,7 +186,10 @@ install:
- ./bootstrap.sh
script:
- travis_retry libs/beast/scripts/build-and-test.sh
- |-
echo "using $TOOLSET : : $COMPILER : <cxxflags>-std=$CXXSTD ;" > ~/user-config.jam
- cd ../boost-root
- travis_retry libs/beast/build/build-and-test.sh
after_script:
- cat nohup.out || echo "nohup.out already deleted"

View File

@ -1,3 +1,10 @@
Version 95:
* Tidy up Travis build scripts
* Move scripts to build/
--------------------------------------------------------------------------------
Version 94:
* Use off-site Quick Start link temporarily

View File

@ -147,7 +147,7 @@ elseif ("${VARIANT}" STREQUAL "ubasan")
else()
set (CMAKE_BUILD_TYPE RELWITHDEBINFO)
set (CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} -DBOOST_BEAST_NO_SLOW_TESTS=1 -msse4.2 -funsigned-char -fno-omit-frame-pointer -fsanitize=address,undefined -fsanitize-blacklist=${PROJECT_SOURCE_DIR}/scripts/blacklist.supp")
"${CMAKE_CXX_FLAGS} -DBOOST_BEAST_NO_SLOW_TESTS=1 -msse4.2 -funsigned-char -fno-omit-frame-pointer -fsanitize=address,undefined -fsanitize-blacklist=${PROJECT_SOURCE_DIR}/build/blacklist.supp")
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address,undefined")
endif()

View File

@ -62,7 +62,7 @@ variant ubasan
:
release
:
<cxxflags>"-msse4.2 -funsigned-char -fno-omit-frame-pointer -fsanitize=address,undefined -fsanitize-blacklist=libs/beast/scripts/blacklist.supp"
<cxxflags>"-msse4.2 -funsigned-char -fno-omit-frame-pointer -fsanitize=address,undefined -fsanitize-blacklist=libs/beast/build/blacklist.supp"
<linkflags>"-fsanitize=address,undefined"
;

146
build/build-and-test.sh Executable file
View File

@ -0,0 +1,146 @@
#!/usr/bin/env bash
# add 'x' for command tracing
set -eu
#-------------------------------------------------------------------------------
#
# Utilities
#
# For builds not triggered by a pull request TRAVIS_BRANCH is the name of the
# branch currently being built; whereas for builds triggered by a pull request
# it is the name of the branch targeted by the pull request (in many cases this
# will be master).
MAIN_BRANCH="0"
if [[ $TRAVIS_BRANCH == "master" || $TRAVIS_BRANCH == "develop" ]]; then
MAIN_BRANCH="1"
fi
if [[ "${TRAVIS}" == "true" ]]; then
JOBS="2"
elif [[ $(uname -s) == "Linux" ]]; then
# Physical cores
JOBS=$(lscpu -p | grep -v '^#' | sort -u -t, -k 2,4 | wc -l)
elif [[ $(uname) == "Darwin" ]]; then
# Physical cores
JOBS=$(sysctl -n hw.physicalcpu)
else
JOBS=1
fi
# run with a debugger
function debug_run ()
{
if [[ $TRAVIS_OS_NAME == "osx" ]]; then
# -o runs after loading the binary
# -k runs after any crash
# We use a ghetto appromixation of --return-child-result, exiting with
# 1 on a crash
lldb \
--batch \
-o 'run' \
-k 'thread backtrace all' \
-k 'script import os; os._exit(1)' \
$@
else
gdb \
--silent \
--batch \
--return-child-result \
-ex="set print thread-events off" \
-ex=run \
-ex="thread apply all bt full" \
--args $@
fi
}
function valgrind_run ()
{
valgrind \
--track-origins=yes \
--max-stackframe=16000000 \
--suppressions=$BOOST_ROOT/libs/beast/build/valgrind.supp \
--error-exitcode=1 \
$@
}
function run_tests_with_debugger ()
{
find "$1" -name "$2" -print0 | while read -d $'\0' f
do
debug_run "$f"
done
}
function run_tests_with_valgrind ()
{
find "$1" -name "$2" -print0 | while read -d $'\0' f
do
valgrind_run "$f"
done
}
function run_tests ()
{
find "$1" -name "$2" -print0 | while read -d $'\0' f
do
"$f"
done
}
#-------------------------------------------------------------------------------
BIN_DIR="$BOOST_ROOT/bin.v2/libs/beast/test"
LIB_DIR="$BOOST_ROOT/libs/beast"
INC_DIR="$BOOST_ROOT/boost/beast"
function build_bjam ()
{
if [[ $VARIANT == "coverage" ]]; then
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 \
-j${JOBS}
else
bjam \
libs/beast/test//fat-tests \
libs/beast/bench \
libs/beast/example \
toolset=$TOOLSET \
variant=$VARIANT \
-j${JOBS}
fi
}
build_bjam
DO_VALGRIND=${DO_VALGRIND:-false}
if [[ $VARIANT == "coverage" ]]; then
# 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"
lcov --no-external -c -i -d "$BOOST_ROOT" -o baseline.info > /dev/null
run_tests "$BIN_DIR" fat-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
~/.local/bin/codecov -X gcov -f lcov.info
find "$BOOST_ROOT" -name "*.gcda" | xargs rm -f
elif [[ "$DO_VALGRIND" = true ]]; then
run_tests_with_valgrind "$BIN_DIR" fat-tests
else
run_tests_with_debugger "$BIN_DIR" fat-tests
fi

View File

@ -38,26 +38,10 @@ fi
if [ -x $HOME/bin/clang ]; then
$HOME/bin/clang -v
fi
# 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 requests==2.13.0
pip install --user https://github.com/codecov/codecov-python/archive/master.zip
pip install --user autobahntestsuite
# 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
# Install coveralls reporter
#cd $HERE
#mkdir -p node_modules
#npm install coveralls

0
scripts/make_field.sh → build/make_field.sh Normal file → Executable file
View File

View File

@ -1,128 +0,0 @@
#!/usr/bin/env bash
# We use set -e to bail on first non zero exit code of any processes launched
# and -x to exit upon any unbound variable. -x will output command lines used
# (with variable expansion)
BIN_DIR="$BOOST_ROOT/bin.v2/libs/beast/test"
LIB_DIR="$BOOST_ROOT/libs/beast"
INC_DIR="$BOOST_ROOT/boost/beast"
set -eux
# brew install bash (4) to get this working on OSX!
shopt -s globstar
################################## ENVIRONMENT #################################
DO_VALGRIND=${DO_VALGRIND:-false}
# If not CI, then set some defaults
if [[ "${CI:-}" == "" ]]; then
TRAVIS_BRANCH=${TRAVIS_BRANCH:-feature}
CC=${CC:-gcc}
ADDRESS_MODEL=${ADDRESS_MODEL:-64}
VARIANT=${VARIANT:-debug}
# If running locally we assume we have lcov/valgrind on PATH
else
export PATH=$VALGRIND_ROOT/bin:$LCOV_ROOT/usr/bin:$PATH
fi
MAIN_BRANCH="0"
# For builds not triggered by a pull request TRAVIS_BRANCH is the name of the
# branch currently being built; whereas for builds triggered by a pull request
# it is the name of the branch targeted by the pull request (in many cases this
# will be master).
if [[ $TRAVIS_BRANCH == "master" || $TRAVIS_BRANCH == "develop" ]]; then
MAIN_BRANCH="1"
fi
num_jobs="1"
if [[ $(uname) == "Darwin" ]]; then
num_jobs=$(sysctl -n hw.physicalcpu)
elif [[ $(uname -s) == "Linux" ]]; then
# CircleCI returns 32 phys procs, but 2 virt proc
num_proc_units=$(nproc)
# Physical cores
num_jobs=$(lscpu -p | grep -v '^#' | sort -u -t, -k 2,4 | wc -l)
if ((${num_proc_units} < ${num_jobs})); then
num_jobs=$num_proc_units
fi
if [[ "${TRAVIS}" == "true" && ${NUM_PROCESSORS:=2} > ${num_jobs} ]]; then
num_jobs=$NUM_PROCESSORS
fi
#if [[ "$TRAVIS" == "true" ]] && (( "$num_jobs" > 1)); then
# num_jobs=$((num_jobs - 1))
#fi
fi
echo "using toolset: $TOOLSET"
echo "using variant: $VARIANT"
echo "using address-model: $ADDRESS_MODEL"
echo "using PATH: $PATH"
echo "using MAIN_BRANCH: $MAIN_BRANCH"
echo "using BOOST_ROOT: $BOOST_ROOT"
#################################### HELPERS ###################################
function run_tests_with_debugger {
for x in $BOOST_ROOT/bin.v2/libs/beast/test/**/$VARIANT/**/fat-tests; do
"$LIB_DIR/scripts/run-with-debugger.sh" "$x"
done
}
function run_tests {
for x in $BOOST_ROOT/bin.v2/libs/beast/test/**/$VARIANT/**/fat-tests; do
$x
done
}
function run_tests_with_valgrind {
for x in $BOOST_ROOT/bin.v2/libs/beast/test/**/$VARIANT/**/fat-tests; do
# 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/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 \
libs/beast/bench \
libs/beast/example \
toolset=$TOOLSET variant=$VARIANT address-model=$ADDRESS_MODEL -j${num_jobs}
fi
}
build_bjam
if [[ $VARIANT == "coverage" ]]; then
# 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"
lcov --no-external -c -i -d "$BOOST_ROOT" -o baseline.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
~/.local/bin/codecov -X gcov -f lcov.info
find "$BOOST_ROOT" -name "*.gcda" | xargs rm -f
elif [[ "$DO_VALGRIND" = true ]]; then
run_tests_with_valgrind
else
run_tests_with_debugger
fi

View File

@ -1,14 +0,0 @@
{
"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,43 +0,0 @@
import os
import json
import sys
VARIANT = os.environ.get('VARIANT', 'release')
EXPECTED_BEHAVIOR = ('OK', 'UNIMPLEMENTED', 'INFORMATIONAL')
EXPECTED_BEHAVIOR_CLOSE = ('OK', 'INFORMATIONAL')
WARNINGS = ("peer did not respond (in time) in closing handshake", )
args = sys.argv[1:]
fn = os.path.abspath(args[0])
indexPath = os.path.dirname(fn)
relativeToIndex = lambda f: os.path.join(indexPath, f)
print "index", fn
failures = []
warnings = []
with open(fn, 'r') as fh:
index = json.load(fh)
for servername, serverResults in index.items():
for test in serverResults:
result = serverResults[test]
if ((result['behavior'] not in EXPECTED_BEHAVIOR) or
result['behaviorClose'] not in EXPECTED_BEHAVIOR_CLOSE):
with open(relativeToIndex(result['reportfile'])) as rh:
report = json.load(rh)
if (report.get('wasNotCleanReason', '') in WARNINGS and
VARIANT != 'release'):
warnings.append(report)
else:
failures.append(report)
if warnings:
print >> sys.stderr, json.dumps(warnings, indent=2)
print >> sys.stderr, 'there was %s warnings' % len(warnings)
if failures:
print >> sys.stderr, json.dumps(failures, indent=2)
print >> sys.stderr, 'there was %s failures' % len(failures)
sys.exit(1)

View File

@ -1,22 +0,0 @@
#!/usr/bin/env bash
set -eu
if [[ $(uname) == "Darwin" ]]; then
# -o runs after loading the binary
# -k runs after any crash
# We use a ghetto appromixation of --return-child-result, exiting with
# 1 on a crash
lldb --batch \
-o 'run' \
-k 'thread backtrace all' \
-k 'script import os; os._exit(1)' \
$@
else
gdb --silent \
--batch \
--return-child-result \
-ex="set print thread-events off" \
-ex=run \
-ex="thread apply all bt full" \
--args $@
fi

View File

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