mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-27 22:45:52 +00:00
Travis CI updates:
* Run autobahn/valgrind tests when target branch in {master, develop}
* Add coveralls
* Show full stacktrace for usan (RIPD-1150)
* Manual launch of coverage (RIPD-1152)
* Use lldb on Darwin (RIPD-1152)
* Set defaults if not CI (RIPD-1152)
* Add autobahn result parser (RIPD-1147)
This commit is contained in:
committed by
Vinnie Falco
parent
a9e507da9b
commit
8303266430
@@ -1,8 +1,11 @@
|
||||
#!/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
|
||||
#!/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
|
||||
set -ex
|
||||
|
||||
################################## ENVIRONMENT #################################
|
||||
|
||||
@@ -17,36 +20,90 @@ 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
|
||||
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_gdb {
|
||||
for x in bin/**/*-tests; do scripts/run-with-gdb.sh "$x"; done
|
||||
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/**/*-tests; do "$x"; done
|
||||
for x in bin/**/$VARIANT/**/*-tests; do
|
||||
$x
|
||||
done
|
||||
}
|
||||
|
||||
num_procs=1
|
||||
if [[ $(uname) == "Darwin" ]]; then
|
||||
num_procs=$(sysctl -n hw.ncpu)
|
||||
elif [[ $(uname -s) == "Linux" ]]; then
|
||||
num_procs=$(lscpu -p | grep -v '^#' | sort -u -t, -k 2,4 | wc -l) # physical cores
|
||||
virt_num_procs=$(nproc) # CircleCI returns 32 phys procs, but 1 virt proc
|
||||
if (("$virt_num_procs" < "$num_procs")); then
|
||||
num_procs=$virt_num_procs
|
||||
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 --error-exitcode=1 "$x"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
function build_beast {
|
||||
$BOOST_ROOT/bjam toolset=$CC \
|
||||
variant=$VARIANT \
|
||||
address-model=$ADDRESS_MODEL -j${num_procs}
|
||||
address-model=$ADDRESS_MODEL \
|
||||
-j${num_jobs}
|
||||
}
|
||||
|
||||
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
|
||||
cd scripts && wstest -m fuzzingclient
|
||||
cd ..
|
||||
# Show the output
|
||||
cat nohup.out
|
||||
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
|
||||
# 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 ####################################
|
||||
@@ -62,24 +119,12 @@ if [[ $VARIANT == "coverage" ]]; then
|
||||
lcov --no-external -c -i -d . -o baseline.info > /dev/null
|
||||
|
||||
# Perform test
|
||||
run_tests
|
||||
|
||||
# Run autobahn tests
|
||||
export SERVER=$(find . -name "websocket-echo")
|
||||
nohup $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
|
||||
sleep 5
|
||||
# Kill it gracefully
|
||||
kill -INT %1
|
||||
wait
|
||||
if [[ $MAIN_BRANCH == "1" ]]; then
|
||||
run_tests_with_valgrind
|
||||
run_autobahn_test_suite
|
||||
else
|
||||
run_tests
|
||||
fi
|
||||
|
||||
# Create test coverage data file
|
||||
lcov --no-external -c -d . -o testrun.info > /dev/null
|
||||
@@ -88,20 +133,13 @@ if [[ $VARIANT == "coverage" ]]; then
|
||||
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
|
||||
lcov -e "lcov-all.info" "$PWD/include/beast/*" -o lcov.info > /dev/null
|
||||
|
||||
~/.local/bin/codecov -X gcov
|
||||
else
|
||||
# TODO: make a function
|
||||
run_tests_with_gdb
|
||||
cat lcov.info | node_modules/.bin/coveralls
|
||||
|
||||
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
|
||||
# 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
|
||||
|
||||
Reference in New Issue
Block a user