Merge branch 'master' into coc-qcc

This commit is contained in:
mayeut 2015-10-08 19:11:52 +02:00
commit 3259fe2ff8
17 changed files with 688 additions and 61 deletions

View File

@ -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

View File

@ -66,7 +66,7 @@ void opj_reset_options_reading(void) {
int opj_getopt(int nargc, char *const *nargv, const char *ostr) {
# define __progname nargv[0]
static char *place = EMSG; /* option letter processing */
char *oli = NULL; /* option letter list index */
const char *oli = NULL; /* option letter list index */
if (opj_optreset || !*place) { /* update scanning pointer */
opj_optreset = 0;
@ -125,7 +125,7 @@ int opj_getopt(int nargc, char *const *nargv, const char *ostr) {
int opj_getopt_long(int argc, char * const argv[], const char *optstring,
const opj_option_t *longopts, int totlen) {
static int lastidx,lastofs;
char *tmp;
const char *tmp;
int i,len;
char param = 1;

View File

@ -211,7 +211,7 @@ opj_image_t *pngtoimage(const char *read_idf, opj_cparameters_t * params)
image->x1 = (OPJ_UINT32)(image->x0 + (width - 1) * (OPJ_UINT32)params->subsampling_dx + 1 + image->x0);
image->y1 = (OPJ_UINT32)(image->y0 + (height - 1) * (OPJ_UINT32)params->subsampling_dy + 1 + image->y0);
row32s = malloc((size_t)width * nr_comp * sizeof(OPJ_INT32));
row32s = (OPJ_INT32 *)malloc((size_t)width * nr_comp * sizeof(OPJ_INT32));
if(row32s == NULL) goto fin;
/* Set alpha channel */

View File

@ -290,7 +290,7 @@ int imagetotif(opj_image_t * image, const char *outfile)
TIFFClose(tif);
return 1;
}
buffer32s = malloc((OPJ_SIZE_T)width * numcomps * sizeof(OPJ_INT32));
buffer32s = (OPJ_INT32 *)malloc((OPJ_SIZE_T)width * numcomps * sizeof(OPJ_INT32));
if (buffer32s == NULL) {
_TIFFfree(buf);
TIFFClose(tif);
@ -299,7 +299,7 @@ int imagetotif(opj_image_t * image, const char *outfile)
for (i = 0; i < image->comps[0].h; ++i) {
cvtPxToCx(planes, buffer32s, (OPJ_SIZE_T)width, adjust);
cvt32sToTif(buffer32s, buf, (OPJ_SIZE_T)width * numcomps);
cvt32sToTif(buffer32s, (OPJ_BYTE *)buf, (OPJ_SIZE_T)width * numcomps);
(void)TIFFWriteEncodedStrip(tif, i, (void*)buf, strip_size);
planes[0] += width;
planes[1] += width;
@ -590,7 +590,7 @@ opj_image_t* tiftoimage(const char *filename, opj_cparameters_t *parameters)
return NULL;
}
rowStride = ((OPJ_SIZE_T)w * tiSpp * tiBps + 7U) / 8U;
buffer32s = malloc((OPJ_SIZE_T)w * tiSpp * sizeof(OPJ_INT32));
buffer32s = (OPJ_INT32 *)malloc((OPJ_SIZE_T)w * tiSpp * sizeof(OPJ_INT32));
if (buffer32s == NULL) {
_TIFFfree(buf);
TIFFClose(tif);

View File

@ -291,7 +291,7 @@ static OPJ_BOOL parse_precision(const char* option, opj_decompress_parameters* p
if (parameters->precision == NULL) {
/* first one */
parameters->precision = malloc(sizeof(opj_precision));
parameters->precision = (opj_precision *)malloc(sizeof(opj_precision));
if (parameters->precision == NULL) {
fprintf(stderr,"Could not allocate memory for precision option\n");
l_result = OPJ_FALSE;
@ -307,7 +307,7 @@ static OPJ_BOOL parse_precision(const char* option, opj_decompress_parameters* p
break;
}
l_new = realloc(parameters->precision, l_new_size * sizeof(opj_precision));
l_new = (opj_precision *)realloc(parameters->precision, l_new_size * sizeof(opj_precision));
if (l_new == NULL) {
fprintf(stderr,"Could not allocate memory for precision option\n");
l_result = OPJ_FALSE;
@ -400,7 +400,7 @@ int get_file_format(const char *filename) {
unsigned int i;
static const char *extension[] = {"pgx", "pnm", "pgm", "ppm", "bmp","tif", "raw", "rawl", "tga", "png", "j2k", "jp2", "jpt", "j2c", "jpc" };
static const int format[] = { PGX_DFMT, PXM_DFMT, PXM_DFMT, PXM_DFMT, BMP_DFMT, TIF_DFMT, RAW_DFMT, RAWL_DFMT, TGA_DFMT, PNG_DFMT, J2K_CFMT, JP2_CFMT, JPT_CFMT, J2K_CFMT, J2K_CFMT };
char * ext = strrchr(filename, '.');
const char * ext = strrchr(filename, '.');
if (ext == NULL)
return -1;
ext++;

View File

@ -171,7 +171,7 @@ static int get_file_format(const char *filename) {
unsigned int i;
static const char *extension[] = {"pgx", "pnm", "pgm", "ppm", "bmp","tif", "raw", "tga", "png", "j2k", "jp2", "jpt", "j2c", "jpc" };
static const int format[] = { PGX_DFMT, PXM_DFMT, PXM_DFMT, PXM_DFMT, BMP_DFMT, TIF_DFMT, RAW_DFMT, TGA_DFMT, PNG_DFMT, J2K_CFMT, JP2_CFMT, JPT_CFMT, J2K_CFMT, J2K_CFMT };
char * ext = strrchr(filename, '.');
const char *ext = strrchr(filename, '.');
if (ext == NULL)
return -1;
ext++;

View File

@ -166,12 +166,12 @@ opj_stream_t* OPJ_CALLCONV opj_stream_create(OPJ_SIZE_T p_buffer_size,OPJ_BOOL l
l_stream->m_current_data = l_stream->m_stored_data;
if (l_is_input) {
l_stream->m_status |= opj_stream_e_input;
l_stream->m_status |= OPJ_STREAM_STATUS_INPUT;
l_stream->m_opj_skip = opj_stream_read_skip;
l_stream->m_opj_seek = opj_stream_read_seek;
}
else {
l_stream->m_status |= opj_stream_e_output;
l_stream->m_status |= OPJ_STREAM_STATUS_OUTPUT;
l_stream->m_opj_skip = opj_stream_write_skip;
l_stream->m_opj_seek = opj_stream_write_seek;
}
@ -207,7 +207,7 @@ void OPJ_CALLCONV opj_stream_set_read_function(opj_stream_t* p_stream, opj_strea
{
opj_stream_private_t* l_stream = (opj_stream_private_t*) p_stream;
if ((!l_stream) || (! (l_stream->m_status & opj_stream_e_input))) {
if ((!l_stream) || (! (l_stream->m_status & OPJ_STREAM_STATUS_INPUT))) {
return;
}
@ -228,7 +228,7 @@ void OPJ_CALLCONV opj_stream_set_write_function(opj_stream_t* p_stream, opj_stre
{
opj_stream_private_t* l_stream = (opj_stream_private_t*) p_stream;
if ((!l_stream )|| (! (l_stream->m_status & opj_stream_e_output))) {
if ((!l_stream )|| (! (l_stream->m_status & OPJ_STREAM_STATUS_OUTPUT))) {
return;
}
@ -276,7 +276,7 @@ OPJ_SIZE_T opj_stream_read_data (opj_stream_private_t * p_stream,OPJ_BYTE * p_bu
}
/* we are now in the case when the remaining data if not sufficient */
if (p_stream->m_status & opj_stream_e_end) {
if (p_stream->m_status & OPJ_STREAM_STATUS_END) {
l_read_nb_bytes += p_stream->m_bytes_in_buffer;
memcpy(p_buffer,p_stream->m_current_data,p_stream->m_bytes_in_buffer);
p_stream->m_current_data += p_stream->m_bytes_in_buffer;
@ -313,7 +313,7 @@ OPJ_SIZE_T opj_stream_read_data (opj_stream_private_t * p_stream,OPJ_BYTE * p_bu
opj_event_msg(p_event_mgr, EVT_INFO, "Stream reached its end !\n");
p_stream->m_bytes_in_buffer = 0;
p_stream->m_status |= opj_stream_e_end;
p_stream->m_status |= OPJ_STREAM_STATUS_END;
/* end of stream */
return l_read_nb_bytes ? l_read_nb_bytes : (OPJ_SIZE_T)-1;
}
@ -345,7 +345,7 @@ OPJ_SIZE_T opj_stream_read_data (opj_stream_private_t * p_stream,OPJ_BYTE * p_bu
opj_event_msg(p_event_mgr, EVT_INFO, "Stream reached its end !\n");
p_stream->m_bytes_in_buffer = 0;
p_stream->m_status |= opj_stream_e_end;
p_stream->m_status |= OPJ_STREAM_STATUS_END;
/* end of stream */
return l_read_nb_bytes ? l_read_nb_bytes : (OPJ_SIZE_T)-1;
}
@ -378,7 +378,7 @@ OPJ_SIZE_T opj_stream_write_data (opj_stream_private_t * p_stream,
OPJ_SIZE_T l_remaining_bytes = 0;
OPJ_SIZE_T l_write_nb_bytes = 0;
if (p_stream->m_status & opj_stream_e_error) {
if (p_stream->m_status & OPJ_STREAM_STATUS_ERROR) {
return (OPJ_SIZE_T)-1;
}
@ -432,7 +432,7 @@ OPJ_BOOL opj_stream_flush (opj_stream_private_t * p_stream, opj_event_mgr_t * p_
p_stream->m_user_data);
if (l_current_write_nb_bytes == (OPJ_SIZE_T)-1) {
p_stream->m_status |= opj_stream_e_error;
p_stream->m_status |= OPJ_STREAM_STATUS_ERROR;
opj_event_msg(p_event_mgr, EVT_INFO, "Error on writing stream!\n");
return OPJ_FALSE;
@ -465,7 +465,7 @@ OPJ_OFF_T opj_stream_read_skip (opj_stream_private_t * p_stream, OPJ_OFF_T p_siz
}
/* we are now in the case when the remaining data if not sufficient */
if (p_stream->m_status & opj_stream_e_end) {
if (p_stream->m_status & OPJ_STREAM_STATUS_END) {
l_skip_nb_bytes += (OPJ_OFF_T)p_stream->m_bytes_in_buffer;
p_stream->m_current_data += p_stream->m_bytes_in_buffer;
p_stream->m_bytes_in_buffer = 0;
@ -487,7 +487,7 @@ OPJ_OFF_T opj_stream_read_skip (opj_stream_private_t * p_stream, OPJ_OFF_T p_siz
if (l_current_skip_nb_bytes == (OPJ_OFF_T) -1) {
opj_event_msg(p_event_mgr, EVT_INFO, "Stream reached its end !\n");
p_stream->m_status |= opj_stream_e_end;
p_stream->m_status |= OPJ_STREAM_STATUS_END;
p_stream->m_byte_offset += l_skip_nb_bytes;
/* end if stream */
return l_skip_nb_bytes ? l_skip_nb_bytes : (OPJ_OFF_T) -1;
@ -507,14 +507,14 @@ OPJ_OFF_T opj_stream_write_skip (opj_stream_private_t * p_stream, OPJ_OFF_T p_si
OPJ_OFF_T l_current_skip_nb_bytes = 0;
OPJ_OFF_T l_skip_nb_bytes = 0;
if (p_stream->m_status & opj_stream_e_error) {
if (p_stream->m_status & OPJ_STREAM_STATUS_ERROR) {
return (OPJ_OFF_T) -1;
}
/* we should flush data */
l_is_written = opj_stream_flush (p_stream, p_event_mgr);
if (! l_is_written) {
p_stream->m_status |= opj_stream_e_error;
p_stream->m_status |= OPJ_STREAM_STATUS_ERROR;
p_stream->m_bytes_in_buffer = 0;
return (OPJ_OFF_T) -1;
}
@ -527,7 +527,7 @@ OPJ_OFF_T opj_stream_write_skip (opj_stream_private_t * p_stream, OPJ_OFF_T p_si
if (l_current_skip_nb_bytes == (OPJ_OFF_T)-1) {
opj_event_msg(p_event_mgr, EVT_INFO, "Stream error!\n");
p_stream->m_status |= opj_stream_e_error;
p_stream->m_status |= OPJ_STREAM_STATUS_ERROR;
p_stream->m_byte_offset += l_skip_nb_bytes;
/* end if stream */
return l_skip_nb_bytes ? l_skip_nb_bytes : (OPJ_OFF_T)-1;
@ -568,12 +568,12 @@ OPJ_BOOL opj_stream_read_seek (opj_stream_private_t * p_stream, OPJ_OFF_T p_size
p_stream->m_bytes_in_buffer = 0;
if( !(p_stream->m_seek_fn(p_size,p_stream->m_user_data)) ) {
p_stream->m_status |= opj_stream_e_end;
p_stream->m_status |= OPJ_STREAM_STATUS_END;
return OPJ_FALSE;
}
else {
/* reset stream status */
p_stream->m_status &= (~opj_stream_e_end);
p_stream->m_status &= (~OPJ_STREAM_STATUS_END);
p_stream->m_byte_offset = p_size;
}
@ -584,7 +584,7 @@ OPJ_BOOL opj_stream_read_seek (opj_stream_private_t * p_stream, OPJ_OFF_T p_size
OPJ_BOOL opj_stream_write_seek (opj_stream_private_t * p_stream, OPJ_OFF_T p_size, opj_event_mgr_t * p_event_mgr)
{
if (! opj_stream_flush(p_stream,p_event_mgr)) {
p_stream->m_status |= opj_stream_e_error;
p_stream->m_status |= OPJ_STREAM_STATUS_ERROR;
return OPJ_FALSE;
}
@ -592,7 +592,7 @@ OPJ_BOOL opj_stream_write_seek (opj_stream_private_t * p_stream, OPJ_OFF_T p_siz
p_stream->m_bytes_in_buffer = 0;
if (! p_stream->m_seek_fn(p_size,p_stream->m_user_data)) {
p_stream->m_status |= opj_stream_e_error;
p_stream->m_status |= OPJ_STREAM_STATUS_ERROR;
return OPJ_FALSE;
}
else {

View File

@ -70,16 +70,10 @@ The functions in CIO.C have for goal to realize a byte input / output process.
#endif
typedef enum
{
opj_signed_sentinel = -1, /* do not use in code */
opj_stream_e_output = 0x1,
opj_stream_e_input = 0x2,
opj_stream_e_end = 0x4,
opj_stream_e_error = 0x8
}
opj_stream_flag ;
#define OPJ_STREAM_STATUS_OUTPUT 0x1U
#define OPJ_STREAM_STATUS_INPUT 0x2U
#define OPJ_STREAM_STATUS_END 0x4U
#define OPJ_STREAM_STATUS_ERROR 0x8U
/**
Byte input-output stream.
@ -162,8 +156,9 @@ typedef struct opj_stream_private
/**
* Flags to tell the status of the stream.
* Used with OPJ_STREAM_STATUS_* defines.
*/
opj_stream_flag m_status;
OPJ_UINT32 m_status;
}
opj_stream_private_t;

View File

@ -0,0 +1,26 @@
# http://www.cmake.org/Wiki/CmakeMingw
#
# Copyright (c) 2006-2014 Mathieu Malaterre <mathieu.malaterre@voxxl.com>
#
# 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)

View File

@ -0,0 +1,26 @@
# http://www.cmake.org/Wiki/CmakeMingw
#
# Copyright (c) 2006-2014 Mathieu Malaterre <mathieu.malaterre@voxxl.com>
#
# 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)

View File

@ -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}" )

85
tools/travis-ci/install.sh Executable file
View File

@ -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

View File

@ -0,0 +1 @@
NR-ENC-Bretagne2.ppm-7-compare_dec-ref-out2base

View File

@ -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

View File

@ -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

View File

@ -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

214
tools/travis-ci/run.sh Executable file
View File

@ -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 '<ConfigureStatus>0</ConfigureStatus>' ${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 '<Error>' ${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 '<Defect Type' ${OPJ_MEMCHECK_XML} 2> /dev/null; then
echo "Errors were found in dynamic analysis log"
OPJ_CI_RESULT=1
fi
fi
fi
exit ${OPJ_CI_RESULT}