diff --git a/.travis.yml b/.travis.yml index f32a639a..af511f0b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,7 +6,15 @@ matrix: dist: trusty sudo: required compiler: gcc - env: COVERAGE=1 CMAKE_OPTIONS="-DCMAKE_BUILD_TYPE=Release -DEXIV2_ENABLE_VIDEO=ON -DEXIV2_ENABLE_WEBREADY=ON -DEXIV2_BUILD_UNIT_TESTS=ON -DBUILD_WITH_COVERAGE=ON -DEXIV2_TEAM_USE_SANITIZERS=ON" # All enabled + Coverage + env: COVERAGE=1 CMAKE_OPTIONS="-DCMAKE_BUILD_TYPE=Release -DEXIV2_ENABLE_VIDEO=ON -DEXIV2_ENABLE_WEBREADY=ON -DEXIV2_BUILD_UNIT_TESTS=ON -DBUILD_WITH_COVERAGE=ON" # All enabled + Coverage + + - os: linux + dist: trusty + sudo: required + compiler: gcc + env: + - WITH_VALGRIND=1 + - CMAKE_OPTIONS="-DCMAKE_BUILD_TYPE=Release -DEXIV2_ENABLE_VIDEO=ON -DEXIV2_ENABLE_WEBREADY=ON -DEXIV2_BUILD_UNIT_TESTS=ON" - os: linux dist: trusty @@ -19,7 +27,7 @@ matrix: - sourceline: 'ppa:ubuntu-toolchain-r/test' packages: - g++-8 - env: CC=gcc-8 CXX=g++-8 CMAKE_OPTIONS="-DCMAKE_BUILD_TYPE=Release -DEXIV2_ENABLE_VIDEO=ON -DEXIV2_ENABLE_WEBREADY=ON -DEXIV2_BUILD_UNIT_TESTS=ON -DEXIV2_TEAM_USE_SANITIZERS=ON" + env: CC=gcc-8 CXX=g++-8 CMAKE_OPTIONS="-DCMAKE_BUILD_TYPE=Release -DEXIV2_ENABLE_VIDEO=ON -DEXIV2_ENABLE_WEBREADY=ON -DEXIV2_BUILD_UNIT_TESTS=ON" - os: linux dist: trusty @@ -29,7 +37,7 @@ matrix: - os: osx osx_image: xcode9 compiler: clang - env: PYTHON=3.6.2 CMAKE_OPTIONS="-DCMAKE_BUILD_TYPE=Release -DEXIV2_ENABLE_VIDEO=ON -DEXIV2_ENABLE_WEBREADY=ON -DEXIV2_BUILD_UNIT_TESTS=ON -DEXIV2_TEAM_USE_SANITIZERS=ON" # All enabled + env: PYTHON=3.6.2 CMAKE_OPTIONS="-DCMAKE_BUILD_TYPE=Release -DEXIV2_ENABLE_VIDEO=ON -DEXIV2_ENABLE_WEBREADY=ON -DEXIV2_BUILD_UNIT_TESTS=ON" # All enabled env: #- CMAKE_OPTIONS="-DCMAKE_BUILD_TYPE=Release" # Default diff --git a/ci/install.sh b/ci/install.sh index 08759767..8331d6c1 100755 --- a/ci/install.sh +++ b/ci/install.sh @@ -6,6 +6,9 @@ if [[ "$(uname -s)" == 'Linux' ]]; then sudo apt-get update sudo apt-get install cmake zlib1g-dev libssh-dev gettext sudo apt-get install python-pip libxml2-utils + if [ -n "$WITH_VALGRIND" ]; then + sudo apt-get install valgrind + fi sudo pip install virtualenv virtualenv conan source conan/bin/activate diff --git a/ci/run.sh b/ci/run.sh index ec5b5c41..d85d3c5e 100755 --- a/ci/run.sh +++ b/ci/run.sh @@ -5,7 +5,17 @@ set -x if [[ "$(uname -s)" == 'Linux' ]]; then source conan/bin/activate + + if [ "$CC" == "clang" ]; then + # clang + Ubuntu don't like to run with UBSAN, but ASAN works + export CMAKE_OPTIONS="$CMAKE_OPTIONS -DCMAKE_CXX_FLAGS=\"-fsanitize=address\" -DCMAKE_C_FLAGS=\"-fsanitize=address\" -DCMAKE_EXE_LINKER_FLAGS=\"-fsanitize=address\" -DCMAKE_MODULE_LINKER_FLAGS=\"-fsanitize=address\"" + elif [ -n "$WITH_VALGRIND" ]; then + export EXIV2_VALGRIND="valgrind --quiet" + else + export CMAKE_OPTIONS="$CMAKE_OPTIONS -DEXIV2_TEAM_USE_SANITIZERS=ON" + fi else + export CMAKE_OPTIONS="$CMAKE_OPTIONS -DEXIV2_TEAM_USE_SANITIZERS=ON" export PYENV_VERSION=$PYTHON export PATH="/Users/travis/.pyenv/shims:${PATH}" eval "$(pyenv init -)" @@ -16,15 +26,17 @@ fi mkdir build && cd build conan install .. --build missing --profile release + cmake ${CMAKE_OPTIONS} -DCMAKE_INSTALL_PREFIX=install .. make -j2 VERBOSE=1 make tests make install +pushd . cd bin -./unit_tests +$EXIV2_VALGRIND ./unit_tests +popd if [ -n "$COVERAGE" ]; then - cd .. bash <(curl -s https://codecov.io/bash) fi diff --git a/tests/suite.conf b/tests/suite.conf index 202d0b99..afee3fe2 100644 --- a/tests/suite.conf +++ b/tests/suite.conf @@ -1,9 +1,11 @@ [General] timeout: 1 +memcheck: ${ENV:valgrind} [ENV] exiv2_path: EXIV2_BINDIR binary_extension: EXIV2_EXT +valgrind: EXIV2_VALGRIND [ENV fallback] exiv2_path: ../build/bin