diff --git a/.travis.yml b/.travis.yml index e5872a31..8fc6169f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,42 +1,38 @@ 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: + include: - os: osx + compiler: clang + env: OPJ_CI_ARCH=x86_64 OPJ_CI_BUILD_CONFIGURATION=Release + - os: linux + compiler: gcc + env: OPJ_CI_ARCH=x86_64 OPJ_CI_BUILD_CONFIGURATION=Release + - os: linux compiler: gcc - - os: osx - compiler: x86_64-w64-mingw32-gcc - - compiler: clang env: OPJ_CI_ARCH=i386 OPJ_CI_BUILD_CONFIGURATION=Release - - compiler: clang + - os: linux + compiler: gcc 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=Debug OPJ_CI_ASAN=1 + - os: linux + compiler: x86_64-w64-mingw32-gcc 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 - + - os: linux + compiler: x86_64-w64-mingw32-gcc + env: OPJ_CI_ARCH=i386 OPJ_CI_BUILD_CONFIGURATION=Release + - os: linux + compiler: gcc-4.8 + env: OPJ_CI_ABI_CHECK=1 + addons: apt: + sources: + - ubuntu-toolchain-r-test packages: + - gcc-4.8 - gcc-multilib - gcc-mingw-w64-base - binutils-mingw-w64-i686 @@ -44,9 +40,14 @@ addons: - gcc-mingw-w64-i686 - gcc-mingw-w64-x86-64 - gcc-mingw-w64 + - libelf-dev + - elfutils + - texinfo + - exuberant-ctags install: - ./tools/travis-ci/install.sh script: - ./tools/travis-ci/run.sh + - ./tools/travis-ci/abi-check.sh diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 00000000..255f4b83 --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,26 @@ +version: 2.1.1.{build} +branches: + except: + - coverity_scan +skip_tags: true +clone_depth: 50 +environment: + OPJ_NONCOMMERCIAL: 1 + OPJ_CI_SKIP_TESTS: 0 + OPJ_DO_SUBMIT: 1 + matrix: + - OPJ_CI_ARCH: x86 + OPJ_CI_VSCOMNTOOLS: $(VS140COMNTOOLS) + - OPJ_CI_ARCH: x64 + OPJ_CI_VSCOMNTOOLS: $(VS140COMNTOOLS) + - OPJ_CI_ARCH: x86 + OPJ_CI_VSCOMNTOOLS: $(VS100COMNTOOLS) +install: +- cmd: c:\cygwin\bin\bash ./tools/travis-ci/install.sh +build_script: +- cmd: >- + "%OPJ_CI_VSCOMNTOOLS%..\..\VC\vcvarsall.bat" %OPJ_CI_ARCH% + + bash ./tools/travis-ci/run.sh +test: off +deploy: off diff --git a/src/bin/common/color.c b/src/bin/common/color.c index 3b0eb97b..0f2b8dac 100644 --- a/src/bin/common/color.c +++ b/src/bin/common/color.c @@ -617,7 +617,7 @@ void color_cielab_to_rgb(opj_image_t *image) default_type = (unsigned int)row[1]; - if(default_type == 0x44454600)// DEF : default + if(default_type == 0x44454600)/* DEF : default */ { rl = 100; ra = 170; rb = 200; ol = 0; @@ -679,9 +679,9 @@ void color_cielab_to_rgb(opj_image_t *image) } fprintf(stderr,"%s:%d:\n\tenumCS %d not handled. Ignoring.\n", __FILE__,__LINE__, enumcs); -}// color_apply_conversion() +}/* color_apply_conversion() */ -#endif // OPJ_HAVE_LIBLCMS2 || OPJ_HAVE_LIBLCMS1 +#endif /* OPJ_HAVE_LIBLCMS2 || OPJ_HAVE_LIBLCMS1 */ void color_cmyk_to_rgb(opj_image_t *image) { @@ -732,11 +732,11 @@ void color_cmyk_to_rgb(opj_image_t *image) memcpy(&(image->comps[i]), &(image->comps[i+1]), sizeof(image->comps[i])); } -}// color_cmyk_to_rgb() +}/* color_cmyk_to_rgb() */ -// -// This code has been adopted from sjpx_openjpeg.c of ghostscript -// +/* + * This code has been adopted from sjpx_openjpeg.c of ghostscript + */ void color_esycc_to_rgb(opj_image_t *image) { int y, cb, cr, sign1, sign2, val; @@ -785,4 +785,4 @@ void color_esycc_to_rgb(opj_image_t *image) } image->color_space = OPJ_CLRSPC_SRGB; -}// color_esycc_to_rgb() +}/* color_esycc_to_rgb() */ diff --git a/src/lib/openjp2/dwt.c b/src/lib/openjp2/dwt.c index 4ad99ed9..eead5865 100644 --- a/src/lib/openjp2/dwt.c +++ b/src/lib/openjp2/dwt.c @@ -741,8 +741,8 @@ static void opj_v4dwt_decode_step1(opj_v4_t* w, OPJ_INT32 count, const OPJ_FLOAT static void opj_v4dwt_decode_step2(opj_v4_t* l, opj_v4_t* w, OPJ_INT32 k, OPJ_INT32 m, OPJ_FLOAT32 c) { - OPJ_FLOAT32* restrict fl = (OPJ_FLOAT32*) l; - OPJ_FLOAT32* restrict fw = (OPJ_FLOAT32*) w; + OPJ_FLOAT32* fl = (OPJ_FLOAT32*) l; + OPJ_FLOAT32* fw = (OPJ_FLOAT32*) w; OPJ_INT32 i; for(i = 0; i < m; ++i){ OPJ_FLOAT32 tmp1_1 = fl[0]; diff --git a/src/lib/openjp3d/jp3d.c b/src/lib/openjp3d/jp3d.c index f445fb36..9e060df7 100644 --- a/src/lib/openjp3d/jp3d.c +++ b/src/lib/openjp3d/jp3d.c @@ -1008,6 +1008,7 @@ static void j3d_write_qcx(opj_j3d_t *j3d, int compno) { cio_write(cio, tccp->qntsty + (tccp->numgbits << 5), 1); /* Sqcx : Table A28 de 15444-1*/ + numbands = 0; // compiler warning if (j3d->cinfo->codec_format == CODEC_J2K) numbands = tccp->qntsty == J3D_CCP_QNTSTY_SIQNT ? 1 : tccp->numresolution[0] * 3 - 2; else if (j3d->cinfo->codec_format == CODEC_J3D) { diff --git a/src/lib/openjpwl/jpwl.c b/src/lib/openjpwl/jpwl.c index 79d0e04c..99a34990 100644 --- a/src/lib/openjpwl/jpwl.c +++ b/src/lib/openjpwl/jpwl.c @@ -1296,7 +1296,7 @@ opj_bool jpwl_check_tile(opj_j2k_t *j2k, opj_tcd_t *tcd, int tileno) { opj_event_msg(j2k->cinfo, JPWL_ASSUME ? EVT_WARNING : EVT_ERROR, "JPWL: wrong x-cord of block origin %d => x-prec is (%d, %d)\n", block->x0, prec->x0, prec->x1); - if (!JPWL_ASSUME || JPWL_ASSUME) + if (!JPWL_ASSUME) return OPJ_FALSE; }; } diff --git a/tools/abi-tracker/openjpeg.json b/tools/abi-tracker/openjpeg.json new file mode 100644 index 00000000..14653472 --- /dev/null +++ b/tools/abi-tracker/openjpeg.json @@ -0,0 +1,131 @@ +{ + "Name": "openjpeg", + "Title": "OpenJPEG", + "SourceUrl": "https://github.com/uclouvain/openjpeg/tags", + "Git": "https://github.com/uclouvain/openjpeg.git", + "Maintainer": "Antonin D.", + "MaintainerUrl": "http://www.openjpeg.org/", + "Package": "version.", + + "Versions": [ + { + "Number": "current", + "Installed": "installed/openjpeg/current", + "Source": "src/openjpeg/current", + "Changelog": "On", + "HeadersDiff": "On", + "PkgDiff": "Off", + "ABIView": "Off", + "ABIDiff": "Off", + "PublicSymbols": "public_symbols/openjpeg/current/list", + "PublicTypes": "public_types/openjpeg/current/list" + }, + { + "Number": "2.1", + "Installed": "installed/openjpeg/2.1", + "Source": "src/openjpeg/2.1/version.2.1.tar.gz", + "Changelog": "NEWS", + "HeadersDiff": "On", + "PkgDiff": "Off", + "ABIView": "Off", + "ABIDiff": "Off", + "PublicSymbols": "public_symbols/openjpeg/2.1/list", + "PublicTypes": "public_types/openjpeg/2.1/list" + }, + { + "Number": "2.0.1", + "Installed": "installed/openjpeg/2.0.1", + "Source": "src/openjpeg/2.0.1/version.2.0.1.tar.gz", + "Changelog": "NEWS", + "HeadersDiff": "On", + "PkgDiff": "Off", + "ABIView": "Off", + "ABIDiff": "Off", + "PublicSymbols": "public_symbols/openjpeg/2.0.1/list", + "PublicTypes": "public_types/openjpeg/2.0.1/list" + }, + { + "Number": "2.0", + "Installed": "installed/openjpeg/2.0", + "Source": "src/openjpeg/2.0/version.2.0.tar.gz", + "Changelog": "NEWS", + "HeadersDiff": "On", + "PkgDiff": "On", + "ABIView": "Off", + "ABIDiff": "Off", + "PublicSymbols": "public_symbols/openjpeg/2.0/list", + "PublicTypes": "public_types/openjpeg/2.0/list" + }, + { + "Number": "1.5.2", + "Installed": "installed/openjpeg/1.5.2", + "Source": "src/openjpeg/1.5.2/version.1.5.2.tar.gz", + "Changelog": "NEWS", + "HeadersDiff": "On", + "PkgDiff": "Off", + "ABIView": "Off", + "ABIDiff": "Off", + "PublicSymbols": "public_symbols/openjpeg/1.5.2/list", + "PublicTypes": "public_types/openjpeg/1.5.2/list" + }, + { + "Number": "1.5.1", + "Installed": "installed/openjpeg/1.5.1", + "Source": "src/openjpeg/1.5.1/version.1.5.1.tar.gz", + "Changelog": "NEWS", + "HeadersDiff": "On", + "PkgDiff": "Off", + "ABIView": "Off", + "ABIDiff": "Off", + "PublicSymbols": "public_symbols/openjpeg/1.5.1/list", + "PublicTypes": "public_types/openjpeg/1.5.1/list" + }, + { + "Number": "1.5", + "Installed": "installed/openjpeg/1.5", + "Source": "src/openjpeg/1.5/version.1.5.tar.gz", + "Changelog": "NEWS", + "HeadersDiff": "On", + "PkgDiff": "Off", + "ABIView": "Off", + "ABIDiff": "Off", + "PublicSymbols": "public_symbols/openjpeg/1.5/list", + "PublicTypes": "public_types/openjpeg/1.5/list" + }, + { + "Number": "1.4", + "Installed": "installed/openjpeg/1.4", + "Source": "src/openjpeg/1.4/version.1.4.tar.gz", + "Changelog": "CHANGES", + "HeadersDiff": "On", + "PkgDiff": "Off", + "ABIView": "Off", + "ABIDiff": "Off", + "PublicSymbols": "public_symbols/openjpeg/1.4/list", + "PublicTypes": "public_types/openjpeg/1.4/list" + }, + { + "Number": "1.3", + "Installed": "installed/openjpeg/1.3", + "Source": "src/openjpeg/1.3/version.1.3.tar.gz", + "Changelog": "ChangeLog", + "HeadersDiff": "On", + "PkgDiff": "Off", + "ABIView": "Off", + "ABIDiff": "Off", + "PublicSymbols": "public_symbols/openjpeg/1.3/list", + "PublicTypes": "public_types/openjpeg/1.3/list" + }, + { + "Number": "1.2", + "Installed": "installed/openjpeg/1.2", + "Source": "src/openjpeg/1.2/version.1.2.tar.gz", + "Changelog": "ChangeLog", + "HeadersDiff": "On", + "PkgDiff": "Off", + "ABIView": "Off", + "ABIDiff": "Off", + "PublicSymbols": "public_symbols/openjpeg/1.2/list", + "PublicTypes": "public_types/openjpeg/1.2/list" + }] +} diff --git a/tools/ctest_scripts/travis-ci.cmake b/tools/ctest_scripts/travis-ci.cmake index 6d50b3f5..f8b23ada 100644 --- a/tools/ctest_scripts/travis-ci.cmake +++ b/tools/ctest_scripts/travis-ci.cmake @@ -7,8 +7,21 @@ 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_BINARY_DIR}) + set( CTEST_DASHBOARD_ROOT "$ENV{OPJ_BINARY_DIR}" ) +else() + set( CTEST_DASHBOARD_ROOT "$ENV{PWD}/build" ) +endif() + +if("$ENV{TRAVIS_OS_NAME}" STREQUAL "windows") + set( CTEST_CMAKE_GENERATOR "NMake Makefiles") + set( CTEST_BUILD_COMMAND "nmake" ) + set( JPYLYZER_EXT "exe" ) +else() + set( CTEST_CMAKE_GENERATOR "Unix Makefiles") # Always makefile in travis-ci environment + set( CCFLAGS_WARNING "-Wall -Wextra -Wconversion -Wno-unused-parameter -Wdeclaration-after-statement") + set( JPYLYZER_EXT "py" ) +endif() if ("$ENV{OPJ_BUILD_CONFIGURATION}" STREQUAL "") set( CTEST_BUILD_CONFIGURATION "Release") @@ -66,8 +79,12 @@ if(NOT "$ENV{OPJ_CI_SKIP_TESTS}" STREQUAL "1") # 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}) + if("$ENV{TRAVIS_OS_NAME}" STREQUAL "windows") + set(ENV{PATH} "$ENV{PATH};${KDUPATH}") + else() + set(ENV{LD_LIBRARY_PATH} ${KDUPATH}) + set(ENV{PATH} $ENV{PATH}:${KDUPATH}) + endif() endif() set(BUILD_TESTING "TRUE") else() @@ -81,7 +98,7 @@ set( CACHE_CONTENTS " CMAKE_BUILD_TYPE:STRING=${CTEST_BUILD_CONFIGURATION} # Warning level -CMAKE_C_FLAGS:STRING= ${CCFLAGS_ARCH} -Wall -Wextra -Wconversion -Wno-unused-parameter -Wdeclaration-after-statement +CMAKE_C_FLAGS:STRING= ${CCFLAGS_ARCH} ${CCFLAGS_WARNING} # Use to activate the test suite BUILD_TESTING:BOOL=${BUILD_TESTING} @@ -93,7 +110,7 @@ BUILD_THIRDPARTY:BOOL=TRUE 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 +JPYLYZER_EXECUTABLE=$ENV{PWD}/jpylyzer/jpylyzer.${JPYLYZER_EXT} " ) diff --git a/tools/travis-ci/abi-check.sh b/tools/travis-ci/abi-check.sh new file mode 100755 index 00000000..1a904d27 --- /dev/null +++ b/tools/travis-ci/abi-check.sh @@ -0,0 +1,77 @@ +#!/bin/bash + +# This script executes the abi-check step when running under travis-ci (in run step) + +# 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 -o xtrace ## set -x : Print a trace of simple commands and their arguments after they are expanded and before they are executed. + +# Exit if not ABI check +if [ "${OPJ_CI_ABI_CHECK:-}" != "1" ]; then + exit 0 +fi + +OPJ_UPLOAD_ABI_REPORT=0 +OPJ_LIMIT_ABI_BUILDS="-limit 2" +if [ "${TRAVIS_REPO_SLUG:-}" != "" ]; then + if [ "$(echo "${TRAVIS_REPO_SLUG}" | sed 's/\(^.*\)\/.*/\1/')" == "uclouvain" ] && [ "${TRAVIS_PULL_REQUEST:-}" == "false" ]; then + # Upload report + OPJ_UPLOAD_ABI_REPORT=1 + # Build full report + OPJ_LIMIT_ABI_BUILDS= + fi +fi + +OPJ_SOURCE_DIR=$(cd $(dirname $0)/../.. && pwd) + + +mkdir ${HOME}/abi-check +cd ${HOME}/abi-check +# Let's get tools not available with apt +mkdir tools +# Travis doesn't allow package wdiff... +wget -qO - http://mirrors.kernel.org/gnu/wdiff/wdiff-latest.tar.gz | tar -xz +cd wdiff-* +./configure --prefix=${HOME}/abi-check/tools/wdiff &> /dev/null +make &> /dev/null +make check &> /dev/null +make install &> /dev/null +cd .. +export PATH=${PWD}/tools/wdiff/bin:$PATH + +wget -qO - https://tools.ietf.org/tools/rfcdiff/rfcdiff-1.42.tgz | tar -xz +mv rfcdiff-1.42 ${PWD}/tools/rfcdiff +export PATH=${PWD}/tools/rfcdiff:$PATH +wget -qO - https://github.com/lvc/installer/archive/0.4.tar.gz | tar -xz +mkdir ${PWD}/tools/abi-tracker +make -C installer-0.4 install prefix=${PWD}/tools/abi-tracker target=abi-tracker +export PATH=${PWD}/tools/abi-tracker/bin:$PATH + +mkdir tracker +cd tracker + +# Let's create all we need +grep -v Git ${OPJ_SOURCE_DIR}/tools/abi-tracker/openjpeg.json > ./openjpeg.json +abi-monitor ${OPJ_LIMIT_ABI_BUILDS} -get openjpeg.json +cp -f ${OPJ_SOURCE_DIR}/tools/abi-tracker/openjpeg.json ./openjpeg.json +cp -rf ${OPJ_SOURCE_DIR} src/openjpeg/current +abi-monitor ${OPJ_LIMIT_ABI_BUILDS} -build openjpeg.json +abi-tracker -build openjpeg.json + +EXIT_CODE=0 + +# Check API +abi-compliance-checker -l openjpeg -old $(find ./abi_dump/openjpeg/2.1 -name '*.dump') -new $(find ./abi_dump/openjpeg/current -name '*.dump') -header openjpeg.h -api -s || EXIT_CODE=1 + +# Check ABI +# Disabled for now, problems with symbol visibility... +# abi-compliance-checker -l openjpeg -old $(find ./abi_dump/openjpeg/2.1 -name '*.dump') -new $(find ./abi_dump/openjpeg/current -name '*.dump') -header openjpeg.h -abi -s || EXIT_CODE=1 + +rm -rf src installed + +if [ ${OPJ_UPLOAD_ABI_REPORT} -eq 1 ]; then + echo "TODO: Where to upload the report" +fi +exit $EXIT_CODE diff --git a/tools/travis-ci/install.sh b/tools/travis-ci/install.sh index 11dcf26c..61debd95 100755 --- a/tools/travis-ci/install.sh +++ b/tools/travis-ci/install.sh @@ -2,6 +2,17 @@ # This script executes the install step when running under travis-ci +#if cygwin, check path +case ${MACHTYPE} in + *cygwin*) OPJ_CI_IS_CYGWIN=1;; + *) ;; +esac + +if [ "${OPJ_CI_IS_CYGWIN:-}" == "1" ]; then + # PATH is not yet set up + export PATH=$PATH:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin +fi + # 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 @@ -19,66 +30,86 @@ function exit_handler () trap exit_handler EXIT trap exit ERR -# We don't need anything for coverity scan builds +# We don't need anything for coverity scan builds. ABI check is managed in abi-check.sh +if [ "${COVERITY_SCAN_BRANCH:-}" == "1" ] || [ "${OPJ_CI_ABI_CHECK:-}" == "1" ]; then + exit 0 +fi -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_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 +if [ "${OPJ_CI_SKIP_TESTS:-}" != "1" ]; then + + OPJ_SOURCE_DIR=$(cd $(dirname $0)/../.. && pwd) + + # We need test data + if [ "${TRAVIS_BRANCH:-}" != "" ]; then + OPJ_DATA_BRANCH=${TRAVIS_BRANCH} + elif [ "${APPVEYOR_REPO_BRANCH:-}" != "" ]; then + OPJ_DATA_BRANCH=${APPVEYOR_REPO_BRANCH} + else + OPJ_DATA_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 ${OPJ_DATA_BRANCH} | wc -l) + if [ ${OPJ_DATA_HAS_BRANCH} -eq 0 ]; then + 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" + if [ "${APPVEYOR:-}" == "True" ]; then + wget --local-encoding=UTF-8 -q http://dl.bintray.com/openplanets/opf-windows/jpylyzer_1.14.2_win32.zip + mkdir jpylyzer + cd jpylyzer + cmake -E tar -xf ../jpylyzer_1.14.2_win32.zip + cd .. + else + 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.py 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 + # 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 + elif [ "${APPVEYOR:-}" == "True" ] || uname -s | grep -i MINGW &> /dev/null || uname -s | grep -i CYGWIN &> /dev/null; then + echo "Retrieving Kakadu" + wget -q http://kakadusoftware.com/wp-content/uploads/2014/06/KDU77_Demo_Apps_for_Win32_150710.msi_.zip + cmake -E tar -xf KDU77_Demo_Apps_for_Win32_150710.msi_.zip + msiexec /i KDU77_Demo_Apps_for_Win32_150710.msi /quiet /qn /norestart + if [ -d "C:/Program Files/Kakadu" ]; then + cp -r "C:/Program Files/Kakadu" ./kdu + else + cp -r "C:/Program Files (x86)/Kakadu" ./kdu fi fi fi diff --git a/tools/travis-ci/knownfailures-Ubuntu12.04-gcc4.6.4-i386-Release-3rdP.txt b/tools/travis-ci/knownfailures-Ubuntu12.04-gcc4.6.4-i386-Release-3rdP.txt new file mode 100644 index 00000000..bad45972 --- /dev/null +++ b/tools/travis-ci/knownfailures-Ubuntu12.04-gcc4.6.4-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-windows-vs2010-x86-Release-3rdP.txt b/tools/travis-ci/knownfailures-windows-vs2010-x86-Release-3rdP.txt new file mode 100644 index 00000000..70b6d98a --- /dev/null +++ b/tools/travis-ci/knownfailures-windows-vs2010-x86-Release-3rdP.txt @@ -0,0 +1,44 @@ +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-RIC-subsampling_1.jp2-compare2base +NR-RIC-subsampling_2.jp2-compare2base +NR-RIC-zoo1.jp2-compare2base +NR-RIC-zoo2.jp2-compare2base +NR-ENC-Bretagne2.ppm-7-compare_dec-ref-out2base +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-windows-vs2015-x64-Release-3rdP.txt b/tools/travis-ci/knownfailures-windows-vs2015-x64-Release-3rdP.txt new file mode 100644 index 00000000..c0f64cc0 --- /dev/null +++ b/tools/travis-ci/knownfailures-windows-vs2015-x64-Release-3rdP.txt @@ -0,0 +1,3 @@ +NR-ENC-Bretagne2.ppm-7-compare_dec-ref-out2base +NR-DEC-kodak_2layers_lrcp.j2c-31-decode-md5 +NR-DEC-kodak_2layers_lrcp.j2c-32-decode-md5 diff --git a/tools/travis-ci/knownfailures-windows-vs2015-x86-Release-3rdP.txt b/tools/travis-ci/knownfailures-windows-vs2015-x86-Release-3rdP.txt new file mode 100644 index 00000000..c0f64cc0 --- /dev/null +++ b/tools/travis-ci/knownfailures-windows-vs2015-x86-Release-3rdP.txt @@ -0,0 +1,3 @@ +NR-ENC-Bretagne2.ppm-7-compare_dec-ref-out2base +NR-DEC-kodak_2layers_lrcp.j2c-31-decode-md5 +NR-DEC-kodak_2layers_lrcp.j2c-32-decode-md5 diff --git a/tools/travis-ci/run.sh b/tools/travis-ci/run.sh index bec41d6d..7d6bd141 100755 --- a/tools/travis-ci/run.sh +++ b/tools/travis-ci/run.sh @@ -2,11 +2,34 @@ # This script executes the script step when running under travis-ci +#if cygwin, check path +case ${MACHTYPE} in + *cygwin*) OPJ_CI_IS_CYGWIN=1;; + *) ;; +esac + +# Hack for appveyor to get GNU find in path before windows one. +export PATH=$(dirname ${BASH}):$PATH + # 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 +function opjpath () +{ + if [ "${OPJ_CI_IS_CYGWIN:-}" == "1" ]; then + cygpath $1 "$2" + else + echo "$2" + fi +} + +# ABI check is done by abi-check.sh +if [ "${OPJ_CI_ABI_CHECK:-}" == "1" ]; then + exit 0 +fi + # Set-up some variables if [ "${OPJ_CI_BUILD_CONFIGURATION:-}" == "" ]; then export OPJ_CI_BUILD_CONFIGURATION=Release #default @@ -22,6 +45,12 @@ if [ "${TRAVIS_REPO_SLUG:-}" != "" ]; then if [ "${OPJ_OWNER}" == "uclouvain" ]; then OPJ_DO_SUBMIT=1 fi +elif [ "${APPVEYOR_REPO_NAME:-}" != "" ]; then + OPJ_OWNER=$(echo "${APPVEYOR_REPO_NAME}" | sed 's/\(^.*\)\/.*/\1/') + OPJ_SITE="${OPJ_OWNER}.appveyor.com" + if [ "${OPJ_OWNER}" == "uclouvain" ]; then + OPJ_DO_SUBMIT=1 + fi else OPJ_SITE="$(hostname)" fi @@ -37,6 +66,10 @@ if [ "${TRAVIS_OS_NAME:-}" == "" ]; then # default to gcc export CC=gcc fi + elif uname -s | grep -i CYGWIN &> /dev/null; then + TRAVIS_OS_NAME=windows + elif uname -s | grep -i MINGW &> /dev/null; then + TRAVIS_OS_NAME=windows else echo "Failed to guess OS"; exit 1 fi @@ -66,6 +99,26 @@ elif [ "${TRAVIS_OS_NAME}" == "linux" ]; then else echo "Compiler not supported: ${CC}"; exit 1 fi +elif [ "${TRAVIS_OS_NAME}" == "windows" ]; then + OPJ_OS_NAME=windows + if which cl > /dev/null; then + OPJ_CL_VERSION=$(cl 2>&1 | grep Version | sed 's/.*Version \([0-9]*\).*/\1/') + if [ ${OPJ_CL_VERSION} -eq 19 ]; then + OPJ_CC_VERSION=vs2015 + elif [ ${OPJ_CL_VERSION} -eq 18 ]; then + OPJ_CC_VERSION=vs2013 + elif [ ${OPJ_CL_VERSION} -eq 17 ]; then + OPJ_CC_VERSION=vs2012 + elif [ ${OPJ_CL_VERSION} -eq 16 ]; then + OPJ_CC_VERSION=vs2010 + elif [ ${OPJ_CL_VERSION} -eq 15 ]; then + OPJ_CC_VERSION=vs2008 + elif [ ${OPJ_CL_VERSION} -eq 14 ]; then + OPJ_CC_VERSION=vs2005 + else + OPJ_CC_VERSION=vs???? + fi + fi else echo "OS not supported: ${TRAVIS_OS_NAME}"; exit 1 fi @@ -80,14 +133,20 @@ if [ "${OPJ_CI_ARCH:-}" == "" ]; then fi if [ "${TRAVIS_BRANCH:-}" == "" ]; then - echo "Guessing branch" - TRAVIS_BRANCH=$(git -C ${OPJ_SOURCE_DIR} branch | grep '*' | tr -d '*[[:blank:]]') #default to master + if [ "${APPVEYOR_REPO_BRANCH:-}" != "" ]; then + TRAVIS_BRANCH=${APPVEYOR_REPO_BRANCH} + else + echo "Guessing branch" + TRAVIS_BRANCH=$(git -C ${OPJ_SOURCE_DIR} branch | grep '*' | tr -d '*[[:blank:]]') + fi 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} +elif [ "${APPVEYOR_PULL_REQUEST_NUMBER:-}" != "" ]; then + OPJ_BUILDNAME=${OPJ_BUILDNAME}-pr${APPVEYOR_PULL_REQUEST_NUMBER} fi OPJ_BUILDNAME=${OPJ_BUILDNAME}-${OPJ_CI_BUILD_CONFIGURATION}-3rdP OPJ_BUILDNAME_TEST=${OPJ_BUILDNAME_TEST}-${OPJ_CI_BUILD_CONFIGURATION}-3rdP @@ -115,9 +174,11 @@ set -x # travis-ci doesn't dump cmake version in system info, let's print it cmake --version +export TRAVIS_OS_NAME=${TRAVIS_OS_NAME} export OPJ_SITE=${OPJ_SITE} export OPJ_BUILDNAME=${OPJ_BUILDNAME} -export OPJ_SOURCE_DIR=${OPJ_SOURCE_DIR} +export OPJ_SOURCE_DIR=$(opjpath -m ${OPJ_SOURCE_DIR}) +export OPJ_BINARY_DIR=$(opjpath -m ${PWD}/build) export OPJ_BUILD_CONFIGURATION=${OPJ_CI_BUILD_CONFIGURATION} export OPJ_DO_SUBMIT=${OPJ_DO_SUBMIT} @@ -176,11 +237,11 @@ if [ "${OPJ_CI_SKIP_TESTS:-}" != "1" ]; 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 + if grep -x "${FAILEDTEST}" $(opjpath -u ${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 + if [ -f $(opjpath -u ${OPJ_SOURCE_DIR})/tools/travis-ci/knownfailures-${OPJ_BUILDNAME_TEST}.txt ]; then + if grep -x "${FAILEDTEST}" $(opjpath -u ${OPJ_SOURCE_DIR})/tools/travis-ci/knownfailures-${OPJ_BUILDNAME_TEST}.txt > /dev/null; then continue fi fi @@ -207,8 +268,6 @@ New/unknown test failure found!!! OPJ_CI_RESULT=1 fi fi - - fi exit ${OPJ_CI_RESULT}