From 4a3a40174ec47a56a3ffb6dad3e6a209225acdc4 Mon Sep 17 00:00:00 2001 From: Edward Hennis Date: Mon, 5 Feb 2018 17:28:34 -0500 Subject: [PATCH] Strip down Travis CI support toward future deprecation: * Remove all builds except cmake gcc & clang debug. * Time some dependency and build operations, using a custom format to avoid interfering with other timers. * Use Travis's "trusty" infrastructure. * Install more dependencies via apt. * Update boost version to 1.65.1. * Do not run unit tests under gdb - several security features prevent it from running correctly. * Run test job with two processes. --- .travis.yml | 47 ++++++++++------------ bin/ci/ubuntu/build-and-test.sh | 29 +++++++++----- bin/ci/ubuntu/install-dependencies.sh | 56 +-------------------------- bin/sh/install-boost.sh | 14 +++++-- 4 files changed, 53 insertions(+), 93 deletions(-) diff --git a/.travis.yml b/.travis.yml index 22ba9fecb..a048669ac 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,23 +3,19 @@ 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 - - GDB_ROOT=$HOME/gdb - - BOOST_ROOT=$HOME/boost_1_60_0 - - BOOST_URL='http://sourceforge.net/projects/boost/files/boost/1.60.0/boost_1_60_0.tar.gz' - -# Travis is timing out on Trusty. So, for now, use Precise. July 2017 -dist: precise + - BOOST_ROOT=$HOME/boost_1_65_1 + - BOOST_URL='https://dl.bintray.com/boostorg/release/1.65.1/source/boost_1_65_1.tar.gz' addons: apt: - sources: ['ubuntu-toolchain-r-test'] + sources: + - ubuntu-toolchain-r-test + - llvm-toolchain-trusty-5.0 packages: - gcc-5 - g++-5 @@ -29,43 +25,41 @@ addons: - libssl-dev - libstdc++6 - binutils-gold - # Provides a backtrace if the unittests crash - - gdb - # needed to build gdb - - texinfo + - cmake + - lcov + - llvm-5.0 + - clang-5.0 matrix: include: # Default BUILD is "scons". + - compiler: gcc + env: GCC_VER=5 BUILD=cmake TARGET=debug + # - APP_ARGS="--unittest-jobs=2" + # - compiler: gcc # env: GCC_VER=5 TARGET=debug.nounity - - compiler: gcc - env: GCC_VER=5 BUILD=cmake TARGET=coverage PATH=$PWD/cmake/bin:$PATH + # - compiler: gcc + # env: GCC_VER=5 BUILD=cmake TARGET=coverage PATH=$PWD/cmake/bin:$PATH - compiler: clang - env: GCC_VER=5 BUILD=cmake TARGET=debug CLANG_VER=3.8 PATH=$PWD/llvm-$LLVM_VERSION/bin:$PWD/cmake/bin:$PATH - cache: - directories: - - $GDB_ROOT + env: GCC_VER=5 BUILD=cmake TARGET=debug - - compiler: clang - env: GCC_VER=5 TARGET=debug.nounity CLANG_VER=3.8 PATH=$PWD/llvm-$LLVM_VERSION/bin:$PATH + # - compiler: clang + # env: GCC_VER=5 TARGET=debug.nounity # The clang cmake builds do not link. # - compiler: clang - # env: GCC_VER=5 BUILD=cmake TARGET=debug CLANG_VER=3.8 PATH=$PWD/llvm-$LLVM_VERSION/bin:$PWD/cmake/bin:$PATH + # env: GCC_VER=5 BUILD=cmake TARGET=debug # - compiler: clang - # env: GCC_VER=5 BUILD=cmake TARGET=debug.nounity CLANG_VER=3.8 PATH=$PWD/llvm-$LLVM_VERSION/bin:$PWD/cmake/bin:$PATH + # env: GCC_VER=5 BUILD=cmake TARGET=debug.nounity cache: directories: - $BOOST_ROOT - - llvm-$LLVM_VERSION - - cmake - - $GDB_ROOT before_install: - bin/ci/ubuntu/install-dependencies.sh @@ -80,4 +74,3 @@ notifications: channels: - "chat.freenode.net#ripple-dev" -dist: precise diff --git a/bin/ci/ubuntu/build-and-test.sh b/bin/ci/ubuntu/build-and-test.sh index 78ba5b7f0..beae4e37f 100755 --- a/bin/ci/ubuntu/build-and-test.sh +++ b/bin/ci/ubuntu/build-and-test.sh @@ -13,7 +13,17 @@ echo "using TARGET: $TARGET" echo "using APP: $APP" JOBS=${NUM_PROCESSORS:-2} -JOBS=$((JOBS+1)) +if [[ ${TRAVIS:-false} != "true" ]]; then + JOBS=$((JOBS+1)) +fi + +if [ -x /usr/bin/time ] ; then + : ${TIME:="Duration: %E"} + export TIME + time=/usr/bin/time +else + time= +fi if [[ ${BUILD:-scons} == "cmake" ]]; then echo "cmake building ${APP}" @@ -37,13 +47,13 @@ if [[ ${BUILD:-scons} == "cmake" ]]; then fi mkdir -p "build/${CMAKE_TARGET}" pushd "build/${CMAKE_TARGET}" - cmake ../.. -Dtarget=$CMAKE_TARGET ${CMAKE_EXTRA_ARGS} - cmake --build . -- $BUILDARGS + $time cmake ../.. -Dtarget=$CMAKE_TARGET ${CMAKE_EXTRA_ARGS} + $time cmake --build . -- $BUILDARGS if [[ ${BUILD_BOTH:-} == true ]]; then if [[ ${TARGET} == *.unity ]]; then - cmake --build . --target rippled_classic -- $BUILDARGS + $time cmake --build . --target rippled_classic -- $BUILDARGS else - cmake --build . --target rippled_unity -- $BUILDARGS + $time cmake --build . --target rippled_unity -- $BUILDARGS fi fi popd @@ -53,12 +63,12 @@ else export APP_PATH="$PWD/build/$CC.$TARGET/${APP}" echo "using APP_PATH: $APP_PATH" # Make sure vcxproj is up to date - scons vcxproj + $time scons vcxproj git diff --exit-code # $CC will be either `clang` or `gcc` # http://docs.travis-ci.com/user/migrating-from-legacy/?utm_source=legacy-notice&utm_medium=banner&utm_campaign=legacy-upgrade # indicates that 2 cores are available to containers. - scons -j${JOBS} $CC.$TARGET + $time scons -j${JOBS} $CC.$TARGET fi # We can be sure we're using the build/$CC.$TARGET variant # (-f so never err) @@ -68,7 +78,7 @@ rm -f build/${APP} ldd $APP_PATH if [[ ${APP} == "rippled" ]]; then - export APP_ARGS="--unittest --quiet --unittest-log" + export APP_ARGS+=" --unittest --quiet --unittest-log" # Only report on src/ripple files export LCOV_FILES="*/src/ripple/*" # Nothing to explicitly exclude @@ -92,7 +102,8 @@ if [[ ${SKIP_TESTS:-} == true ]]; then exit fi -if [[ $TARGET == debug* ]]; then +if [[ $TARGET == debug* && -v GDB_ROOT && -x $GDB_ROOT/bin/gdb ]]; then + $GDB_ROOT/bin/gdb -v # Execute unit tests under gdb, printing a call stack # if we get a crash. $GDB_ROOT/bin/gdb -return-child-result -quiet -batch \ diff --git a/bin/ci/ubuntu/install-dependencies.sh b/bin/ci/ubuntu/install-dependencies.sh index d1680023a..93316e198 100755 --- a/bin/ci/ubuntu/install-dependencies.sh +++ b/bin/ci/ubuntu/install-dependencies.sh @@ -15,42 +15,11 @@ do 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 ${TWD}/llvm-${LLVM_VERSION}/bin/llvm-config && -d ${TWD}/llvm-${LLVM_VERSION} ]]; then - rm -fr ${TWD}/llvm-${LLVM_VERSION} - fi - if [[ ! -d ${TWD}/llvm-${LLVM_VERSION} ]]; then - mkdir ${TWD}/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 ${TWD}/llvm-${LLVM_VERSION} - fi - ${TWD}/llvm-${LLVM_VERSION}/bin/llvm-config --version; - export LLVM_CONFIG="${TWD}/llvm-${LLVM_VERSION}/bin/llvm-config"; -fi - -if [[ ${BUILD:-} == cmake ]]; then - # There are cases where the directory exists, but the exe is not available. - # Use this workaround for now. - if [[ ! -x ${TWD}/cmake/bin/cmake && -d ${TWD}/cmake ]]; then - rm -fr ${TWD}/cmake - fi - if [[ ! -d ${TWD}/cmake ]]; then - CMAKE_URL="https://www.cmake.org/files/v3.6/cmake-3.6.1-Linux-x86_64.tar.gz" - wget --version - # wget version 1.13.4 thinks this certificate is invalid, even though it's fine. - # "ERROR: no certificate subject alternative name matches" - # See also: https://github.com/travis-ci/travis-ci/issues/5059 - mkdir ${TWD}/cmake && - wget -O - --no-check-certificate ${CMAKE_URL} | tar --strip-components=1 -xz -C ${TWD}/cmake - cmake --version - fi -fi - # What versions are we ACTUALLY running? if [ -x $HOME/bin/g++ ]; then $HOME/bin/g++ -v +else + g++ -v fi pip install --user requests==2.13.0 @@ -58,24 +27,3 @@ pip install --user https://github.com/codecov/codecov-python/archive/master.zip bash bin/sh/install-boost.sh -# Install lcov -# Download the archive -wget https://github.com/linux-test-project/lcov/releases/download/v1.12/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 - -if [[ ${TARGET} == debug* && ! -x ${GDB_ROOT}/bin/gdb ]]; then - pushd $HOME - #install gdb - wget https://ftp.gnu.org/gnu/gdb/gdb-8.0.tar.xz - tar xf gdb-8.0.tar.xz - pushd gdb-8.0 - ./configure CFLAGS='-w -O2' CXXFLAGS='-std=gnu++11 -g -O2 -w' --prefix=$GDB_ROOT - make -j2 - make install - popd - popd -fi diff --git a/bin/sh/install-boost.sh b/bin/sh/install-boost.sh index 8a49771e9..cc6cc3e42 100644 --- a/bin/sh/install-boost.sh +++ b/bin/sh/install-boost.sh @@ -8,6 +8,14 @@ # https://travis-ci.org/ripple/rippled/caches set -e +if [ -x /usr/bin/time ] ; then + : ${TIME:="Duration: %E"} + export TIME + time=/usr/bin/time +else + time= +fi + if [ ! -d "$BOOST_ROOT/lib" ] then wget $BOOST_URL -O /tmp/boost.tar.gz @@ -15,9 +23,9 @@ then rm -fr ${BOOST_ROOT} tar xzf /tmp/boost.tar.gz cd $BOOST_ROOT && \ - ./bootstrap.sh --prefix=$BOOST_ROOT && \ - ./b2 -d1 define=_GLIBCXX_USE_CXX11_ABI=0 -j$((2*${NUM_PROCESSORS:-2})) &&\ - ./b2 -d0 define=_GLIBCXX_USE_CXX11_ABI=0 install + $time ./bootstrap.sh --prefix=$BOOST_ROOT && \ + $time ./b2 -d1 define=_GLIBCXX_USE_CXX11_ABI=0 -j$((2*${NUM_PROCESSORS:-2})) &&\ + $time ./b2 -d0 define=_GLIBCXX_USE_CXX11_ABI=0 install else echo "Using cached boost at $BOOST_ROOT" fi