From c121227125bbc1e960aa051a83ae21cc9c9c3ee9 Mon Sep 17 00:00:00 2001 From: "Dmitry V. Levin" Date: Sun, 18 Dec 2016 00:12:48 +0000 Subject: [PATCH] travis: do coverage using a dedicated build * .travis.yml (after_success): Remove. (matrix): Create an entry for the regular x86_64 target. * travis-success.sh: Merge into ... * travis-build.sh: ... this file. Disable optimization for coverage builds. * travis-install.sh: Rename COVERAGE=true to CHECK=coverage. --- .travis.yml | 7 ++++--- travis-build.sh | 30 +++++++++++++++++++++++++++--- travis-install.sh | 10 ++++++---- travis-success.sh | 12 ------------ 4 files changed, 37 insertions(+), 22 deletions(-) delete mode 100755 travis-success.sh diff --git a/.travis.yml b/.travis.yml index 0eba591d..60793764 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,8 +6,6 @@ before_install: ./travis-install.sh script: ./travis-build.sh -after_success: ./travis-success.sh - sudo: required git: @@ -23,7 +21,6 @@ matrix: - compiler: gcc env: - TARGET=x86_64 - - COVERAGE=true - compiler: gcc env: - TARGET=x32 @@ -42,3 +39,7 @@ matrix: - compiler: musl-gcc env: - TARGET=x86 + - compiler: gcc + env: + - TARGET=x86_64 + - CHECK=coverage diff --git a/travis-build.sh b/travis-build.sh index 32ccd508..1f644918 100755 --- a/travis-build.sh +++ b/travis-build.sh @@ -17,7 +17,17 @@ case "${TARGET-}" in ;; x86) CC="$CC -m32" - export DISTCHECK_CONFIGURE_FLAGS='--build=i686-pc-linux-gnu --target=i686-pc-linux-gnu' + DISTCHECK_CONFIGURE_FLAGS='--build=i686-pc-linux-gnu --target=i686-pc-linux-gnu' + export DISTCHECK_CONFIGURE_FLAGS + ;; +esac + +case "${CHECK-}" in + coverage) + CHECK_CONFIGURE_FLAGS=--enable-code-coverage + CFLAGS='-g -O0' + CFLAGS_FOR_BUILD="$CFLAGS" + export CFLAGS CFLAGS_FOR_BUILD ;; esac @@ -26,7 +36,21 @@ export CC_FOR_BUILD="$CC" ./git-set-file-times ./bootstrap -./configure --enable-maintainer-mode ${ENABLE_GCC_WERROR-} ${DISTCHECK_CONFIGURE_FLAGS-} +./configure --enable-maintainer-mode \ + ${ENABLE_GCC_WERROR-} \ + ${DISTCHECK_CONFIGURE_FLAGS-} \ + ${CHECK_CONFIGURE_FLAGS-} \ + # j=-j`getconf _NPROCESSORS_ONLN 2> /dev/null` || j= -make -k $j distcheck VERBOSE=${VERBOSE-} + +case "${CHECK-}" in + coverage) + make -k $j all VERBOSE=${VERBOSE-} + make -k $j check VERBOSE=${VERBOSE-} + codecov --gcov-args=-abcp ||: + ;; + *) + make -k $j distcheck VERBOSE=${VERBOSE-} + ;; +esac diff --git a/travis-install.sh b/travis-install.sh index ba5ff2df..c4f6b8b6 100755 --- a/travis-install.sh +++ b/travis-install.sh @@ -47,7 +47,9 @@ case "$CC" in ;; esac -if [ "${COVERAGE-}" = true ]; then - apt_get_install lcov - pip install --user codecov -fi +case "${CHECK-}" in + coverage) + apt_get_install lcov + pip install --user codecov + ;; +esac diff --git a/travis-success.sh b/travis-success.sh deleted file mode 100755 index cb04d45d..00000000 --- a/travis-success.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh -ex - -if [ "${COVERAGE-}" = true ]; then - set -- strace-*.tar.xz - tar -xf "$1" - dir="${1%.tar.xz}" - cd "$dir" - export CC_FOR_BUILD="$CC" - ./configure --enable-code-coverage - make -k $j all check VERBOSE=${VERBOSE-} - codecov --gcov-args=-abcp ||: -fi -- 2.40.0