Add ctest script
authormayeut <mayeut@users.noreply.github.com>
Sat, 12 Sep 2015 03:26:19 +0000 (05:26 +0200)
committermayeut <mayeut@users.noreply.github.com>
Sat, 12 Sep 2015 03:26:19 +0000 (05:26 +0200)
tools/ctest_scripts/travis-ci.cmake [new file with mode: 0644]
tools/travis-ci/run.sh

diff --git a/tools/ctest_scripts/travis-ci.cmake b/tools/ctest_scripts/travis-ci.cmake
new file mode 100644 (file)
index 0000000..841d926
--- /dev/null
@@ -0,0 +1,80 @@
+# -----------------------------------------------------------------------------
+# 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
+set( BUILD_PLATFORM "x86_64" )
+
+# 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()
+
+# Options 
+set( CACHE_CONTENTS "
+
+# Build kind
+CMAKE_BUILD_TYPE:STRING=${CTEST_BUILD_CONFIGURATION}
+
+# Warning level
+CMAKE_C_FLAGS:STRING= -Wall -Wextra -Wconversion -Wpedantic -Wno-unused-parameter -Wdeclaration-after-statement
+
+# Use to activate the test suite
+BUILD_TESTING:BOOL=TRUE
+
+# 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}")
+ctest_read_custom_files(${CTEST_BINARY_DIRECTORY})
+ctest_build(BUILD "${CTEST_BINARY_DIRECTORY}")
+ctest_test(BUILD "${CTEST_BINARY_DIRECTORY}" PARALLEL_LEVEL 2)
+
+if ("$ENV{OPJ_DO_SUBMIT}" STREQUAL "1")
+       ctest_submit()
+endif()
+ctest_empty_binary_directory( "${CTEST_BINARY_DIRECTORY}" )
index 65cc1c47af4ebf7d8cc549389ddb610a07b94820..58b86c1a16b56b9639576f71e583c251eeadc94b 100755 (executable)
@@ -8,9 +8,12 @@ set -o errexit   ## set -e : exit the script if any statement returns a non-true
 set -o pipefail  ## Fail on error in pipe
 
 # Set-up some variables
+OPJ_BUILD_CONFIGURATION=Release
 OPJ_SOURCE_DIR=$(cd $(dirname $0)/../.. && pwd)
 
-OPJ_DO_SUBMIT=0 # Do not flood cdash
+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"
@@ -63,11 +66,11 @@ if [ "${TRAVIS_BRANCH:-}" == "" ]; then
        TRAVIS_BRANCH=$(git -C ${OPJ_SOURCE_DIR} branch | grep '*' | tr -d '*[[:blank:]]') #default to master
 fi
 
-OPJ_BUILDNAME=${OPJ_OS_NAME}-${OPJ_CC_VERSION}-${TRAVIS_BRANCH}
+OPJ_BUILDNAME=${OPJ_OS_NAME}-${OPJ_CC_VERSION}-x86_64-${TRAVIS_BRANCH}
 if [ "${TRAVIS_PULL_REQUEST:-}" != "false" ] && [ "${TRAVIS_PULL_REQUEST:-}" != "" ]; then
        OPJ_BUILDNAME=${OPJ_BUILDNAME}-pr${TRAVIS_PULL_REQUEST}
 fi
-OPJ_BUILDNAME=${OPJ_BUILDNAME}-Release-3rdP
+OPJ_BUILDNAME=${OPJ_BUILDNAME}-${OPJ_BUILD_CONFIGURATION}-3rdP
 
 if [ "${OPJ_NONCOMMERCIAL:-}" == "1" ] && [ -d kdu ]; then
        echo "
@@ -80,21 +83,8 @@ Note: Binaries can only be used for non-commercial purposes.
 fi
 
 set -x
-if [ "${OPJ_NONCOMMERCIAL:-}" == "1" ] && [ -d kdu ]; then
-       if [ "${TRAVIS_OS_NAME}" == "linux" ]; then
-               if [ "${LD_LIBRARY_PATH:-}" == "" ]; then
-                       export LD_LIBRARY_PATH=${PWD}/kdu
-               else
-                       export LD_LIBRARY_PATH=${PWD}/kdu:${LD_LIBRARY_PATH}
-               fi
-       fi
-       export PATH=${PWD}/kdu:${PATH}
-fi
+# This will print configuration
+export OPJ_DO_SUBMIT=${OPJ_DO_SUBMIT}
+export OPJ_SOURCE_DIR=${OPJ_SOURCE_DIR}
 
-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/jpylyzer/jpylyzer.py -DSITE=${OPJ_SITE} -DBUILDNAME=${OPJ_BUILDNAME} ${OPJ_SOURCE_DIR}
-ctest -D ExperimentalStart
-ctest -D ExperimentalBuild -V
-ctest -D ExperimentalTest -j2 || true
-ctest -D ExperimentalSubmit || true
+ctest -S ${OPJ_SOURCE_DIR}/tools/ctest_scripts/travis-ci.cmake -V -D CTEST_BUILD_NAME:STRING=${OPJ_BUILDNAME} -D CTEST_SITE:STRING=${OPJ_SITE} -D CTEST_BUILD_CONFIGURATION:STRING=${OPJ_BUILD_CONFIGURATION}