travis.yml: try to run ASAN on travis (#10645)

* fixing travis with docker. Env vars weren't passed to docker, so it was compiling always in the same way and not with clang/gcc
* replacing damo22/r2-travis with radareorg/r2-travis
* introduce an ASAN build on travis
This commit is contained in:
Riccardo Schirone 2018-07-06 23:35:55 +02:00 committed by xarkes
parent ff00596385
commit ed73ea036c
4 changed files with 38 additions and 6 deletions

View File

@ -14,14 +14,18 @@ matrix:
env: COMPILER_NAME=gcc CXX=g++ CC=gcc
- os: linux
env: COMPILER_NAME=clang CXX=clang++ CC=clang
- 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
- os: osx
env: COMPILER_NAME=clang CXX=clang++ CC=clang
allow_failures:
- 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
cache:
- ccache
before_install:
- if [ "$TRAVIS_OS_NAME" != "osx" ]; then docker pull damo22/r2-travis || docker build -t damo22/r2-travis:latest -f Dockerfile.travis . ; else rm -rf .nvm && git clone https://github.com/creationix/nvm.git .nvm && (cd .nvm && git checkout `git describe --abbrev=0 --tags`) && . .nvm/nvm.sh && nvm install 8.11.3; fi
- if [ "$TRAVIS_OS_NAME" != "osx" ]; then docker pull radareorg/r2-travis || docker build -t radareorg/r2-travis:latest -f Dockerfile.travis . ; else rm -rf .nvm && git clone https://github.com/creationix/nvm.git .nvm && (cd .nvm && git checkout `git describe --abbrev=0 --tags`) && . .nvm/nvm.sh && nvm install 8.11.3; fi
script:
- export PR_NAME=$(echo $TRAVIS_PULL_REQUEST_SLUG | cut -d'/' -f1)
@ -32,7 +36,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 docker run -v /home/travis/.ccache:/root/.ccache -v ${TRAVIS_BUILD_DIR}:${TRAVIS_BUILD_DIR} --entrypoint "/bin/bash" damo22/r2-travis:latest -c ". /src/.nvm/nvm.sh; cd ${TRAVIS_BUILD_DIR}; R2R_BRANCH=${R2R_BRANCH} R2R_REPO=${R2R_REPO} R2R_DEFAULT_BRANCH=${R2R_DEFAULT_BRANCH} R2R_DEFAULT_REPO=${R2R_DEFAULT_REPO} TRAVIS_BUILD_DIR=${TRAVIS_BUILD_DIR} bash travis-script"; else bash travis-script; fi
- if [ "$TRAVIS_OS_NAME" != "osx" ]; then bash ./travis-extract-var.sh > docker-env.txt ; cat docker-env.txt ; fi
- if [ "$TRAVIS_OS_NAME" != "osx" ]; then docker run -v /home/travis/.ccache:/root/.ccache -v ${TRAVIS_BUILD_DIR}:${TRAVIS_BUILD_DIR} --env-file=docker-env.txt --entrypoint "/bin/bash" radareorg/r2-travis:latest -c ". /src/.nvm/nvm.sh; cd ${TRAVIS_BUILD_DIR}; bash travis-script"; else bash travis-script; fi
notifications:
irc: "chat.freenode.net#radare"

View File

@ -18,6 +18,7 @@ RUN dnf install -y \
git \
binutils \
cabextract \
libasan \
libcurl-devel \
elfutils-libelf-devel \
elfutils-libelf-devel-static \

24
travis-extract-var.sh Normal file
View File

@ -0,0 +1,24 @@
#!/bin/bash
print_var()
{
VAR_NAME=$1
VAR_VALUE=$2
if [ "${VAR_VALUE}" != "" ] ; then
echo "${VAR_NAME}=${VAR_VALUE}"
fi
}
env -0 | while IFS='=' read -r -d '' n v; do
if [[ "${n}" =~ ^TRAVIS_* || "${n}" =~ ^R2* || "${n}" =~ ^ASAN* ]]; then
print_var "${n}" "${v}"
fi
done
# print extra variables
print_var CC "${CC}"
print_var CXX "${CXX}"
print_var CFLAGS "${CFLAGS}"
print_var LDFLAGS "${LDFLAGS}"
print_var CXXFLAGS "${CXXFLAGS}"

View File

@ -1,12 +1,14 @@
#!/bin/bash
set -x
export PKG_CONFIG_PATH=${TRAVIS_BUILD_DIR}/pkgcfg:${PKG_CONFIG_PATH}
export PATH=${TRAVIS_BUILD_DIR}/install/bin:${PATH}
export LD_LIBRARY_PATH=${TRAVIS_BUILD_DIR}/install/lib:${LD_LIBRARY_PATH}
git clone --depth 1 --branch "${R2R_BRANCH}" "${R2R_REPO}" || true # If cloning fails that's not an error: we simply fallback to master.
ls radare2-regressions >/dev/null 2>&1 || git clone --depth 1 --branch "${R2R_DEFAULT_BRANCH}" "${R2R_DEFAULT_REPO}"
./configure --prefix=${TRAVIS_BUILD_DIR}/install > /dev/null
make -s -j2 > /dev/null
make install > /dev/null
./configure --prefix=${TRAVIS_BUILD_DIR}/install > /dev/null || exit 1
make -s -j2 > /dev/null || exit 1
make install > /dev/null || exit 1
#[ "$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