diff --git a/.travis.yml b/.travis.yml index a7f975ee..e5872a31 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,29 +1,52 @@ language: c +os: + - linux + - osx compiler: - gcc + - clang + - x86_64-w64-mingw32-gcc +env: + - OPJ_CI_ARCH=x86_64 OPJ_CI_BUILD_CONFIGURATION=Release + - OPJ_CI_ARCH=i386 OPJ_CI_BUILD_CONFIGURATION=Release + - OPJ_CI_ARCH=x86_64 OPJ_CI_BUILD_CONFIGURATION=Debug OPJ_CI_ASAN=1 + - OPJ_CI_ARCH=x86_64 OPJ_CI_BUILD_CONFIGURATION=Debug + +matrix: + exclude: + - os: osx + compiler: gcc + - os: osx + compiler: x86_64-w64-mingw32-gcc + - compiler: clang + env: OPJ_CI_ARCH=i386 OPJ_CI_BUILD_CONFIGURATION=Release + - compiler: clang + env: OPJ_CI_ARCH=x86_64 OPJ_CI_BUILD_CONFIGURATION=Debug + - os: linux + compiler: clang + env: OPJ_CI_ARCH=x86_64 OPJ_CI_BUILD_CONFIGURATION=Release + - compiler: gcc + env: OPJ_CI_ARCH=x86_64 OPJ_CI_BUILD_CONFIGURATION=Debug OPJ_CI_ASAN=1 + - compiler: x86_64-w64-mingw32-gcc + env: OPJ_CI_ARCH=x86_64 OPJ_CI_BUILD_CONFIGURATION=Debug OPJ_CI_ASAN=1 + - compiler: x86_64-w64-mingw32-gcc + env: OPJ_CI_ARCH=x86_64 OPJ_CI_BUILD_CONFIGURATION=Debug + - os: osx + env: OPJ_CI_ARCH=x86_64 OPJ_CI_BUILD_CONFIGURATION=Debug OPJ_CI_ASAN=1 + +addons: + apt: + packages: + - gcc-multilib + - gcc-mingw-w64-base + - binutils-mingw-w64-i686 + - binutils-mingw-w64-x86-64 + - gcc-mingw-w64-i686 + - gcc-mingw-w64-x86-64 + - gcc-mingw-w64 -before_install: - - cmake --version - - git clone --depth=1 --branch=master git://github.com/uclouvain/openjpeg-data.git data - - wget -qO - https://github.com/openpreserve/jpylyzer/archive/1.14.2.tar.gz | tar -xvz -# When OPJ_NONCOMMERCIAL=1, kakadu trial binaries are used for testing. Here's the copyright notice from kakadu: -# Copyright is owned by NewSouth Innovations Pty Limited, commercial arm of the UNSW Australia in Sydney. -# You are free to trial these executables and even to re-distribute them, -# so long as such use or re-distribution is accompanied with this copyright notice and is not for commercial gain. -# Note: Binaries can only be used for non-commercial purposes. - - if [ "${OPJ_NONCOMMERCIAL:-}" == "1" ]; then wget -q http://kakadusoftware.com/wp-content/uploads/2014/06/KDU77_Demo_Apps_for_Linux-x86-64_150710.zip; fi install: - - chmod +x jpylyzer-1.14.2/jpylyzer/jpylyzer.py - - if [ "${OPJ_NONCOMMERCIAL:-}" == "1" ]; then cmake -E tar -xf KDU77_Demo_Apps_for_Linux-x86-64_150710.zip; fi - - export LD_LIBRARY_PATH=${PWD}/KDU77_Demo_Apps_for_Linux-x86-64_150710:${LD_LIBRARY_PATH} - - export PATH=${PWD}/KDU77_Demo_Apps_for_Linux-x86-64_150710:${PATH} + - ./tools/travis-ci/install.sh script: - - if [ "${OPJ_NONCOMMERCIAL:-}" == "1" ]; then echo -e "\nTesting will use Kakadu trial binaries. Here's the copyright notice from kakadu:\nCopyright is owned by NewSouth Innovations Pty Limited, commercial arm of the UNSW Australia in Sydney.\nYou are free to trial these executables and even to re-distribute them,\nso long as such use or re-distribution is accompanied with this copyright notice and is not for commercial gain.\nNote:\ Binaries can only be used for non-commercial purposes.\n"; fi - - mkdir build - - cd build - - cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DBUILD_CODEC=ON -DBUILD_THIRDPARTY=ON -DBUILD_TESTING=ON -DOPJ_DATA_ROOT=${PWD}/../data -DJPYLYZER_EXECUTABLE=${PWD}/../jpylyzer-1.14.2/jpylyzer/jpylyzer.py -DSITE=travis-ci.org -DBUILDNAME=${TRAVIS_OS_NAME}-${CC}$(${CC} -dumpversion)-x86_64-${TRAVIS_BRANCH}$( [[ "${TRAVIS_PULL_REQUEST}" != "false" ]] && echo "-pr${TRAVIS_PULL_REQUEST}" )-Release-3rdP .. - - ctest -D ExperimentalStart - - ctest -D ExperimentalBuild -V - - ctest -D ExperimentalTest -j2 || true - - ctest -D ExperimentalSubmit || true + - ./tools/travis-ci/run.sh diff --git a/tools/ctest_scripts/toolchain-mingw32.cmake b/tools/ctest_scripts/toolchain-mingw32.cmake new file mode 100644 index 00000000..1728f9ea --- /dev/null +++ b/tools/ctest_scripts/toolchain-mingw32.cmake @@ -0,0 +1,26 @@ +# http://www.cmake.org/Wiki/CmakeMingw +# +# Copyright (c) 2006-2014 Mathieu Malaterre +# +# Redistribution and use is allowed according to the terms of the New +# BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. +# + +# the name of the target operating system +set(CMAKE_SYSTEM_NAME Windows) + +# which compilers to use for C and C++ +set(CMAKE_C_COMPILER i686-w64-mingw32-gcc) +set(CMAKE_CXX_COMPILER i686-w64-mingw32-g++) +set(CMAKE_RC_COMPILER i686-w64-mingw32-windres) + +# here is the target environment located +set(CMAKE_FIND_ROOT_PATH /usr/i686-w64-mingw32) + +# adjust the default behaviour of the FIND_XXX() commands: +# search headers and libraries in the target environment, search +# programs in the host environment +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) diff --git a/tools/ctest_scripts/toolchain-mingw64.cmake b/tools/ctest_scripts/toolchain-mingw64.cmake new file mode 100644 index 00000000..5fe1507f --- /dev/null +++ b/tools/ctest_scripts/toolchain-mingw64.cmake @@ -0,0 +1,26 @@ +# http://www.cmake.org/Wiki/CmakeMingw +# +# Copyright (c) 2006-2014 Mathieu Malaterre +# +# Redistribution and use is allowed according to the terms of the New +# BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. +# + +# the name of the target operating system +set(CMAKE_SYSTEM_NAME Windows) + +# which compilers to use for C and C++ +set(CMAKE_C_COMPILER x86_64-w64-mingw32-gcc) +set(CMAKE_CXX_COMPILER x86_64-w64-mingw32-g++) +set(CMAKE_RC_COMPILER x86_64-w64-mingw32-windres) + +# here is the target environment located +set(CMAKE_FIND_ROOT_PATH /usr/x86_64-w64-mingw32) + +# adjust the default behaviour of the FIND_XXX() commands: +# search headers and libraries in the target environment, search +# programs in the host environment +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) diff --git a/tools/ctest_scripts/travis-ci.cmake b/tools/ctest_scripts/travis-ci.cmake new file mode 100644 index 00000000..6d50b3f5 --- /dev/null +++ b/tools/ctest_scripts/travis-ci.cmake @@ -0,0 +1,134 @@ +# ----------------------------------------------------------------------------- +# Travis-ci ctest script for OpenJPEG project +# This will compile/run tests/upload to cdash OpenJPEG +# Results will be available at: http://my.cdash.org/index.php?project=OPENJPEG +# ----------------------------------------------------------------------------- + +cmake_minimum_required(VERSION 2.8) + +set( ENV{LANG} en_US.UTF-8) +set( CTEST_DASHBOARD_ROOT "$ENV{PWD}/build" ) +set( CTEST_CMAKE_GENERATOR "Unix Makefiles") # Always makefile in travis-ci environment + +if ("$ENV{OPJ_BUILD_CONFIGURATION}" STREQUAL "") + set( CTEST_BUILD_CONFIGURATION "Release") +else() + set( CTEST_BUILD_CONFIGURATION "$ENV{OPJ_BUILD_CONFIGURATION}") +endif() + +if ("$ENV{OPJ_SITE}" STREQUAL "") + set( CTEST_SITE "Unknown") +else() + set( CTEST_SITE "$ENV{OPJ_SITE}") +endif() + +if ("$ENV{OPJ_BUILDNAME}" STREQUAL "") + set( CTEST_BUILD_NAME "Unknown-${CTEST_BUILD_CONFIGURATION}") +else() + set( CTEST_BUILD_NAME "$ENV{OPJ_BUILDNAME}") +endif() + +if (NOT "$ENV{OPJ_CI_ARCH}" STREQUAL "") + if (APPLE) + set(CCFLAGS_ARCH "-arch $ENV{OPJ_CI_ARCH}") + else() + if ("$ENV{OPJ_CI_ARCH}" MATCHES "^i[3-6]86$") + set(CCFLAGS_ARCH "-m32 -march=$ENV{OPJ_CI_ARCH}") + elseif ("$ENV{OPJ_CI_ARCH}" STREQUAL "x86_64") + set(CCFLAGS_ARCH "-m64") + endif() + endif() +endif() + +if ("$ENV{OPJ_CI_ASAN}" STREQUAL "1") + set(OPJ_HAS_MEMCHECK TRUE) + set(CTEST_MEMORYCHECK_TYPE "AddressSanitizer") + set(CCFLAGS_ARCH "${CCFLAGS_ARCH} -O1 -g -fsanitize=address -fno-omit-frame-pointer") +endif() + +if("$ENV{CC}" MATCHES ".*mingw.*") + # We are trying to use mingw + if ("$ENV{OPJ_CI_ARCH}" MATCHES "^i[3-6]86$") + set(CTEST_CONFIGURE_OPTIONS "-DCMAKE_TOOLCHAIN_FILE=${CTEST_SCRIPT_DIRECTORY}/toolchain-mingw32.cmake") + else() + set(CTEST_CONFIGURE_OPTIONS "-DCMAKE_TOOLCHAIN_FILE=${CTEST_SCRIPT_DIRECTORY}/toolchain-mingw64.cmake") + endif() +endif() + +if(NOT "$ENV{OPJ_CI_SKIP_TESTS}" STREQUAL "1") + # To execute part of the encoding test suite, kakadu binaries are needed to decode encoded image and compare + # it to the baseline. Kakadu binaries are freely available for non-commercial purposes + # at http://www.kakadusoftware.com. + # Here's the copyright notice from kakadu: + # Copyright is owned by NewSouth Innovations Pty Limited, commercial arm of the UNSW Australia in Sydney. + # You are free to trial these executables and even to re-distribute them, + # so long as such use or re-distribution is accompanied with this copyright notice and is not for commercial gain. + # Note: Binaries can only be used for non-commercial purposes. + if ("$ENV{OPJ_NONCOMMERCIAL}" STREQUAL "1" ) + set(KDUPATH $ENV{PWD}/kdu) + set(ENV{LD_LIBRARY_PATH} ${KDUPATH}) + set(ENV{PATH} $ENV{PATH}:${KDUPATH}) + endif() + set(BUILD_TESTING "TRUE") +else() + set(BUILD_TESTING "FALSE") +endif(NOT "$ENV{OPJ_CI_SKIP_TESTS}" STREQUAL "1") + +# Options +set( CACHE_CONTENTS " + +# Build kind +CMAKE_BUILD_TYPE:STRING=${CTEST_BUILD_CONFIGURATION} + +# Warning level +CMAKE_C_FLAGS:STRING= ${CCFLAGS_ARCH} -Wall -Wextra -Wconversion -Wno-unused-parameter -Wdeclaration-after-statement + +# Use to activate the test suite +BUILD_TESTING:BOOL=${BUILD_TESTING} + +# Build Thirdparty, useful but not required for test suite +BUILD_THIRDPARTY:BOOL=TRUE + +# JPEG2000 test files are available with git clone https://github.com/uclouvain/openjpeg-data.git +OPJ_DATA_ROOT:PATH=$ENV{PWD}/data + +# jpylyzer is available with on GitHub: https://github.com/openpreserve/jpylyzer +JPYLYZER_EXECUTABLE=$ENV{PWD}/jpylyzer/jpylyzer/jpylyzer.py + +" ) + +#--------------------- +#1. openjpeg specific: +set( CTEST_PROJECT_NAME "OPENJPEG" ) +if(NOT EXISTS $ENV{OPJ_SOURCE_DIR}) + message(FATAL_ERROR "OPJ_SOURCE_DIR not defined or does not exist:$ENV{OPJ_SOURCE_DIR}") +endif() +set( CTEST_SOURCE_DIRECTORY "$ENV{OPJ_SOURCE_DIR}") +set( CTEST_BINARY_DIRECTORY "${CTEST_DASHBOARD_ROOT}") + +#--------------------- +# Files to submit to the dashboard +set (CTEST_NOTES_FILES +${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME} +${CTEST_BINARY_DIRECTORY}/CMakeCache.txt ) + +ctest_empty_binary_directory( "${CTEST_BINARY_DIRECTORY}" ) +file(WRITE "${CTEST_BINARY_DIRECTORY}/CMakeCache.txt" "${CACHE_CONTENTS}") + +# Perform a Experimental build +ctest_start(Experimental) +#ctest_update(SOURCE "${CTEST_SOURCE_DIRECTORY}") +ctest_configure(BUILD "${CTEST_BINARY_DIRECTORY}" OPTIONS "${CTEST_CONFIGURE_OPTIONS}") +ctest_read_custom_files(${CTEST_BINARY_DIRECTORY}) +ctest_build(BUILD "${CTEST_BINARY_DIRECTORY}") +if(NOT "$ENV{OPJ_CI_SKIP_TESTS}" STREQUAL "1") + ctest_test(BUILD "${CTEST_BINARY_DIRECTORY}" PARALLEL_LEVEL 2) + if(OPJ_HAS_MEMCHECK) + ctest_memcheck(BUILD "${CTEST_BINARY_DIRECTORY}" PARALLEL_LEVEL 2) + endif() +endif() +if ("$ENV{OPJ_DO_SUBMIT}" STREQUAL "1") + ctest_submit() +endif() +# Do not clean, we'll parse the log for known failure +#ctest_empty_binary_directory( "${CTEST_BINARY_DIRECTORY}" ) diff --git a/tools/travis-ci/install.sh b/tools/travis-ci/install.sh new file mode 100755 index 00000000..11dcf26c --- /dev/null +++ b/tools/travis-ci/install.sh @@ -0,0 +1,85 @@ +#!/bin/bash + +# This script executes the install step when running under travis-ci + +# Set-up some error handling +set -o nounset ## set -u : exit the script if you try to use an uninitialised variable +set -o errexit ## set -e : exit the script if any statement returns a non-true return value +set -o pipefail ## Fail on error in pipe + +function exit_handler () +{ + local exit_code="$?" + + test ${exit_code} == 0 && return; + + echo -e "\nInstall failed !!!\nLast command at line ${BASH_LINENO}: ${BASH_COMMAND}"; + exit "${exit_code}" +} +trap exit_handler EXIT +trap exit ERR + +# We don't need anything for coverity scan builds + +if [ "${COVERITY_SCAN_BRANCH:-}" != "1" ]; then + + if [ "${OPJ_CI_ASAN:-}" == "1" ]; then + # We need a new version of cmake than travis-ci provides + wget -qO - http://www.cmake.org/files/v3.3/cmake-3.3.1-Linux-x86_64.tar.gz | tar -xz + # copy to a directory that will not changed every version + mv cmake-3.3.1-Linux-x86_64 cmake-install + fi + + if [ "${OPJ_CI_SKIP_TESTS:-}" != "1" ]; then + + OPJ_SOURCE_DIR=$(cd $(dirname $0)/../.. && pwd) + + # We need test data + if [ "${TRAVIS_BRANCH:-}" == "" ]; then + TRAVIS_BRANCH=$(git -C ${OPJ_SOURCE_DIR} branch | grep '*' | tr -d '*[[:blank:]]') #default to same branch as we're setting up + fi + OPJ_DATA_HAS_BRANCH=$(git ls-remote --heads git://github.com/uclouvain/openjpeg-data.git ${TRAVIS_BRANCH} | wc -l) + if [ ${OPJ_DATA_HAS_BRANCH} -ne 0 ]; then + OPJ_DATA_BRANCH=${TRAVIS_BRANCH} + else + OPJ_DATA_BRANCH=master #default to master + fi + echo "Cloning openjpeg-data from ${OPJ_DATA_BRANCH} branch" + git clone --depth=1 --branch=${OPJ_DATA_BRANCH} git://github.com/uclouvain/openjpeg-data.git data + + # We need jpylyzer for the test suite + echo "Retrieving jpylyzer" + wget -qO - https://github.com/openpreserve/jpylyzer/archive/1.14.2.tar.gz | tar -xz + mv jpylyzer-1.14.2 jpylyzer + chmod +x jpylyzer/jpylyzer/jpylyzer.py + + # When OPJ_NONCOMMERCIAL=1, kakadu trial binaries are used for testing. Here's the copyright notice from kakadu: + # Copyright is owned by NewSouth Innovations Pty Limited, commercial arm of the UNSW Australia in Sydney. + # You are free to trial these executables and even to re-distribute them, + # so long as such use or re-distribution is accompanied with this copyright notice and is not for commercial gain. + # Note: Binaries can only be used for non-commercial purposes. + if [ "${OPJ_NONCOMMERCIAL:-}" == "1" ]; then + if [ "${TRAVIS_OS_NAME:-}" == "linux" ] || uname -s | grep -i Linux &> /dev/null; then + echo "Retrieving Kakadu" + wget -q http://kakadusoftware.com/wp-content/uploads/2014/06/KDU77_Demo_Apps_for_Linux-x86-64_150710.zip + cmake -E tar -xf KDU77_Demo_Apps_for_Linux-x86-64_150710.zip + mv KDU77_Demo_Apps_for_Linux-x86-64_150710 kdu + elif [ "${TRAVIS_OS_NAME:-}" == "osx" ] || uname -s | grep -i Darwin &> /dev/null; then + echo "Retrieving Kakadu" + wget -q http://kakadusoftware.com/wp-content/uploads/2014/06/KDU77_Demo_Apps_for_OSX109_150710.dmg_.zip + cmake -E tar -xf KDU77_Demo_Apps_for_OSX109_150710.dmg_.zip + wget -q http://downloads.sourceforge.net/project/catacombae/HFSExplorer/0.23/hfsexplorer-0.23-bin.zip + mkdir hfsexplorer && cmake -E chdir hfsexplorer tar -xf ../hfsexplorer-0.23-bin.zip + ./hfsexplorer/bin/unhfs.sh -o ./ -fsroot Kakadu-demo-apps.pkg KDU77_Demo_Apps_for_OSX109_150710.dmg + pkgutil --expand Kakadu-demo-apps.pkg ./kdu + cd kdu + cat libkduv77r.pkg/Payload | gzip -d | cpio -id + cat kduexpand.pkg/Payload | gzip -d | cpio -id + cat kducompress.pkg/Payload | gzip -d | cpio -id + install_name_tool -id ${PWD}/libkdu_v77R.dylib libkdu_v77R.dylib + install_name_tool -change /usr/local/lib/libkdu_v77R.dylib ${PWD}/libkdu_v77R.dylib kdu_compress + install_name_tool -change /usr/local/lib/libkdu_v77R.dylib ${PWD}/libkdu_v77R.dylib kdu_expand + fi + fi + fi +fi diff --git a/tools/travis-ci/knownfailures-Ubuntu12.04-clang3.4-x86_64-Debug-3rdP-ASan.txt b/tools/travis-ci/knownfailures-Ubuntu12.04-clang3.4-x86_64-Debug-3rdP-ASan.txt new file mode 100644 index 00000000..ab2169d3 --- /dev/null +++ b/tools/travis-ci/knownfailures-Ubuntu12.04-clang3.4-x86_64-Debug-3rdP-ASan.txt @@ -0,0 +1 @@ +NR-ENC-Bretagne2.ppm-7-compare_dec-ref-out2base diff --git a/tools/travis-ci/knownfailures-Ubuntu12.04-gcc4.6.3-i386-Release-3rdP.txt b/tools/travis-ci/knownfailures-Ubuntu12.04-gcc4.6.3-i386-Release-3rdP.txt new file mode 100644 index 00000000..bad45972 --- /dev/null +++ b/tools/travis-ci/knownfailures-Ubuntu12.04-gcc4.6.3-i386-Release-3rdP.txt @@ -0,0 +1,61 @@ +NR-ENC-issue203-32x32-bgr16.bmp-43-compare_dump2base +NR-ENC-issue203-32x32-bgr16.bmp-43-compare_dec-ref-out2base +NR-ENC-issue203-33x33-bgr16.bmp-44-compare_dump2base +NR-ENC-issue203-33x33-bgr16.bmp-44-compare_dec-ref-out2base +NR-ENC-issue203-32x32-bgra16.bmp-45-compare_dump2base +NR-ENC-issue203-33x33-bgra16.bmp-46-compare_dump2base +NR-ENC-issue203-127x64-bgr16.bmp-49-compare_dump2base +NR-ENC-issue203-127x64-bgr16.bmp-49-compare_dec-ref-out2base +NR-DEC-issue104_jpxstream.jp2-33-decode-md5 +NR-DEC-issue226.j2k-74-decode +NR-DEC-issue226.j2k-74-decode-md5 +NR-DEC-p1_06.j2k-156-decode +NR-DEC-p1_06.j2k-156-decode-md5 +NR-DEC-p1_06.j2k-164-decode-md5 +NR-C1P0-p0_04.j2k-compare2base +NR-C1P0-p0_05.j2k-compare2base +NR-C1P0-p0_06.j2k-compare2base +NR-C1P1-p1_02.j2k-compare2base +NR-C1P1-p1_03.j2k-compare2base +NR-C1P1-p1_04.j2k-compare2base +NR-C1P1-p1_05.j2k-compare2base +NR-JP2-file2.jp2-compare2base +NR-JP2-file3.jp2-compare2base +NR-RIC-subsampling_1.jp2-compare2base +NR-RIC-subsampling_2.jp2-compare2base +NR-RIC-zoo1.jp2-compare2base +NR-RIC-zoo2.jp2-compare2base +NR-DEC-_00042.j2k-2-decode-md5 +NR-DEC-buxI.j2k-9-decode-md5 +NR-DEC-CT_Phillips_JPEG2K_Decompr_Problem.j2k-13-decode-md5 +NR-DEC-Marrin.jp2-18-decode-md5 +NR-DEC-kodak_2layers_lrcp.j2c-31-decode-md5 +NR-DEC-kodak_2layers_lrcp.j2c-32-decode-md5 +NR-DEC-file409752.jp2-40-decode-md5 +NR-DEC-issue188_beach_64bitsbox.jp2-41-decode-md5 +NR-DEC-issue206_image-000.jp2-42-decode-md5 +NR-DEC-issue205.jp2-43-decode-md5 +NR-DEC-issue228.j2k-60-decode-md5 +NR-DEC-issue134.jp2-67-decode-md5 +NR-DEC-issue208.jp2-69-decode-md5 +NR-DEC-issue211.jp2-70-decode-md5 +NR-DEC-issue135.j2k-68-decode-md5 +NR-DEC-issue414.jp2-110-decode-md5 +NR-DEC-p1_04.j2k-124-decode-md5 +NR-DEC-p1_04.j2k-125-decode-md5 +NR-DEC-p1_04.j2k-126-decode-md5 +NR-DEC-p1_04.j2k-127-decode-md5 +NR-DEC-p1_04.j2k-128-decode-md5 +NR-DEC-p1_04.j2k-129-decode-md5 +NR-DEC-p1_04.j2k-131-decode-md5 +NR-DEC-p1_04.j2k-134-decode-md5 +NR-DEC-p1_04.j2k-138-decode-md5 +NR-DEC-p1_04.j2k-140-decode-md5 +NR-DEC-p0_04.j2k-166-decode-md5 +NR-DEC-p0_04.j2k-168-decode-md5 +NR-DEC-p0_04.j2k-172-decode-md5 +NR-DEC-issue205.jp2-253-decode-md5 +NR-DEC-issue559-eci-090-CIELab.jp2-255-decode-md5 +NR-DEC-issue236-ESYCC-CDEF.jp2-254-decode-md5 +NR-DEC-issue559-eci-091-CIELab.jp2-256-decode-md5 +NR-DEC-p1_06.j2k-164-decode diff --git a/tools/travis-ci/knownfailures-Ubuntu14.04-gcc4.8.4-i386-Release-3rdP.txt b/tools/travis-ci/knownfailures-Ubuntu14.04-gcc4.8.4-i386-Release-3rdP.txt new file mode 100644 index 00000000..fe66aa36 --- /dev/null +++ b/tools/travis-ci/knownfailures-Ubuntu14.04-gcc4.8.4-i386-Release-3rdP.txt @@ -0,0 +1,45 @@ +NR-C1P0-p0_04.j2k-compare2base +NR-C1P0-p0_05.j2k-compare2base +NR-C1P0-p0_06.j2k-compare2base +NR-C1P1-p1_02.j2k-compare2base +NR-C1P1-p1_03.j2k-compare2base +NR-C1P1-p1_04.j2k-compare2base +NR-C1P1-p1_05.j2k-compare2base +NR-JP2-file2.jp2-compare2base +NR-JP2-file3.jp2-compare2base +NR-RIC-subsampling_1.jp2-compare2base +NR-RIC-subsampling_2.jp2-compare2base +NR-RIC-zoo1.jp2-compare2base +NR-RIC-zoo2.jp2-compare2base +NR-DEC-_00042.j2k-2-decode-md5 +NR-DEC-buxI.j2k-9-decode-md5 +NR-DEC-CT_Phillips_JPEG2K_Decompr_Problem.j2k-13-decode-md5 +NR-DEC-Marrin.jp2-18-decode-md5 +NR-DEC-kodak_2layers_lrcp.j2c-31-decode-md5 +NR-DEC-kodak_2layers_lrcp.j2c-32-decode-md5 +NR-DEC-file409752.jp2-40-decode-md5 +NR-DEC-issue188_beach_64bitsbox.jp2-41-decode-md5 +NR-DEC-issue206_image-000.jp2-42-decode-md5 +NR-DEC-issue205.jp2-43-decode-md5 +NR-DEC-issue228.j2k-60-decode-md5 +NR-DEC-issue134.jp2-67-decode-md5 +NR-DEC-issue208.jp2-69-decode-md5 +NR-DEC-issue211.jp2-70-decode-md5 +NR-DEC-issue414.jp2-110-decode-md5 +NR-DEC-p1_04.j2k-124-decode-md5 +NR-DEC-p1_04.j2k-125-decode-md5 +NR-DEC-p1_04.j2k-126-decode-md5 +NR-DEC-p1_04.j2k-127-decode-md5 +NR-DEC-p1_04.j2k-128-decode-md5 +NR-DEC-p1_04.j2k-129-decode-md5 +NR-DEC-p1_04.j2k-131-decode-md5 +NR-DEC-p1_04.j2k-134-decode-md5 +NR-DEC-p1_04.j2k-138-decode-md5 +NR-DEC-p1_04.j2k-140-decode-md5 +NR-DEC-p0_04.j2k-166-decode-md5 +NR-DEC-p0_04.j2k-168-decode-md5 +NR-DEC-p0_04.j2k-172-decode-md5 +NR-DEC-issue205.jp2-253-decode-md5 +NR-DEC-issue236-ESYCC-CDEF.jp2-254-decode-md5 +NR-DEC-issue559-eci-090-CIELab.jp2-255-decode-md5 +NR-DEC-issue559-eci-091-CIELab.jp2-256-decode-md5 diff --git a/tools/travis-ci/knownfailures-all.txt b/tools/travis-ci/knownfailures-all.txt new file mode 100644 index 00000000..5be40caa --- /dev/null +++ b/tools/travis-ci/knownfailures-all.txt @@ -0,0 +1,17 @@ +NR-DEC-p1_06.j2k-164-decode +NR-ENC-issue203-32x32-bgr16.bmp-43-compare_dump2base +NR-ENC-issue203-33x33-bgr16.bmp-44-compare_dump2base +NR-ENC-issue203-32x32-bgra16.bmp-45-compare_dump2base +NR-ENC-issue203-33x33-bgra16.bmp-46-compare_dump2base +NR-ENC-issue203-127x64-bgr16.bmp-49-compare_dump2base +NR-DEC-issue104_jpxstream.jp2-33-decode-md5 +NR-DEC-issue135.j2k-68-decode-md5 +NR-DEC-issue226.j2k-74-decode-md5 +NR-DEC-p1_06.j2k-156-decode-md5 +NR-DEC-p1_06.j2k-164-decode-md5 +NR-DEC-p1_06.j2k-156-decode +NR-DEC-issue226.j2k-74-decode +NR-ENC-issue203-32x32-bgr16.bmp-43-compare_dec-ref-out2base +NR-ENC-issue203-33x33-bgr16.bmp-44-compare_dec-ref-out2base +NR-ENC-issue203-127x64-bgr16.bmp-49-compare_dec-ref-out2base +NR-DEC-broken.jpc-73-decode diff --git a/tools/travis-ci/run.sh b/tools/travis-ci/run.sh new file mode 100755 index 00000000..bec41d6d --- /dev/null +++ b/tools/travis-ci/run.sh @@ -0,0 +1,214 @@ +#!/bin/bash + +# This script executes the script step when running under travis-ci + +# Set-up some bash options +set -o nounset ## set -u : exit the script if you try to use an uninitialised variable +set -o errexit ## set -e : exit the script if any statement returns a non-true return value +set -o pipefail ## Fail on error in pipe + +# Set-up some variables +if [ "${OPJ_CI_BUILD_CONFIGURATION:-}" == "" ]; then + export OPJ_CI_BUILD_CONFIGURATION=Release #default +fi +OPJ_SOURCE_DIR=$(cd $(dirname $0)/../.. && pwd) + +if [ "${OPJ_DO_SUBMIT:-}" == "" ]; then + OPJ_DO_SUBMIT=0 # Do not flood cdash by default +fi +if [ "${TRAVIS_REPO_SLUG:-}" != "" ]; then + OPJ_OWNER=$(echo "${TRAVIS_REPO_SLUG}" | sed 's/\(^.*\)\/.*/\1/') + OPJ_SITE="${OPJ_OWNER}.travis-ci.org" + if [ "${OPJ_OWNER}" == "uclouvain" ]; then + OPJ_DO_SUBMIT=1 + fi +else + OPJ_SITE="$(hostname)" +fi + +if [ "${TRAVIS_OS_NAME:-}" == "" ]; then + # Let's guess OS for testing purposes + echo "Guessing OS" + if uname -s | grep -i Darwin &> /dev/null; then + TRAVIS_OS_NAME=osx + elif uname -s | grep -i Linux &> /dev/null; then + TRAVIS_OS_NAME=linux + if [ "${CC:-}" == "" ]; then + # default to gcc + export CC=gcc + fi + else + echo "Failed to guess OS"; exit 1 + fi + echo "${TRAVIS_OS_NAME}" +fi + +if [ "${TRAVIS_OS_NAME}" == "osx" ]; then + OPJ_OS_NAME=$(sw_vers -productName | tr -d ' ')$(sw_vers -productVersion | sed 's/\([^0-9]*\.[0-9]*\).*/\1/') + OPJ_CC_VERSION=$(xcodebuild -version | grep -i xcode) + OPJ_CC_VERSION=xcode${OPJ_CC_VERSION:6} +elif [ "${TRAVIS_OS_NAME}" == "linux" ]; then + OPJ_OS_NAME=linux + if which lsb_release > /dev/null; then + OPJ_OS_NAME=$(lsb_release -si)$(lsb_release -sr | sed 's/\([^0-9]*\.[0-9]*\).*/\1/') + fi + if [ -z "${CC##*gcc*}" ]; then + OPJ_CC_VERSION=$(${CC} --version | head -1 | sed 's/.*\ \([0-9.]*[0-9]\)/\1/') + if [ -z "${CC##*mingw*}" ]; then + OPJ_CC_VERSION=mingw${OPJ_CC_VERSION} + # disable testing for now + export OPJ_CI_SKIP_TESTS=1 + else + OPJ_CC_VERSION=gcc${OPJ_CC_VERSION} + fi + elif [ -z "${CC##*clang*}" ]; then + OPJ_CC_VERSION=clang$(${CC} --version | grep version | sed 's/.*version \([^0-9.]*[0-9.]*\).*/\1/') + else + echo "Compiler not supported: ${CC}"; exit 1 + fi +else + echo "OS not supported: ${TRAVIS_OS_NAME}"; exit 1 +fi + +if [ "${OPJ_CI_ARCH:-}" == "" ]; then + echo "Guessing build architecture" + MACHINE_ARCH=$(uname -m) + if [ "${MACHINE_ARCH}" == "x86_64" ]; then + export OPJ_CI_ARCH=x86_64 + fi + echo "${OPJ_CI_ARCH}" +fi + +if [ "${TRAVIS_BRANCH:-}" == "" ]; then + echo "Guessing branch" + TRAVIS_BRANCH=$(git -C ${OPJ_SOURCE_DIR} branch | grep '*' | tr -d '*[[:blank:]]') #default to master +fi + +OPJ_BUILDNAME=${OPJ_OS_NAME}-${OPJ_CC_VERSION}-${OPJ_CI_ARCH}-${TRAVIS_BRANCH} +OPJ_BUILDNAME_TEST=${OPJ_OS_NAME}-${OPJ_CC_VERSION}-${OPJ_CI_ARCH} +if [ "${TRAVIS_PULL_REQUEST:-}" != "false" ] && [ "${TRAVIS_PULL_REQUEST:-}" != "" ]; then + OPJ_BUILDNAME=${OPJ_BUILDNAME}-pr${TRAVIS_PULL_REQUEST} +fi +OPJ_BUILDNAME=${OPJ_BUILDNAME}-${OPJ_CI_BUILD_CONFIGURATION}-3rdP +OPJ_BUILDNAME_TEST=${OPJ_BUILDNAME_TEST}-${OPJ_CI_BUILD_CONFIGURATION}-3rdP +if [ "${OPJ_CI_ASAN:-}" == "1" ]; then + OPJ_BUILDNAME=${OPJ_BUILDNAME}-ASan + OPJ_BUILDNAME_TEST=${OPJ_BUILDNAME_TEST}-ASan +fi + +if [ "${OPJ_NONCOMMERCIAL:-}" == "1" ] && [ "${OPJ_CI_SKIP_TESTS:-}" != "1" ] && [ -d kdu ]; then + echo " +Testing will use Kakadu trial binaries. Here's the copyright notice from kakadu: +Copyright is owned by NewSouth Innovations Pty Limited, commercial arm of the UNSW Australia in Sydney. +You are free to trial these executables and even to re-distribute them, +so long as such use or re-distribution is accompanied with this copyright notice and is not for commercial gain. +Note: Binaries can only be used for non-commercial purposes. +" +fi + +if [ -d cmake-install ]; then + export PATH=${PWD}/cmake-install/bin:${PATH} +fi + +set -x +# This will print configuration +# travis-ci doesn't dump cmake version in system info, let's print it +cmake --version + +export OPJ_SITE=${OPJ_SITE} +export OPJ_BUILDNAME=${OPJ_BUILDNAME} +export OPJ_SOURCE_DIR=${OPJ_SOURCE_DIR} +export OPJ_BUILD_CONFIGURATION=${OPJ_CI_BUILD_CONFIGURATION} +export OPJ_DO_SUBMIT=${OPJ_DO_SUBMIT} + +ctest -S ${OPJ_SOURCE_DIR}/tools/ctest_scripts/travis-ci.cmake -V || true +# ctest will exit with various error codes depending on version. +# ignore ctest exit code & parse this ourselves +set +x + +# let's parse configure/build/tests for failure + +echo " +Parsing logs for failures +" +OPJ_CI_RESULT=0 + +# 1st configure step +OPJ_CONFIGURE_XML=$(find build -path 'build/Testing/*' -name 'Configure.xml') +if [ ! -f "${OPJ_CONFIGURE_XML}" ]; then + echo "No configure log found" + OPJ_CI_RESULT=1 +else + if ! grep '0' ${OPJ_CONFIGURE_XML} &> /dev/null; then + echo "Errors were found in configure log" + OPJ_CI_RESULT=1 + fi +fi + +# 2nd build step +# We must have one Build.xml file +OPJ_BUILD_XML=$(find build -path 'build/Testing/*' -name 'Build.xml') +if [ ! -f "${OPJ_BUILD_XML}" ]; then + echo "No build log found" + OPJ_CI_RESULT=1 +else + if grep '' ${OPJ_BUILD_XML} &> /dev/null; then + echo "Errors were found in build log" + OPJ_CI_RESULT=1 + fi +fi + +if [ ${OPJ_CI_RESULT} -ne 0 ]; then + # Don't trash output with failing tests when there are configure/build errors + exit ${OPJ_CI_RESULT} +fi + +if [ "${OPJ_CI_SKIP_TESTS:-}" != "1" ]; then + OPJ_TEST_XML=$(find build -path 'build/Testing/*' -name 'Test.xml') + if [ ! -f "${OPJ_TEST_XML}" ]; then + echo "No test log found" + OPJ_CI_RESULT=1 + else + echo "Parsing tests for new/unknown failures" + # 3rd test step + OPJ_FAILEDTEST_LOG=$(find build -path 'build/Testing/Temporary/*' -name 'LastTestsFailed_*.log') + if [ -f "${OPJ_FAILEDTEST_LOG}" ]; then + awk -F: '{ print $2 }' ${OPJ_FAILEDTEST_LOG} > failures.txt + while read FAILEDTEST; do + # Start with common errors + if grep -x "${FAILEDTEST}" ${OPJ_SOURCE_DIR}/tools/travis-ci/knownfailures-all.txt > /dev/null; then + continue + fi + if [ -f ${OPJ_SOURCE_DIR}/tools/travis-ci/knownfailures-${OPJ_BUILDNAME_TEST}.txt ]; then + if grep -x "${FAILEDTEST}" ${OPJ_SOURCE_DIR}/tools/travis-ci/knownfailures-${OPJ_BUILDNAME_TEST}.txt > /dev/null; then + continue + fi + fi + echo "${FAILEDTEST}" + OPJ_CI_RESULT=1 + done < failures.txt + fi + fi + + if [ ${OPJ_CI_RESULT} -eq 0 ]; then + echo "No new/unknown test failure found + " + else + echo " +New/unknown test failure found!!! + " + fi + + # 4th memcheck step + OPJ_MEMCHECK_XML=$(find build -path 'build/Testing/*' -name 'DynamicAnalysis.xml') + if [ -f "${OPJ_MEMCHECK_XML}" ]; then + if grep ' /dev/null; then + echo "Errors were found in dynamic analysis log" + OPJ_CI_RESULT=1 + fi + fi + + +fi + +exit ${OPJ_CI_RESULT}