mirror of
https://github.com/XRPLF/rippled.git
synced 2026-04-29 15:37:57 +00:00
Squashed 'src/beast/' changes from 1b9a714..6d5547a
6d5547a Set version to 1.0.0-b34 6fab138 Fix and tidy up CMake build scripts: ccefa54 Set version to 1.0.0-b33 32afe41 Set internal state correctly when writing frames: fe3e20b Add write_frames unit test 578dcd0 Add decorator unit test aaa3733 Use fwrite return value in file_body df66165 Require Visual Studio 2015 Update 3 or later b8e5a21 Set version to 1.0.0-b32 ffb1758 Update CMake scripts for finding packages: b893749 Remove http Writer suspend and resume feature (API Change): 27864fb Add io_service completion invariants tests eba05a7 Set version to 1.0.0-b31 484bcef Fix badge markdown in README.md 5663bea Add missing dynabuf_readstream member 0d7a551 Tidy up build settings 0fd4030 Move the handler, don't copy it git-subtree-dir: src/beast git-subtree-split: 6d5547a32c50ec95832c4779311502555ab0ee1f
This commit is contained in:
39
scripts/blacklist.supp
Normal file
39
scripts/blacklist.supp
Normal file
@@ -0,0 +1,39 @@
|
||||
# Remember that this blacklist file is GLOBAL to all sanitizers
|
||||
# Be therefore extremely careful when considering to add a sanitizer
|
||||
# filter here instead of using a runtime suppression
|
||||
#
|
||||
# Remember also that filters here quite literally completely
|
||||
# remove instrumentation altogether, so filtering here means
|
||||
# that sanitizers such as tsan will false positive on problems
|
||||
# introduced by code filtered here.
|
||||
#
|
||||
# The main use for this file is ubsan, as it's the only sanitizer
|
||||
# without a runtime suppression facility.
|
||||
#
|
||||
# Be ESPECIALLY careful when filtering out entire source files!
|
||||
# Try if at all possible to filter only functions using fun:regex
|
||||
# Remember you must use mangled symbol names with fun:regex
|
||||
|
||||
|
||||
#### Compile time filters for ubsan ####
|
||||
|
||||
## The well known ubsan failure in libstdc++ extant for years :)
|
||||
# Line 96:24: runtime error: load of value 4294967221, which is not a valid value for type 'std::_Ios_Fmtflags'
|
||||
fun:*_Ios_Fmtflags*
|
||||
|
||||
# boost/any.hpp:259:16: runtime error: downcast of address 0x000004392e70 which does not point to an object of type 'any::holder<int>'
|
||||
fun:*any_cast*
|
||||
|
||||
# boost/lexical_cast.hpp:1625:43: runtime error: downcast of address 0x7fbb4fffbce8 which does not point to an object of type 'buffer_t' (aka 'parser_buf<std::basic_streambuf<char, char_traits<char> >, char>')
|
||||
fun:*shl_input_streamable*
|
||||
|
||||
|
||||
|
||||
|
||||
#### Compile time filters for asan ####
|
||||
|
||||
|
||||
#### Compile time filters for msan ####
|
||||
|
||||
|
||||
#### Compile time filters for tsan ####
|
||||
165
scripts/build-and-test.sh
Executable file
165
scripts/build-and-test.sh
Executable file
@@ -0,0 +1,165 @@
|
||||
#!/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)
|
||||
set -eux
|
||||
|
||||
# brew install bash (4) to get this working on OSX!
|
||||
shopt -s globstar
|
||||
|
||||
################################## ENVIRONMENT #################################
|
||||
|
||||
# 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
|
||||
fi
|
||||
|
||||
echo "using toolset: $CC"
|
||||
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 bin/**/$VARIANT/**/*-tests; do
|
||||
scripts/run-with-debugger.sh "$x"
|
||||
done
|
||||
}
|
||||
|
||||
function run_tests {
|
||||
for x in bin/**/$VARIANT/**/*-tests; do
|
||||
$x
|
||||
done
|
||||
}
|
||||
|
||||
function run_tests_with_valgrind {
|
||||
for x in bin/**/$VARIANT/**/*-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=./scripts/valgrind.supp --error-exitcode=1 "$x"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
function build_beast {
|
||||
$BOOST_ROOT/bjam toolset=$CC \
|
||||
variant=$VARIANT \
|
||||
address-model=$ADDRESS_MODEL \
|
||||
-j${num_jobs}
|
||||
}
|
||||
|
||||
function build_beast_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_beast_cmake
|
||||
else
|
||||
build_beast
|
||||
fi
|
||||
|
||||
##################################### 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
|
||||
if [[ $MAIN_BRANCH == "1" ]]; then
|
||||
run_tests_with_valgrind
|
||||
# skip slow autobahn tests
|
||||
#run_autobahn_test_suite
|
||||
else
|
||||
echo "skipping autobahn/valgrind tests for feature branch build"
|
||||
run_tests
|
||||
fi
|
||||
|
||||
# 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" "$PWD/include/beast/*" -o lcov.info > /dev/null
|
||||
|
||||
~/.local/bin/codecov -X gcov
|
||||
cat lcov.info | node_modules/.bin/coveralls
|
||||
|
||||
# Clean up these stragglers so BOOST_ROOT cache is clean
|
||||
find $BOOST_ROOT/bin.v2 -name "*.gcda" | xargs rm -f
|
||||
else
|
||||
run_tests_with_debugger
|
||||
fi
|
||||
14
scripts/fuzzingclient.json
Normal file
14
scripts/fuzzingclient.json
Normal 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": {}
|
||||
}
|
||||
27
scripts/install-boost.sh
Executable file
27
scripts/install-boost.sh
Executable file
@@ -0,0 +1,27 @@
|
||||
#!/usr/bin/env bash
|
||||
# Assumptions:
|
||||
# 1) BOOST_ROOT and BOOST_URL are already defined,
|
||||
# and contain valid values.
|
||||
# 2) The last namepart of BOOST_ROOT matches the
|
||||
# folder name internal to boost's .tar.gz
|
||||
# When testing you can force a boost build by clearing travis caches:
|
||||
# https://travis-ci.org/ripple/rippled/caches
|
||||
set -eu
|
||||
if [ ! -d "$BOOST_ROOT/lib" ]
|
||||
then
|
||||
wget $BOOST_URL -O /tmp/boost.tar.gz
|
||||
cd `dirname $BOOST_ROOT`
|
||||
rm -fr ${BOOST_ROOT}
|
||||
tar xzf /tmp/boost.tar.gz
|
||||
|
||||
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 && \
|
||||
./b2 -d0 $params install
|
||||
else
|
||||
echo "Using cached boost at $BOOST_ROOT"
|
||||
fi
|
||||
|
||||
75
scripts/install-dependencies.sh
Executable file
75
scripts/install-dependencies.sh
Executable file
@@ -0,0 +1,75 @@
|
||||
#!/usr/bin/env bash
|
||||
# Exit if anything fails.
|
||||
set -eux
|
||||
|
||||
HERE=$PWD
|
||||
|
||||
# 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
|
||||
|
||||
if [[ -n ${CLANG_VER:-} ]]; then
|
||||
# There are cases where the directory exists, but the exe is not available.
|
||||
# Use this workaround for now.
|
||||
if [[ ! -x llvm-${LLVM_VERSION}/bin/llvm-config ]] && [[ -d llvm-${LLVM_VERSION} ]]; then
|
||||
rm -fr llvm-${LLVM_VERSION}
|
||||
fi
|
||||
if [[ ! -d llvm-${LLVM_VERSION} ]]; then
|
||||
mkdir llvm-${LLVM_VERSION}
|
||||
LLVM_URL="http://llvm.org/releases/${LLVM_VERSION}/clang+llvm-${LLVM_VERSION}-x86_64-linux-gnu-ubuntu-14.04.tar.xz"
|
||||
wget -O - ${LLVM_URL} | tar -Jxvf - --strip 1 -C llvm-${LLVM_VERSION}
|
||||
fi
|
||||
llvm-${LLVM_VERSION}/bin/llvm-config --version;
|
||||
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.5/cmake-3.5.2-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
|
||||
|
||||
# What versions are we ACTUALLY running?
|
||||
if [ -x $HOME/bin/g++ ]; then
|
||||
$HOME/bin/g++ -v
|
||||
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 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
|
||||
|
||||
# Install coveralls reporter
|
||||
cd $HERE
|
||||
mkdir -p node_modules
|
||||
npm install coveralls
|
||||
20
scripts/install-valgrind.sh
Executable file
20
scripts/install-valgrind.sh
Executable file
@@ -0,0 +1,20 @@
|
||||
#!/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
|
||||
43
scripts/parseautobahn.py
Normal file
43
scripts/parseautobahn.py
Normal file
@@ -0,0 +1,43 @@
|
||||
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)
|
||||
22
scripts/run-with-debugger.sh
Executable file
22
scripts/run-with-debugger.sh
Executable file
@@ -0,0 +1,22 @@
|
||||
#!/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
|
||||
9
scripts/run-with-gdb.sh
Executable file
9
scripts/run-with-gdb.sh
Executable file
@@ -0,0 +1,9 @@
|
||||
#!/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 $@
|
||||
10
scripts/valgrind.supp
Normal file
10
scripts/valgrind.supp
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
zlib_fill_window_no_init
|
||||
Memcheck:Cond
|
||||
fun:fill_window
|
||||
}
|
||||
{
|
||||
beast_fill_window_no_init
|
||||
Memcheck:Cond
|
||||
fun:_ZN5beast4zlib6detail14deflate_stream11fill_windowIvEEvRNS0_8z_paramsE
|
||||
}
|
||||
Reference in New Issue
Block a user