From 7936da85fd05c8256d637ddb3eb53135dd089ccf Mon Sep 17 00:00:00 2001 From: Riccardo Schirone Date: Mon, 3 Sep 2018 18:05:29 +0200 Subject: [PATCH] enable codecov.io (#11279) * enable codecov.io --- .travis.yml | 8 ++++++-- travis-extract-var.sh | 6 ++++-- travis-script | 24 +++++++++++++++--------- 3 files changed, 25 insertions(+), 13 deletions(-) diff --git a/.travis.yml b/.travis.yml index e98308fd73..dd7bcc64c2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -24,6 +24,8 @@ matrix: - if: head_branch =~ ^asan-* OR tag =~ ^release-* OR type = push os: linux env: COMPILER_NAME=clang CXX=clang++ CC=clang CFLAGS="-O0 -ggdb -fsanitize=address -fno-omit-frame-pointer" LDFLAGS="-O0 -ggdb -fsanitize=address -fno-omit-frame-pointer" ASAN_OPTIONS=detect_odr_violation=0 LSAN_OPTIONS=detect_leaks=0 + - os: linux + env: COMPILER_NAME=gcc CXX=g++ CC=gcc COVERAGE=1 INSTALL_SYSTEM=meson - os: osx env: COMPILER_NAME=clang CXX=clang++ CC=clang allow_failures: @@ -31,6 +33,8 @@ matrix: env: COMPILER_NAME=gcc CXX=g++ CC=gcc INSTALL_SYSTEM=meson R2_SYS_CAPSTONE=true R2_SYS_MAGIC=true R2_SYS_ZIP=true R2_SYS_LZ4=true R2_SYS_ZLIB=true - os: linux env: COMPILER_NAME=clang CXX=clang++ CC=clang CFLAGS="-O0 -ggdb -fsanitize=address -fno-omit-frame-pointer" LDFLAGS="-O0 -ggdb -fsanitize=address -fno-omit-frame-pointer" ASAN_OPTIONS=detect_odr_violation=0 LSAN_OPTIONS=detect_leaks=0 + - os: linux + env: COMPILER_NAME=gcc CXX=g++ CC=gcc COVERAGE=1 INSTALL_SYSTEM=meson cache: - ccache @@ -46,8 +50,8 @@ script: - export R2R_BRANCH=$([ -n "${TRAVIS_PULL_REQUEST_BRANCH}" ] && echo "${TRAVIS_PULL_REQUEST_BRANCH}" || echo "${R2R_DEFAULT_BRANCH}") - if [ "${R2R_BRANCH}" = master ]; then USER_NAME=radare; fi - export R2R_REPO=$(doc/repo PR_REGRESSIONS | sed "s/__USER__/${USER_NAME}/g") - - if [ "$TRAVIS_OS_NAME" != "osx" ]; then bash ./travis-extract-var.sh > ${TRAVIS_BUILD_DIR}/docker-env.sh ; cat ${TRAVIS_BUILD_DIR}/docker-env.sh ; fi - - if [ "$TRAVIS_OS_NAME" != "osx" ]; then docker run -v /home/travis/.ccache:/root/.ccache -v ${TRAVIS_BUILD_DIR}:${TRAVIS_BUILD_DIR} --entrypoint "/bin/bash" radareorg/r2-travis:latest -c ". /src/.nvm/nvm.sh; cd ${TRAVIS_BUILD_DIR}; . docker-env.sh; bash travis-script"; else bash travis-script; fi + - if [ "$TRAVIS_OS_NAME" != "osx" ]; then bash ./travis-extract-var.sh > ${TRAVIS_BUILD_DIR}/docker-env.sh ; cat ${TRAVIS_BUILD_DIR}/docker-env.sh ; ci_env=`bash <(curl -s https://codecov.io/env)` ; echo "${ci_env}" ; fi + - if [ "$TRAVIS_OS_NAME" != "osx" ]; then docker run ${ci_env} -v /home/travis/.ccache:/root/.ccache -v ${TRAVIS_BUILD_DIR}:${TRAVIS_BUILD_DIR} --entrypoint "/bin/bash" radareorg/r2-travis:latest -c ". /src/.nvm/nvm.sh; cd ${TRAVIS_BUILD_DIR}; . docker-env.sh; bash travis-script"; else bash travis-script; fi notifications: irc: "chat.freenode.net#radare" diff --git a/travis-extract-var.sh b/travis-extract-var.sh index f29b331a9d..85dfac62de 100644 --- a/travis-extract-var.sh +++ b/travis-extract-var.sh @@ -5,13 +5,13 @@ print_var() VAR_NAME=$1 VAR_VALUE=$2 if [ "${VAR_VALUE}" != "" ] ; then - printf "export %s=%q\n" "${VAR_NAME}" "${VAR_VALUE}" + printf "export %s=%q\n" "${VAR_NAME}" "${VAR_VALUE}" fi } env -0 | while IFS='=' read -r -d '' n v; do if [[ "${n}" =~ ^TRAVIS_* || "${n}" =~ ^R2* || "${n}" =~ SAN_* ]]; then - print_var "${n}" "${v}" + print_var "${n}" "${v}" fi done @@ -22,3 +22,5 @@ print_var CFLAGS "${CFLAGS}" print_var LDFLAGS "${LDFLAGS}" print_var CXXFLAGS "${CXXFLAGS}" print_var INSTALL_SYSTEM "${INSTALL_SYSTEM}" +print_var MESON_OPTIONS "${MESON_OPTIONS}" +print_var COVERAGE "${COVERAGE}" diff --git a/travis-script b/travis-script index dc8dde19a4..207e948c3d 100644 --- a/travis-script +++ b/travis-script @@ -11,19 +11,22 @@ if [ "${INSTALL_SYSTEM}" == "meson" ] ; then OPTS="" if [ "${R2_SYS_CAPSTONE}" != "" ] ; then - OPTS="${OPTS} -D use_sys_capstone=${R2_SYS_CAPSTONE}" + OPTS="${OPTS} -D use_sys_capstone=${R2_SYS_CAPSTONE}" fi if [ "${R2_SYS_MAGIC}" != "" ] ; then - OPTS="${OPTS} -D use_sys_magic=${R2_SYS_MAGIC}" + OPTS="${OPTS} -D use_sys_magic=${R2_SYS_MAGIC}" fi if [ "${R2_SYS_ZLIB}" != "" ] ; then - OPTS="${OPTS} -D use_sys_zlib=${R2_SYS_ZLIB}" + OPTS="${OPTS} -D use_sys_zlib=${R2_SYS_ZLIB}" fi if [ "${R2_SYS_ZIP}" != "" ] ; then - OPTS="${OPTS} -D use_sys_zip=${R2_SYS_ZIP}" + OPTS="${OPTS} -D use_sys_zip=${R2_SYS_ZIP}" fi if [ "${R2_SYS_LZ4}" != "" ] ; then - OPTS="${OPTS} -D use_sys_lz4=${R2_SYS_LZ4}" + OPTS="${OPTS} -D use_sys_lz4=${R2_SYS_LZ4}" + fi + if [ "${COVERAGE}" == "1" ] ; then + OPTS="${OPTS} -Db_coverage=true" fi meson --prefix=${TRAVIS_BUILD_DIR}/install ${OPTS} build @@ -39,10 +42,6 @@ else make install > /dev/null || exit 1 export PKG_CONFIG_PATH=${TRAVIS_BUILD_DIR}/pkgcfg:${PKG_CONFIG_PATH} fi -#[ "$TRAVIS_OS_NAME" != "osx" ] && mkdir -p /tmp/kcov && pushd /tmp/kcov -#[ "$TRAVIS_OS_NAME" != "osx" ] && mkdir ${TRAVIS_BUILD_DIR}/kcov -#[ "$TRAVIS_OS_NAME" != "osx" ] && wget https://github.com/SimonKagstrom/kcov/archive/master.tar.gz && tar xzf master.tar.gz && mkdir kcov-master/build && cd kcov-master/build && cmake .. && make && make install DESTDIR=../tmp && popd -#[ "$TRAVIS_OS_NAME" != "osx" ] && export KCOV="/tmp/kcov/kcov-master/tmp/usr/local/bin/kcov --coveralls-id=$TRAVIS_JOB_ID ${TRAVIS_BUILD_DIR}/kcov" export NOOK=1 export NOREPORT=1 cd radare2-regressions @@ -50,3 +49,10 @@ git remote -v git branch git rev-parse HEAD VERBOSE=1 make -k all + +if [ "${COVERAGE}" == "1" ] ; then + cd ../build + curl -s https://codecov.io/bash > ./codecov.sh + chmod +x ./codecov.sh + ./codecov.sh -v 2>/dev/null +fi