Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • orfeotoolbox/otb
  • gpasero/otb
  • jinglada/otb
  • cs-si/otb
  • tardyb/otb
  • jmichel/otb
  • pedrojoclar/otb
  • derksend/otb
  • ussegliog/otb
  • SebastienPeillet/otb
  • waynedou/otb
  • lhermitte/otb
  • ArthurV/otb
  • sebastic/otb
  • gpernot/otb
  • super7ramp/otb
  • camiot/otb
  • ctraizet/otb
  • dyoussef/otb
  • bradh/otb
  • troopa81/otb
  • sdinot/otb
  • julienosman/otb
  • vidlb/otb
  • Feishi/otb
  • IlDordollano/otb
  • pty_/otb
  • daspk04/otb
28 results
Show changes
Showing
with 1912 additions and 0 deletions
#
# Copyright (C) 2005-2024 Centre National d'Etudes Spatiales (CNES)
#
# This file is part of Orfeo Toolbox
#
# https://www.orfeo-toolbox.org/
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
mv C:\build\otb\xdk\lib\*.dll C:\build\otb\xdk\bin
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="xml" indent="yes"/>
<!-- convert ctest output to junit format -->
<!--
Inspired by https://stackoverflow.com/questions/6329215/how-to-get-ctest-results-in-hudson-jenkins
Based on https://github.com/zanata/zanata-tests/blob/master/scripts/CTest2JUnit.xsl
Extended by providing total Start date, total time, total test stats
-->
<xsl:template match="/Site">
<xsl:variable name="StartDate"><xsl:value-of select="Testing/StartDateTime"/></xsl:variable>
<xsl:variable name="DoTime"><xsl:value-of select="Testing/EndTestTime - Testing/StartTestTime"/></xsl:variable>
<xsl:variable name="TotalTests"><xsl:value-of select="count(Testing/Test)"/></xsl:variable>
<xsl:variable name="Skipped"><xsl:value-of select="count(Testing/Test[@Status='notrun'])"/></xsl:variable>
<xsl:variable name="Disabled"><xsl:value-of select="count(Testing/Test/Results/Measurement[Value='Disabled'])"/></xsl:variable>
<xsl:variable name="Failed"><xsl:value-of select="count(Testing/Test[@Status='failed'])"/></xsl:variable>
<testsuite time="{$DoTime}" timestamp="{$StartDate}" tests="{$TotalTests}" failures="{$Failed}" skipped="{$Skipped}" disabled="{$Disabled}">
<xsl:variable name="BuildName"><xsl:value-of select="@BuildName"/></xsl:variable>
<xsl:variable name="BuildStamp"><xsl:value-of select="@BuildStamp"/></xsl:variable>
<xsl:variable name="Name"><xsl:value-of select="@Name"/></xsl:variable>
<xsl:variable name="Generator"><xsl:value-of select="@Generator"/></xsl:variable>
<xsl:variable name="CompilerName"><xsl:value-of select="@CompilerName"/></xsl:variable>
<xsl:variable name="OSName"><xsl:value-of select="@OSName"/></xsl:variable>
<xsl:variable name="Hostname"><xsl:value-of select="@Hostname"/></xsl:variable>
<xsl:variable name="OSRelease"><xsl:value-of select="@OSRelease"/></xsl:variable>
<xsl:variable name="OSVersion"><xsl:value-of select="@OSVersion"/></xsl:variable>
<xsl:variable name="OSPlatform"><xsl:value-of select="@OSPlatform"/></xsl:variable>
<xsl:variable name="Is64Bits"><xsl:value-of select="@Is64Bits"/></xsl:variable>
<xsl:variable name="VendorString"><xsl:value-of select="@VendorString"/></xsl:variable>
<xsl:variable name="VendorID"><xsl:value-of select="@VendorID"/></xsl:variable>
<xsl:variable name="FamilyID"><xsl:value-of select="@FamilyID"/></xsl:variable>
<xsl:variable name="ModelID"><xsl:value-of select="@ModelID"/></xsl:variable>
<xsl:variable name="ProcessorCacheSize"><xsl:value-of select="@ProcessorCacheSize"/></xsl:variable>
<xsl:variable name="NumberOfLogicalCPU"><xsl:value-of select="@NumberOfLogicalCPU"/></xsl:variable>
<xsl:variable name="NumberOfPhysicalCPU"><xsl:value-of select="@NumberOfPhysicalCPU"/></xsl:variable>
<xsl:variable name="TotalVirtualMemory"><xsl:value-of select="@TotalVirtualMemory"/></xsl:variable>
<xsl:variable name="TotalPhysicalMemory"><xsl:value-of select="@TotalPhysicalMemory"/></xsl:variable>
<xsl:variable name="LogicalProcessorsPerPhysical"><xsl:value-of select="@LogicalProcessorsPerPhysical"/></xsl:variable>
<xsl:variable name="ProcessorClockFrequency"><xsl:value-of select="@ProcessorClockFrequency"/></xsl:variable>
<properties>
<property name="BuildName" value="{$BuildName} {$DoTime}" />
<property name="BuildStamp" value="{$BuildStamp}" />
<property name="Name" value="{$Name}" />
<property name="Generator" value="{$Generator}" />
<property name="CompilerName" value="{$CompilerName}" />
<property name="OSName" value="{$OSName}" />
<property name="Hostname" value="{$Hostname}" />
<property name="OSRelease" value="{$OSRelease}" />
<property name="OSVersion" value="{$OSVersion}" />
<property name="OSPlatform" value="{$OSPlatform}" />
<property name="Is64Bits" value="{$Is64Bits}" />
<property name="VendorString" value="{$VendorString}" />
<property name="VendorID" value="{$VendorID}" />
<property name="FamilyID" value="{$FamilyID}" />
<property name="ModelID" value="{$ModelID}" />
<property name="ProcessorCacheSize" value="{$ProcessorCacheSize}" />
<property name="NumberOfLogicalCPU" value="{$NumberOfLogicalCPU}" />
<property name="NumberOfPhysicalCPU" value="{$NumberOfPhysicalCPU}" />
<property name="TotalVirtualMemory" value="{$TotalVirtualMemory}" />
<property name="TotalPhysicalMemory" value="{$TotalPhysicalMemory}" />
<property name="LogicalProcessorsPerPhysical" value="{$LogicalProcessorsPerPhysical}" />
<property name="ProcessorClockFrequency" value="{$ProcessorClockFrequency}" />
</properties>
<xsl:apply-templates select="Testing/Test"/>
<system-out>
BuildName: <xsl:value-of select="$BuildName" />
BuildStamp: <xsl:value-of select="$BuildStamp" />
Name: <xsl:value-of select="$Name" />
Generator: <xsl:value-of select="$Generator" />
CompilerName: <xsl:value-of select="$CompilerName" />
OSName: <xsl:value-of select="$OSName" />
Hostname: <xsl:value-of select="$Hostname" />
OSRelease: <xsl:value-of select="$OSRelease" />
OSVersion: <xsl:value-of select="$OSVersion" />
OSPlatform: <xsl:value-of select="$OSPlatform" />
Is64Bits: <xsl:value-of select="$Is64Bits" />
VendorString: <xsl:value-of select="$VendorString" />
VendorID: <xsl:value-of select="$VendorID" />
FamilyID: <xsl:value-of select="$FamilyID" />
ModelID: <xsl:value-of select="$ModelID" />
ProcessorCacheSize: <xsl:value-of select="$ProcessorCacheSize" />
NumberOfLogicalCPU: <xsl:value-of select="$NumberOfLogicalCPU" />
NumberOfPhysicalCPU: <xsl:value-of select="$NumberOfPhysicalCPU" />
TotalVirtualMemory: <xsl:value-of select="$TotalVirtualMemory" />
TotalPhysicalMemory: <xsl:value-of select="$TotalPhysicalMemory" />
LogicalProcessorsPerPhysical: <xsl:value-of select="$LogicalProcessorsPerPhysical" />
ProcessorClockFrequency: <xsl:value-of select="$ProcessorClockFrequency" />
</system-out>
</testsuite>
</xsl:template>
<xsl:template match="Testing/Test">
<xsl:variable name="testcasename"><xsl:value-of select="Name"/></xsl:variable>
<xsl:variable name="testclassname"><xsl:value-of select=" concat('this', substring(Path,2))"/></xsl:variable>
<xsl:variable name="exectime">
<xsl:for-each select="Results/NamedMeasurement">
<xsl:if test="@name='Execution Time'">
<xsl:value-of select="Value"/>
</xsl:if>
</xsl:for-each>
</xsl:variable>
<testcase name="{$testcasename}" classname="{$testclassname}" time="{$exectime}">
<xsl:if test="@Status = 'passed'">
<system-out><xsl:value-of select="Results/Measurement/Value/text()"/></system-out>
</xsl:if>
<xsl:if test="@Status = 'failed'">
<xsl:variable name="failtype">
<xsl:for-each select="Results/NamedMeasurement">
<xsl:if test="@name = 'Exit Code'">
<xsl:value-of select="Value"/>
</xsl:if>
</xsl:for-each>
</xsl:variable>
<xsl:variable name="failcode">
<xsl:for-each select="Results/NamedMeasurement">
<xsl:if test="@name = 'Exit Value'">
<xsl:value-of select="Value"/>
</xsl:if>
</xsl:for-each>
</xsl:variable>
<failure message="{$failtype} ({$failcode})"><xsl:value-of select="Results/Measurement/Value/text()" /></failure>
</xsl:if>
<xsl:if test="@Status = 'notrun'">
<skipped><xsl:value-of select="Results/Measurement/Value/text()" /></skipped>
</xsl:if>
</testcase>
</xsl:template>
</xsl:stylesheet>
#!/bin/bash
#
# Copyright (C) 2005-2024 Centre National d'Etudes Spatiales (CNES)
#
# This file is part of Orfeo Toolbox
#
# https://www.orfeo-toolbox.org/
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
jobs_directory=/home/otbpush/test
build_dir=$(readlink -f "$1")
scp "${build_dir}"/SuperBuild-archives-*.{tar.bz2,md5} otbpush@otb5-vm2.orfeo-toolbox.org:${jobs_directory}/.
if [ "$CI_COMMIT_REF_NAME" = "develop" ] # check if the branch name is develop or not
then # we are on develop
ssh otbpush@otb5-vm2.orfeo-toolbox.org \
mv ${jobs_directory}/SuperBuild-archives-*.{tar.bz2,md5} ${jobs_directory}/superbuild_archive
else # we are on a release branch
ssh otbpush@otb5-vm2.orfeo-toolbox.org \
mv ${jobs_directory}/SuperBuild-archives-*.{tar.bz2,md5} ${jobs_directory}/staging/
fi
#!/bin/bash
#
# Copyright (C) 2005-2024 Centre National d'Etudes Spatiales (CNES)
#
# This file is part of Orfeo Toolbox
#
# https://www.orfeo-toolbox.org/
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# This script aims at moving and renaming source, packages and documentation from
# staging area to production area
staging_area=/home/otbpush/test/staging
#check if we are dealing with the right packages
pack_suffix=-$(echo "$CI_COMMIT_TAG" | grep -o "rc[0-9]*") # this retrieve the rc number
echo "pack_suffix=${pack_suffix}"
echo "Renaming binary packages"
# find build_packages/. -name "*.run" \
# -exec sh -c 'mv "$1" "${1%.run}${pack_suffix}.run"' _ {} \;
packages_list=$(ls ${staging_area} | grep -E "OTB-[0-9]*.[0-9]*.[0-9]*-.*\.(run|zip)")
ls -all build_packages/
for name in $packages_list
do
len=${#name}
#add pack_suffix to the name
mv "$name" "${name:0:$len-4}${pack_suffix}${name:$len-4}"
done
# TO REMOVE
###########
ls -all build_packages/
###########
#!/bin/bash
#
# Copyright (C) 2005-2024 Centre National d'Etudes Spatiales (CNES)
#
# This file is part of Orfeo Toolbox
#
# https://www.orfeo-toolbox.org/
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
if [ "$CI_COMMIT_REF_NAME" = "develop" ] # check if the branch name is develop or not
then # we are on develop
jobs_directory=/home/otbpush/test/$(date +%F)
else # we are on a release branch
jobs_directory=/home/otbpush/test/staging
fi
echo "jobs_directory=${jobs_directory}"
# Create today's directory on serveur otb5-vm2
echo "Creating today's directory"
ssh otbpush@otb5-vm2.orfeo-toolbox.org mkdir -p ${jobs_directory}
# Delete latest
echo "Deleting latest directory"
if [ "$CI_COMMIT_REF_NAME" = "develop" ]
then # On develop
ssh otbpush@otb5-vm2.orfeo-toolbox.org rm -rf /home/otbpush/test/latest
# Create symilink
ssh otbpush@otb5-vm2.orfeo-toolbox.org ln -s ${jobs_directory} /home/otbpush/test/latest
# Cleaning old directory
matching_dirs=$(ls -1 | grep -oE '^20[0-9]{2}-[0-9]{2}-[0-9]{2}$' | sort)
history_length=11
rm -rf "$(echo "$matching_dirs" | tr ' ' '\n' | head -n -${history_length})"
else # On release
# Remove what is inside staging area
ssh otbpush@otb5-vm2.orfeo-toolbox.org rm -rf ${jobs_directory}/*
fi
# Remove old package and source file
echo "Removing old package and sources"
ssh otbpush@otb5-vm2.orfeo-toolbox.org \
rm ${jobs_directory}/OTB-*.zip \
${jobs_directory}/OTB-*.tar.*
# Push package
echo "Pushing new binary and sources packages"
scp OTB-*.{tar.gz,zip} otbpush@otb5-vm2.orfeo-toolbox.org:${jobs_directory}/.
echo "Removing old CookBook"
ssh otbpush@otb5-vm2.orfeo-toolbox.org \
rm ${jobs_directory}/CookBook-*-html.tar.gz
echo "Removing old Doxygen"
ssh otbpush@otb5-vm2.orfeo-toolbox.org \
rm ${jobs_directory}/OTB-Doxygen-*.tar.bz2
# Push doc
echo "Pushing new documentation"
scp {CookBook-*-html.tar.gz,OTB-Doxygen-*.tar.bz2} otbpush@otb5-vm2.orfeo-toolbox.org:${jobs_directory}/.
# Create zip, tar.gz and tar.xy source
echo "Creating source tarball and zip"
git archive --format=zip -o OTB-sources-"$CI_COMMIT_SHORT_SHA".zip HEAD
git archive --format=tgz -o OTB-sources-"$CI_COMMIT_SHORT_SHA".tar.gz HEAD
git archive --format=tar.xz -o OTB-sources-"$CI_COMMIT_SHORT_SHA".tar.xz HEAD
# Remove old source file
#echo "Removing old sources"
#ssh otbpush@otb5-vm2.orfeo-toolbox.org \
#rm ${jobs_directory}/OTB-sources-*.zip \
#${jobs_directory}/OTB-sources-*.tar.*
# Push new source file
echo "Pushing new sources"
scp OTB-sources-"$CI_COMMIT_SHORT_SHA".* \
otbpush@otb5-vm2.orfeo-toolbox.org:${jobs_directory}/
echo "${CI_COMMIT_SHA}" > ref.sha
echo "Pushing ref.sha"
scp ref.sha otbpush@otb5-vm2.orfeo-toolbox.org:${jobs_directory}/
#Untar doc
if [ "$CI_COMMIT_REF_NAME" = "develop" ]
then
#Cookbook
ssh otbpush@otb5-vm2.orfeo-toolbox.org \
tar -xf ${jobs_directory}/CookBook-*-html.tar.gz -C ${jobs_directory}/
ssh otbpush@otb5-vm2.orfeo-toolbox.org \
rm -rf /home/otbpush/test/CookBook/*
ssh otbpush@otb5-vm2.orfeo-toolbox.org \
mv ${jobs_directory}/CookBook-*/* /home/otbpush/test/CookBook/.
# Doxygen
ssh otbpush@otb5-vm2.orfeo-toolbox.org \
rm -rf /home/otbpush/test/Doxygen/*
# Strip first component of the tar (Doxygen/html/...)
ssh otbpush@otb5-vm2.orfeo-toolbox.org \
tar -xf ${jobs_directory}/OTB-Doxygen-*.tar.bz2 -C /home/otbpush/test/Doxygen/ --strip-components=1
fi
#
# Copyright (C) 2005-2024 Centre National d'Etudes Spatiales (CNES)
#
# This file is part of Orfeo Toolbox
#
# https://www.orfeo-toolbox.org/
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
function Print-Usage {
echo "Usage: $0 <compiler_arch> <project> [<target-os> [<vc_version>]]"
echo " <compiler_arch> : 'x86' | 'x64'"
echo " <project> : 'xdk' | 'otb'"
echo " <target-os> : '8.1' | '10' (default)"
echo " <vc_version> :"
echo " '14.20' (i.e. VS 2019)"
echo " '14.16' (i.e. VS 2017)"
echo " '14.0' (i.e. VS 2015) (default)"
}
# check input arguments
if ( $args.count -lt 1 ) {
echo "No arch"
Print-Usage
Break
}
if ( $args[0] -match "help") {
Print-Usage
Break
}
if ( $args.count -lt 2 ) {
echo "No project"
Print-Usage
Break
}
$ARCH=$args[0]
$PROJECT=$args[1]
if ( $args.count -lt 3 ) {
$SHORT_TARGET=10
} else {
$SHORT_TARGET=$args[2]
}
if ( $args.count -lt 4 ) {
$VCVER=14.29
} else {
$VCVER=$args[3]
}
$Global:TARGET=$SHORT_TARGET
if ( $SHORT_TARGET -eq 10 ) {
$Global:TARGET=10.0.17763.0
}
# Setup home dir (so that ssh configuration works fine)
# if "%USERNAME%"=="otbbot" (
$Global:HOMEDRIVE="C:"
$Global:HOMEPATH="\Users\otbbot"
#)
echo "Home dir: $HOMEDRIVE$HOMEPATH"
# Get the folder of current script
$SCRIPT_DIR=Split-Path $MyInvocation.MyCommand.Path -Parent
# Setup Python
. "$SCRIPT_DIR\setup_python.ps1" $ARCH
# Setup GL dlls
$env:PATH="$env:PATH;C:\tools\GL\$ARCH\bin"
# Setup compiler
# Thanks to Microsoft stupidness for not providing a script to set Development
# toolset in Powershell, they advice to use a third party script
# able to take vars from cmd and init them in powershell
# see official M$ answer saying they wont do the job:
# https://developercommunity.visualstudio.com/t/Provide-a-PowerShell-version-of-vcvarsal/10238319
. "$SCRIPT_DIR\Invoke-CmdScript.ps1"
Invoke-CmdScript "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Auxiliary\Build\vcvarsall.bat" "$ARCH $TARGET -vcvars_ver=$VCVER"
# Setup Clcache
$Global:BUILDCACHE_DIR="C:\buildcache\$PROJECT-$ARCH-$TARGET-$VCVER"
if ( $PROJECT -eq "xdk" ) {
$Global:BUILDCACHE_MAX_CACHE_SIZE=3000000000
}
if ( $PROJECT -eq "otb" ) {
$Global:BUILDCACHE_MAX_CACHE_SIZE=2000000000
}
$env:PATH="C:\tools\buildcache\bin;$env:PATH"
# define image name as env variable as it is used in prepare_superbuild.cmake
$env:IMAGE_NAME="windows-$SHORT_TARGET-$ARCH-vc$VCVER"
echo "Generated IMAGE_NAME: $env:IMAGE_NAME"
# setup path to perl, but add it last ... (there is a libstdc++.dll in that folder...)
$env:PATH="$env:PATH;C:\tools\perl\perl\bin"
#!/usr/bin/python3
#
# -*- coding: utf-8 -*-
#
# Copyright (C) 2005-2025 Centre National d'Etudes Spatiales (CNES)
#
# This file is part of Orfeo Toolbox
#
# https://www.orfeo-toolbox.org/
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
import os, re
# Root search directory
topdir = '.'
# Header to associate to each file extension
# - C++ and JavaScript comments are defined by /* ... */ (=> C++ header)
# - Shell, Python, Perl comments are defubed by # ... (=> Shell header)
# - Text files must be processed on a case-by-case basis according to their
# content and what is done with them
# - It is complicated to insert a comment in an image file and most of them
# were not created by the OTB project (=> no header)
# - There is no need to insert a copyright header in the generated files or
# configuration files (=> no header)
# - Most of CSS files were not created by the OTB project (=> no header)
# - etc.
fileext = {
'.cpp': 'cpp',
'.cxx': 'cpp',
'.txx': 'cpp',
'.h': 'cpp',
'.hpp': 'cpp',
'.hxx': 'cpp',
'.h.in': 'cpp',
'.includes': 'cpp',
'.i': 'cpp',
'.js': 'cpp',
'.sh': 'shell',
'.sh.in': 'shell',
'.bash': 'shell',
'.profile': 'shell',
'.ps1': 'shell',
'.ps1.in': 'shell',
'.py': 'shell',
'.py.in': 'shell',
'.cmake': 'shell',
'.cmake.in': 'shell',
'.yml': 'shell',
'.pl': 'shell',
'.bat': 'batch',
'.bat.in': 'batch',
'.png': 'none',
'.jpg': 'none',
'.tif': 'none',
'.xpm': 'none',
'.ico': 'none',
'.eps': 'none',
'.svg': 'none',
'.txt': 'none',
'.md': 'none',
'.rst': 'none',
'.xml': 'none',
'.html': 'none',
'.dox': 'none',
'.dox.in': 'none',
'.ts': 'none',
'.ui': 'none',
'.qrc': 'none',
'.rc': 'none',
'.rc.in': 'none',
'.css': 'none'
}
specialfiles = {
'CMakeLists.txt': 'shell', # i.e. CMake file but Shell like comments
'StandaloneWrapper.in': 'shell', # i.e. CMake file but Shell like comments
'macx_pkgsetup.in': 'shell',
'linux_pkgsetup.in': 'shell'
}
# Directories to exclude from the header checking for various reasons (third
# party works, data, patches, ...)
excludeddirs = set([
'./.git',
'./Data',
'./Modules/ThirdParty',
'./Packaging/makeself',
'./SuperBuild/Copyright',
'./SuperBuild/patches'
])
# Files to exclude from the header checking for various reasons (full text of
# licenses, binary archives, ...)
excludedfiles = set([
'./.clang-format',
'./.editorconfig',
'./.gitattributes',
'./.gitignore',
'./.mailmap',
'./sonar-project.properties',
'./LICENSE',
'./NOTICE',
'./VERSION',
'./CI/ctest2junit.xsl',
'./CI/Invoke-CmdScript.ps1',
'./CI/test/README',
'./CMake/CppcheckTargets.cmake',
'./CMake/FindKWStyle.cmake',
'./CMake/FindLibSVM.cmake',
'./CMake/Findcppcheck.cmake',
'./CMake/Findcppcheck.cpp',
'./CMake/GenerateExportHeaderCustom.cmake',
'./CMake/InsightValgrind-RHEL6.supp',
'./CMake/InsightValgrind.supp',
'./CMake/OTB_CheckCCompilerFlag.cmake',
'./CMake/PythonCompile.py',
'./CMake/TopologicalSort.cmake',
'./CMake/exportheader.cmake.in',
'./CMake/pre-commit',
'./CMake/Packaging_OTB.cmake',
'./Docker/Dockerfile',
'./Docker/Dockerfile_CI',
'./Docker/system-dependencies.txt',
'./Documentation/Cookbook/Art/residual_registration-figure.tex',
'./Documentation/Cookbook/rst/Makefile.in',
'./Documentation/Cookbook/rst/conf.py.in',
'./Documentation/Cookbook/Scripts/gdal-config',
'./Modules/Visualization/Ice/README',
'./Modules/Core/Wrappers/SWIG/src/numpy.i',
'./Modules/Core/Wrappers/SWIG/src/python/__init__.py',
'./Modules/Core/Common/include/otbCastImageFilter.h',
'./Modules/Core/Common/include/otbCastImageFilter.hxx',
'./CI/Invoke-CmdScript.ps1',
'./CI/copy_boost_dlls.ps1',
'./CI/dev_env.ps1',
'./CI/setup_python.ps1',
'./Packaging/Files/OTB Project.zip',
'./Packaging/Files/template.app/Contents/Info.plist',
'./Packaging/LICENSE',
'./Packaging/patchelf_remove_warning.diff',
'./Packaging/howto_update_makeself',
'./Packaging/otb_update_makeself',
'./SuperBuild/LICENSE',
'./Utilities/Doxygen/doxygen.config.in',
'./Utilities/Maintenance/BuildHeaderTest.py',
'./Utilities/Maintenance/fix_typos.sh'
])
regcppheader = re.compile(
r'''/\*
( \* Copyright \(C\) 1999-2011 Insight Software Consortium
| \* Copyright \(C\) 20\d\d(-20\d\d)? Centre National d'Etudes Spatiales \(CNES\)
| \* Copyright \(C\) 20\d\d(-20\d\d)? CS Systemes d'Information \(CS SI\)
| \* Copyright \(C\) 2007-2012 Institut Mines Telecom / Telecom Bretagne
| \* Copyright \(C\) 20\d\d(-20\d\d)? IRSTEA
| \* Copyright \(C\) 2008 Jan Wegner
| \* Copyright \(C\) 2007 Julien Radoux
)+ \*
\* This file is part of Orfeo Toolbox
\*
\* https://www\.orfeo-toolbox\.org/
\*
\* Licensed under the Apache License, Version 2\.0 \(the "License"\);
\* you may not use this file except in compliance with the License\.
\* You may obtain a copy of the License at
\*
\* http://www\.apache\.org/licenses/LICENSE-2\.0
\*
\* Unless required by applicable law or agreed to in writing, software
\* distributed under the License is distributed on an "AS IS" BASIS,
\* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied\.
\* See the License for the specific language governing permissions and
\* limitations under the License\.
\*/
''', flags=re.MULTILINE)
regshellheader = re.compile(
r'''(.*
)+(# Copyright \(C\) 1999-2011 Insight Software Consortium
|# Copyright \(C\) 20\d\d(-20\d\d)? Centre National d'Etudes Spatiales \(CNES\)
|# Copyright \(C\) 20\d\d(-20\d\d)? CS Systemes d'Information \(CS SI\)
|# Copyright \(C\) 20\d\d(-20\d\d)? IRSTEA
|# Copyright \(C\) 2007-2012 Institut Mines Telecom / Telecom Bretagne
)+#
# This file is part of Orfeo Toolbox
#
# https://www\.orfeo-toolbox\.org/
#
# Licensed under the Apache License, Version 2\.0 \(the "License"\);
# you may not use this file except in compliance with the License\.
# You may obtain a copy of the License at
#
# http://www\.apache\.org/licenses/LICENSE-2\.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied\.
# See the License for the specific language governing permissions and
# limitations under the License\.
''', flags=re.MULTILINE)
regbatchheader = re.compile(
r'''(.*
)+(:: Copyright \(C\) 1999-2011 Insight Software Consortium
|:: Copyright \(C\) 20\d\d(-20\d\d)? Centre National d'Etudes Spatiales \(CNES\)
|:: Copyright \(C\) 20\d\d(-20\d\d)? CS Systemes d'Information \(CS SI\)
|:: Copyright \(C\) 2007-2012 Institut Mines Telecom / Telecom Bretagne
)+::
:: This file is part of Orfeo Toolbox
::
:: https://www\.orfeo-toolbox\.org/
::
:: Licensed under the Apache License, Version 2\.0 \(the "License"\);
:: you may not use this file except in compliance with the License\.
:: You may obtain a copy of the License at
::
:: http://www\.apache\.org/licenses/LICENSE-2\.0
::
:: Unless required by applicable law or agreed to in writing, software
:: distributed under the License is distributed on an "AS IS" BASIS,
:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied\.
:: See the License for the specific language governing permissions and
:: limitations under the License\.
''', flags=re.MULTILINE)
debug = False
returnvalue = 0
def verifyheader(filename, category):
global returnvalue
if category == 'none':
if debug: print('File type ignored ({} style comment): {}'.format(category, filename))
return True
sourceFile = open(filename)
sourceContent = sourceFile.read().lstrip()
sourceFile.close()
if category == 'cpp':
m = regcppheader.match(sourceContent)
elif category == 'shell':
m = regshellheader.match(sourceContent)
elif category == 'batch':
m = regbatchheader.match(sourceContent)
else:
print('WARNING: Unable to evaluate header ({} style comment): {}'.format(category, filename))
returnvalue = 1
return False
if m:
if debug: print('Conform header ({} style comment): {}'.format(category, filename))
return True
else:
print('WARNING: Non-compliant header ({} style comment): {}'.format(category, filename))
returnvalue = 1
return False
# Regular expression catching the file extension (with patterns '.xxx' or
# '.xxx.yyy', like '.cmake' or '.cmake.in')
# NOTE: '+?' operator is the not greedy / hungry version of '+' operator.
extreg = re.compile(r'^.+?(\.[^.]+(\.[^.]+)?)$')
for root, dirs, files in os.walk(topdir, topdown=True):
# "dirs[:]" modify dirs "in-place". In doing so, we can ignore some
# directories (here, the directories listed in the 'excludeddirs' set.
dirs[:] = [d for d in dirs if os.path.join(root, d) not in excludeddirs]
for f in sorted(files):
fullpathname = os.path.join(root, f)
# 1. Exclusion of files in which we do not want to search for the
# copyright header.
if fullpathname in excludedfiles:
if debug: print('File excluded: {}'.format(fullpathname))
# 2. Early identification of files with a misleading extension
elif f in specialfiles.keys():
verifyheader(fullpathname, specialfiles[f])
# 3. Processing of other files according to their extension
else:
m = extreg.match(f)
if m:
# NOTE: m.group(0) = Whole string matched by the regular
# expression (here, the whole name of the file)
ext1 = m.group(1) # '.xxx' or '.xxx.yyy' form
ext2 = m.group(2) # '.yyy' form (optional and included in group #1)
# The test of two extensions (ext1, ext2) rather than only one
# make possible to distinguish known extensions, such ".cmake"
# or ".cmake.in", from patterns that look like a double
# extension, but are not, like ".remote.cmake". So, the
# appropriate processing can be applied (".remote.cmake" must
# be identified as ".cmake" and not as an unknown extension).
if ext1 in fileext.keys():
verifyheader(fullpathname, fileext[ext1])
elif ext2 in fileext.keys():
verifyheader(fullpathname, fileext[ext2])
else:
print('WARNING: File with an unknown extension: {}'.format(fullpathname))
returnvalue = 1
else:
print('WARNING: File without extension and not excluded: {}'.format(fullpathname))
returnvalue = 1
exit(returnvalue)
#
# Copyright (C) 2005-2024 Centre National d'Etudes Spatiales (CNES)
#
# This file is part of Orfeo Toolbox
#
# https://www.orfeo-toolbox.org/
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# This script is for the superbuild build on the CI platform
# Find the build name and CI profile
macro( set_dash_build_name )
set(ci_profile wip)
set(ci_mr_source "$ENV{CI_MERGE_REQUEST_SOURCE_BRANCH_NAME}")
set(ci_mr_target "$ENV{CI_MERGE_REQUEST_TARGET_BRANCH_NAME}")
set(ci_mr_iid "$ENV{CI_MERGE_REQUEST_IID}")
set(ci_pipeline_id "$ENV{CI_PIPELINE_ID}")
set(ci_job_id "$ENV{CI_JOB_ID}")
set(ci_ref_name "$ENV{CI_COMMIT_REF_NAME}")
set (CTEST_BUILD_NAME ${ci_short_sha})
if(ci_mr_source AND ci_mr_target AND ci_mr_iid)
set (CTEST_BUILD_NAME "${ci_mr_source} (MR ${ci_mr_iid}) P-${ci_pipeline_id}")
set(ci_profile mr)
elseif(ci_ref_name)
set (CTEST_BUILD_NAME "${ci_ref_name} P-${ci_pipeline_id}")
if("${ci_ref_name}" STREQUAL "develop")
set(ci_profile develop)
elseif("${ci_ref_name}" MATCHES "^release-[0-9]+\\.[0-9]+\$")
set(ci_profile release)
endif()
endif()
endmacro()
# Download and extract an XDK (needs OTB_SOURCE_DIR, and the file sb_branch.txt in it)
macro(get_xdk)
# How to get md5sum:
# * concatenate all source files in one
# * add configure result from previous job ${OTB_SOURCE_DIR}/build/CMakeCache.txt
file(STRINGS "${OTB_SOURCE_DIR}/sb_branch.txt" BRANCH_NAME LIMIT_COUNT 1 REGEX "^([A-Za-z0-9]|/|-|_|\\.)+" )
# Look for a GIT command-line client.
find_program(CTEST_GIT_COMMAND NAMES git git.cmd)
# Download xdk :
# git clone $REPOSITORY_URL --branch $BRANCH_NAME --depth 1 superbuild-artifact
set ( REMOTE "https://gitlab.orfeo-toolbox.org/orfeotoolbox/superbuild-artifact.git")
execute_process(
COMMAND ${CTEST_GIT_COMMAND} "clone" "${REMOTE}" "--branch" "${BRANCH_NAME}"
"--depth" "1" "superbuild-artifact"
WORKING_DIRECTORY ${OTB_SOURCE_DIR}
RESULT_VARIABLE clone_res
OUTPUT_VARIABLE clone_out
ERROR_VARIABLE clone_err
)
if ( DEBUG )
message( "Clone")
message( "clone_res = ${clone_res}" )
message( "clone_out = ${clone_out}" )
message( "clone_err = ${clone_err}" )
endif()
if (clone_res)
message( "Command : COMMAND ${CTEST_GIT_COMMAND} clone ${REMOTE} --branch ${BRANCH_NAME} \
--depth 1 superbuild-artifact")
message( "Result :")
message( "clone_res = ${clone_res}" )
message( "clone_out = ${clone_out}" )
message( "clone_err = ${clone_err}" )
message( FATAL_ERROR "Problem in retrieving the archive")
endif()
execute_process(
COMMAND ${CMAKE_COMMAND} "-E" "tar" "xf"
"${OTB_SOURCE_DIR}/superbuild-artifact/SuperBuild_Install.tar"
RESULT_VARIABLE tar_res
OUTPUT_VARIABLE tar_out
ERROR_VARIABLE tar_err
WORKING_DIRECTORY ${OTB_SOURCE_DIR}
)
if ( DEBUG )
message( "${CMAKE_COMMAND} -E tar xf ${OTB_SOURCE_DIR}/superbuild-artifact/SuperBuild_Install.tar")
message( "tar_res: '${clone_res}'" )
message( "tar_out: '${tar_out}'" )
message( "tar_err: '${tar_err}'" )
endif()
set( XDK_INSTALL_PATH "${OTB_SOURCE_DIR}/xdk")
if ( DEBUG )
if ( EXISTS "${XDK_INSTALL_PATH}")
message("Xdk folder exists at ${XDK_INSTALL_PATH}")
else()
message("Something went wrong no folder in ${XDK_INSTALL_PATH}")
message("The branch was ${BRANCH_NAME}")
endif()
endif()
endmacro()
#
# Copyright (C) 2005-2024 Centre National d'Etudes Spatiales (CNES)
#
# This file is part of Orfeo Toolbox
#
# https://www.orfeo-toolbox.org/
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
include( "${CMAKE_CURRENT_LIST_DIR}/macros.cmake" )
# This script is a prototype for the future CI, it may evolve rapidly in a near future
get_filename_component(OTB_SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR} DIRECTORY)
set (ENV{LANG} "C") # Only ascii output
# Build Configuration : Release, Debug..
if(ci_build_type)
set (CTEST_BUILD_CONFIGURATION ${ci_build_type})
else()
set (CTEST_BUILD_CONFIGURATION "Release")
endif()
set (CTEST_CMAKE_GENERATOR "Ninja")
# detect short sha
if(NOT DEFINED ENV{CI_COMMIT_SHORT_SHA})
execute_process(COMMAND git log -1 --pretty=format:%h
WORKING_DIRECTORY ${OTB_SOURCE_DIR}
OUTPUT_VARIABLE ci_short_sha)
else()
set(ci_short_sha "$ENV{CI_COMMIT_SHORT_SHA}")
endif()
# Find the build name and CI profile
set_dash_build_name()
# set pipelines to enable documentation
set(ci_cookbook_profiles mr develop release)
set(ci_doxygen_profiles develop release)
list(FIND ci_cookbook_profiles ${ci_profile} ci_do_cookbook)
list(FIND ci_doxygen_profiles ${ci_profile} ci_do_doxygen)
# Detect site
if(NOT DEFINED IMAGE_NAME)
if(DEFINED ENV{IMAGE_NAME})
set(IMAGE_NAME $ENV{IMAGE_NAME})
endif()
endif()
set (CTEST_SITE "${IMAGE_NAME}")
# Detect "skip testing"
if(DEFINED ENV{CI_SKIP_TESTING})
set(ci_skip_testing 1)
endif()
# Directory variable
set (CTEST_SOURCE_DIRECTORY "${OTB_SOURCE_DIR}")
if(BUILD_DIR)
set (CTEST_BINARY_DIRECTORY "${BUILD_DIR}")
else()
set (CTEST_BINARY_DIRECTORY "${OTB_SOURCE_DIR}/build/")
endif()
set (CTEST_INSTALL_DIRECTORY "${OTB_SOURCE_DIR}/install/")
set (PROJECT_SOURCE_DIR "${OTB_SOURCE_DIR}")
# Ctest command value
set (CMAKE_COMMAND "cmake")
message(STATUS "CI profile : ${ci_profile}")
#The following file set the CONFIGURE_OPTIONS variable
set (ENABLE_DOXYGEN OFF)
set (CONFIGURE_OPTIONS "")
include ( "${CMAKE_CURRENT_LIST_DIR}/configure_options.cmake" )
# Sources are already checked out : do nothing for update
set(CTEST_GIT_UPDATE_CUSTOM "${CMAKE_COMMAND}" "-E" "echo" "No update")
# Look for a GIT command-line client.
find_program(CTEST_GIT_COMMAND NAMES git git.cmd)
# End of configuration
ctest_start (Experimental TRACK CI_Build)
ctest_update()
# --------------------------- Configure ----------------------------------------
ctest_configure(BUILD "${CTEST_BINARY_DIRECTORY}"
SOURCE "${OTB_SOURCE_DIR}"
OPTIONS "${CONFIGURE_OPTIONS}"
RETURN_VALUE _configure_rv
CAPTURE_CMAKE_ERROR _configure_error
)
# Configure log
file ( WRITE
"${OTB_SOURCE_DIR}/log/configure_return_value_log.txt" "${_configure_rv}")
file ( WRITE
"${OTB_SOURCE_DIR}/log/configure_cmake_error_log.txt" "${_configure_error}")
if ( NOT _configure_rv EQUAL 0 )
# stop processing here
ctest_submit()
message( FATAL_ERROR "An error occurs during ctest_configure.")
endif()
# ------------------------------ Build -----------------------------------------
if(ci_skip_install)
message(STATUS "Skip install")
if (ci_build_target)
message(STATUS "Building target: ${ci_build_target}")
set(CTEST_BUILD_TARGET ${ci_build_target})
else()
set(CTEST_BUILD_TARGET)
endif()
else()
set(CTEST_BUILD_TARGET install)
endif()
ctest_build(BUILD "${CTEST_BINARY_DIRECTORY}"
RETURN_VALUE _build_rv
CAPTURE_CMAKE_ERROR _build_error
)
# Build log
file ( WRITE
"${OTB_SOURCE_DIR}/log/build_return_value_log.txt" "${_build_rv}")
file ( WRITE
"${OTB_SOURCE_DIR}/log/build_cmake_error_log.txt" "${_build_error}")
if ( NOT _build_rv EQUAL 0 )
message( SEND_ERROR "An error occurs during ctest_build.")
#don't execute tests as the build failed
set(ci_skip_testing 1)
endif()
# ----------------------------- Test -------------------------------------------
if(ci_skip_testing)
message(STATUS "Skip testing")
set(_test_rv 0)
else()
if (WIN32)
# since we are using powershell 7 on Windobe, these tests fails with non sense
# error.
# The two appTvDomain fails with "Program exited abnormally with exception type 1 : Access violation" error
# Three other test are in segfault
set(CTEST_CUSTOM_TESTS_IGNORE apTvDomainTransform_fft_shift_fwd
apTvDomainTransform_fft_inv
bfTvOverlapSaveConvolutionImageFilter
bfTvCompareOverlapSaveAndClassicalConvolutionWithGaborFilter
feTvForwardFourierMellinImageFilter)
endif()
ctest_test(PARALLEL_LEVEL 8
RETURN_VALUE _test_rv
CAPTURE_CMAKE_ERROR _test_error
)
# Test log
file ( WRITE
"${OTB_SOURCE_DIR}/log/test_return_value_log.txt" "${_test_rv}")
file ( WRITE
"${OTB_SOURCE_DIR}/log/test_cmake_error_log.txt" "${_test_error}")
endif()
if ( NOT _test_rv EQUAL 0 )
message( SEND_ERROR "An error occurs during ctest_test.")
endif()
# ----------------------------- Submit -----------------------------------------
if(ci_skip_submit)
message(STATUS "Skip submit")
else()
ctest_submit()
endif()
# ---------------------------- Doxygen -----------------------------------------
if(ENABLE_DOXYGEN)
ctest_build(BUILD "${CTEST_BINARY_DIRECTORY}"
TARGET Documentation
RETURN_VALUE _doxy_rv
CAPTURE_CMAKE_ERROR _doxy_error
)
endif()
#
# Copyright (C) 2005-2024 Centre National d'Etudes Spatiales (CNES)
#
# This file is part of Orfeo Toolbox
#
# https://www.orfeo-toolbox.org/
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
get_filename_component( OTB_SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}" DIRECTORY )
set( CMAKE_EXPORT_COMPILE_COMMANDS ON )
set( ci_build_type "Debug" )
set( CTEST_TEST_TIMEOUT 1500)
include( "${CMAKE_CURRENT_LIST_DIR}/main_superbuild.cmake" )
#
# Copyright (C) 2005-2024 Centre National d'Etudes Spatiales (CNES)
#
# This file is part of Orfeo Toolbox
#
# https://www.orfeo-toolbox.org/
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# This script is a prototype for the future CI, it may evolve rapidly in a near future
include( "${CMAKE_CURRENT_LIST_DIR}/macros.cmake" )
set (ENV{LANG} "C") # Only ascii output
get_filename_component(OTB_SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}" DIRECTORY)
set ( DEBUG "1" )
set (CMAKE_COMMAND "cmake")
# retrieve XDK
get_xdk()
if(WIN32)
file(TO_NATIVE_PATH "${XDK_INSTALL_PATH}" XDK_INSTALL_PATH_NATIVE)
file(TO_NATIVE_PATH "${CTEST_BINARY_DIRECTORY}/bin" OTB_BUILD_BIN_DIR_NATIVE)
set(ENV{PATH} "$ENV{PATH};${OTB_BUILD_BIN_DIR_NATIVE}" )
set(ENV{PATH} "${XDK_INSTALL_PATH_NATIVE}\\bin;$ENV{PATH}" )
set(ENV{PATH} "$ENV{PATH};${XDK_INSTALL_PATH_NATIVE}\\lib" )
set(ENV{GDAL_DATA} "${XDK_INSTALL_PATH_NATIVE}\\data" )
set(ENV{PROJ_LIB} "${XDK_INSTALL_PATH_NATIVE}\\share\\proj" )
set( CTEST_ENVIRONMENT
"PATH=$ENV{PATH}
GDAL_DATA=$ENV{GDAL_DATA}
PROJ_LIB=$ENV{PROJ_LIB}
")
else()
set(ENV{PATH} "${XDK_INSTALL_PATH}/lib:${XDK_INSTALL_PATH}/bin:$ENV{PATH}" )
set( GDAL_DATA "${XDK_INSTALL_PATH}/share/gdal" )
set( PROJ_LIB "${XDK_INSTALL_PATH}/share" )
set( CTEST_ENVIRONMENT
"PATH=$ENV{PATH}
")
endif()
include( "${CMAKE_CURRENT_LIST_DIR}/main_ci.cmake" )
#!/bin/bash
#
# Copyright (C) 2005-2024 Centre National d'Etudes Spatiales (CNES)
#
# This file is part of Orfeo Toolbox
#
# https://www.orfeo-toolbox.org/
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# usage : call CI/otb_coverage.sh from source dir
OTB_DIR="$(dirname "$0")/.."
OTB_DIR="$(readlink -f "$OTB_DIR")"
if [ -z "$BUILD_DIR" ]; then
BUILD_DIR="${OTB_DIR}"/build
fi
echo Generating gcov reports in "$BUILD_DIR" ...
cd "$BUILD_DIR" || exit
find "$BUILD_DIR" -name "*.gcda" -exec llvm-cov gcov -p '{}' > /dev/null \;
ls *.gcov | grep -E -v '#Modules#[a-zA-Z0-9]+#[a-zA-Z0-9]+#(include|src|app)#' | xargs -L 1 rm
echo Filtered "$(ls "$BUILD_DIR"/*.gcov | wc -l)" gcov reports
gcovr -r "$OTB_DIR" -x -g --gcov-ignore-parse-errors --object-directory="$BUILD_DIR" > "$BUILD_DIR"/coverage_report.xml
echo Generated "$BUILD_DIR"/coverage_report.xml with "$(grep -c '<class ' "$BUILD_DIR"/coverage_report.xml)" classes
#
# Copyright (C) 2005-2024 Centre National d'Etudes Spatiales (CNES)
#
# This file is part of Orfeo Toolbox
#
# https://www.orfeo-toolbox.org/
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# This script is for the superbuild build on the CI platform
include( "${CMAKE_CURRENT_LIST_DIR}/macros.cmake" )
set (ENV{LANG} "C") # Only ascii output
get_filename_component(OTB_SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR} DIRECTORY)
set ( SUPERBUILD_SOURCE_DIR "${OTB_SOURCE_DIR}/SuperBuild" )
set ( CTEST_BUILD_CONFIGURATION "Release" )
if(WIN32)
set ( CTEST_CMAKE_GENERATOR "NMake Makefiles JOM" )
set ( CTEST_BUILD_FLAGS "/S" )
else()
set ( CTEST_CMAKE_GENERATOR "Unix Makefiles" )
set ( CTEST_BUILD_FLAGS "-j16")
endif()
set ( PROJECT_SOURCE_DIR "${SUPERBUILD_SOURCE_DIR}" )
set ( CTEST_SOURCE_DIRECTORY "${SUPERBUILD_SOURCE_DIR}" )
set ( CTEST_BINARY_DIRECTORY "${OTB_SOURCE_DIR}/build/" )
# Detect site
if(NOT DEFINED IMAGE_NAME)
if(DEFINED ENV{IMAGE_NAME})
set(IMAGE_NAME $ENV{IMAGE_NAME})
endif()
endif()
set ( CTEST_SITE "${IMAGE_NAME}" )
# Find the build name and CI profile
set_dash_build_name()
# We need a directory independent from user
# in CI the architecture is /builds/user/otb
# So we will go in /builds/
# This is platform dependent, and the next step (build) also
# depends on that, as some paths are hardcoded
# This can be fixed with a packaging of OTB_DEPENDS
set (CTEST_INSTALL_DIRECTORY "${OTB_SOURCE_DIR}/xdk/")
# HACK
# This is needed because when using return() function ctest is trying
# to run the CTEST_COMMAND. And we need it to not produce an error
##set (CTEST_COMMAND "echo \"Exit\"") # HACK FIX ME
set (CMAKE_COMMAND "cmake")
if(WIN32)
file(TO_NATIVE_PATH "${CTEST_INSTALL_DIRECTORY}" XDK_INSTALL_DIR_NATIVE)
set(ENV{PATH} "${XDK_INSTALL_DIR_NATIVE}\\bin;$ENV{PATH}" )
set(ENV{PATH} "$ENV{PATH};${XDK_INSTALL_DIR_NATIVE}\\lib" )
# set(ENV{CMAKE_PREFIX_PATH} "${XDK_INSTALL_DIR}" )
endif()
########################################################################
########################################################################
# Build process
########################################################################
########################################################################
# Look for a GIT command-line client.
find_program(CTEST_GIT_COMMAND NAMES git git.cmd)
# FIXME: Replace ${GIT} variable with $[CTEST_GIT_COMMAND}"
set( GIT "${CTEST_GIT_COMMAND}" )
# Sources are already checked out : do nothing for update
set(CTEST_GIT_UPDATE_CUSTOM "${CMAKE_COMMAND}" "-E" "echo" "No update")
ctest_start (Experimental TRACK CI_Prepare)
ctest_update( SOURCE "${OTB_SOURCE_DIR}" )
set ( SB_CONFIGURE_OPTIONS "")
include( "${CMAKE_CURRENT_LIST_DIR}/sb_configure_options.cmake" )
ctest_configure(BUILD "${CTEST_BINARY_DIRECTORY}"
SOURCE "${SUPERBUILD_SOURCE_DIR}"
OPTIONS "${SB_CONFIGURE_OPTIONS}"
RETURN_VALUE _configure_rv
CAPTURE_CMAKE_ERROR _configure_error
)
if ( NOT _configure_rv EQUAL 0 )
ctest_submit()
message( FATAL_ERROR "An error occurs during ctest_configure. Dependencies might be buggy.")
endif()
########################################################################
########################################################################
# Check process
########################################################################
########################################################################
# Once that we have configure our build we can check if it exists a
# corresponding SB on superbuild-artifact
# How to get md5sum:
# * concatenate all source files in one
# * add configure result : CMakeCache.txt
####################################
file( GLOB_RECURSE sb_file_list "${OTB_SOURCE_DIR}/SuperBuild/*")
set( SB_TXT "${OTB_SOURCE_DIR}/full_sb.txt")
foreach(sb_file ${sb_file_list})
file(READ ${sb_file} CONTENTS)
file(APPEND ${SB_TXT} "${sb_file}${CONTENTS}")
endforeach(sb_file)
file(READ "${CTEST_BINARY_DIRECTORY}/CMakeCache.txt" CMAKE_ORIG)
file(APPEND ${SB_TXT} "CMakeCache.txt${CMAKE_ORIG}")
file ( MD5 "${SB_TXT}" SB_MD5)
message ( "SB_MD5 = ${SB_MD5}" )
file (REMOVE ${SB_TXT})
####################################
# checkout part
# we look for the right branch
# Branch name cannot have a ":"
# git ls-remote $REMOTE $BRANCH_NAME
####################################
file ( WRITE "${OTB_SOURCE_DIR}/sb_branch.txt" "${IMAGE_NAME}/${SB_MD5}")
message( "Checking out git for existence of archive")
set ( REMOTE "https://gitlab.orfeo-toolbox.org/orfeotoolbox/superbuild-artifact/")
set ( BRANCH_NAME "${IMAGE_NAME}/${SB_MD5}")
execute_process(
COMMAND ${GIT} "ls-remote" "${REMOTE}" "${BRANCH_NAME}"
OUTPUT_VARIABLE IS_SB_BUILD
)
if ( IS_SB_BUILD )
message( "Superbuild is already build for ${IMAGE_NAME} with sources as ${SB_MD5}")
else()
message( "No build available, this job will build and push OTB_DEPENDS")
####################################
# Back to build
ctest_build(BUILD "${CTEST_BINARY_DIRECTORY}"
TARGET "OTB_DEPENDS"
RETURN_VALUE _build_rv
NUMBER_ERRORS _build_nb_err
CAPTURE_CMAKE_ERROR _build_error
)
if ( DEBUG )
message( "Status for build:" )
message("_build_rv=${_build_rv}")
message("_build_nb_err=${_build_nb_err}")
message("_build_error=${_build_error}")
endif()
if ( ( NOT ${_build_nb_err} EQUAL 0 ) OR ( ${_build_error} EQUAL -1 ))
ctest_submit()
message( FATAL_ERROR "An error occurs during ctest_build.")
endif()
ctest_submit()
########################################################################
########################################################################
# Git process
########################################################################
########################################################################
# WE PUSH ONLY IF BUILD SUCCEED
# The image used will be passed to this script.
# TODO verify that images does not have forbidden char in there name
# TODO right now we rely on ctest_build to know whether there has been an error
# in build, whereas SuperBuild does not necessarily return an error if something
# goes wrong
set ( SB_ARTIFACT_GIT "${OTB_SOURCE_DIR}/superbuild-artifact" )
# REPOSITORY_GIT_URL and REMOTE would be the same. Right now there are
# different because one is https and one is ssh. Both should be ssh.
set( REPOSITORY_GIT_URL "git@gitlab.orfeo-toolbox.org:orfeotoolbox/superbuild-artifact.git")
# We clone master to have a basic configuration, mainly a correct .gitattribute
# git clone $REMOTE --branch master --depth 1 superbuild-artifact
execute_process(
COMMAND ${GIT} "clone" "${REPOSITORY_GIT_URL}"
"--branch" "master" "--depth" "1" "superbuild-artifact"
WORKING_DIRECTORY "${OTB_SOURCE_DIR}"
)
# create a branche
execute_process(
COMMAND ${GIT} "checkout" "-b" "${BRANCH_NAME}"
WORKING_DIRECTORY ${SB_ARTIFACT_GIT}
RESULT_VARIABLE co_res
OUTPUT_VARIABLE co_out
ERROR_VARIABLE co_err
)
if ( DEBUG )
message( "Step 4: check-o")
message( "co_res = ${co_res}" )
message( "co_out = ${co_out}" )
message( "co_err = ${co_err}" )
endif()
set ( SB_TAR_NAME "SuperBuild_Install.tar" )
# create the tar
# We need to create tar in its directory to avoid weird name in file
# "tar: Removing leading `../../' from member names"
# WARNING
# We are creating a tar containing xdk/.., so when extracting the archive in
# an other environment the output file will be xdk... Obvious isn't it?
# Well... Not for everyone...
# May be for easier maintainability the tar name should be the same as the
# file inside.
execute_process(
COMMAND ${CMAKE_COMMAND} "-E" "tar" "cf" "superbuild-artifact/${SB_TAR_NAME}"
-- "${CTEST_INSTALL_DIRECTORY}"
WORKING_DIRECTORY ${OTB_SOURCE_DIR}
)
# In a near futur it might be nice to clean up the mess we made...
if ( DEBUG )
if (EXISTS "${SB_ARTIFACT_GIT}/${SB_TAR_NAME}")
message("Tar file exists in superbuild_artefact at: ${SB_ARTIFACT_GIT}/${SB_TAR_NAME}")
else()
message("Tar file does not exist")
endif()
endif()
# add the file
execute_process(
COMMAND ${GIT} "add" "${SB_TAR_NAME}"
WORKING_DIRECTORY ${SB_ARTIFACT_GIT}
RESULT_VARIABLE add_res
OUTPUT_VARIABLE add_out
ERROR_VARIABLE add_err
)
if ( DEBUG )
message( "Step 5: add")
message( "add_res = ${add_res}" )
message( "add_out = ${add_out}" )
message( "add_err = ${add_err}" )
endif()
# commit
# We need the author because otherwise the mail is wrong
# In our case if toto is deploying a key in superbuild-artifact repo
# the the mail will be toto's
execute_process(
COMMAND ${GIT} "commit" "--author=\"otbbot <otbbot@orfeo-toolbox.org>\""
"-m" "\"New Superbuild for ${SB_MD5} on ${IMAGE_NAME}\""
WORKING_DIRECTORY ${SB_ARTIFACT_GIT}
RESULT_VARIABLE com_res
OUTPUT_VARIABLE com_out
ERROR_VARIABLE com_err
)
if ( DEBUG )
message( "Step 6: com")
message( "com_res = ${com_res}" )
message( "com_out = ${com_out}" )
message( "com_err = ${com_err}" )
endif()
# This part is just for debug
if ( DEBUG )
execute_process(
COMMAND ${GIT} "log" "-1"
WORKING_DIRECTORY ${SB_ARTIFACT_GIT}
RESULT_VARIABLE log_res
OUTPUT_VARIABLE log_out
ERROR_VARIABLE log_err
)
message( "Step 6bis: log")
message( "log_res = ${log_res}" )
message( "log_out = ${log_out}" )
message( "log_err = ${log_err}" )
endif()
# push
# we should be able to do a simple : git push origin $BRANCH_NAME
execute_process(
COMMAND ${GIT} "push" "${REPOSITORY_GIT_URL}" "${BRANCH_NAME}"
WORKING_DIRECTORY ${SB_ARTIFACT_GIT}
RESULT_VARIABLE push_res
OUTPUT_VARIABLE push_out
ERROR_VARIABLE push_err
)
if ( DEBUG )
message( "Step 7: push")
message( "push_res = ${push_res}" )
message( "push_out = ${push_out}" )
message( "push_err = ${push_err}" )
endif()
endif()
#
# Copyright (C) 2005-2024 Centre National d'Etudes Spatiales (CNES)
#
# This file is part of Orfeo Toolbox
#
# https://www.orfeo-toolbox.org/
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Configuration options for redhat 8
set(site_option
"OTB_BUILD_FeaturesExtraction:BOOL=ON
OTB_BUILD_Hyperspectral:BOOL=ON
OTB_BUILD_Learning:BOOL=ON
OTB_BUILD_Miscellaneous:BOOL=ON
OTB_BUILD_Remote:BOOL=ON
OTB_BUILD_SAR:BOOL=ON
OTB_BUILD_Segmentation:BOOL=ON
OTB_BUILD_StereoProcessing:BOOL=ON
OTB_USE_LIBSVM:BOOL=ON
OTB_USE_MUPARSER:BOOL=ON
OTB_USE_MUPARSERX:BOOL=ON
OTB_USE_OPENCV:BOOL=ON
OTB_USE_OPENMP:BOOL=OFF
OTB_USE_SHARK:BOOL=ON
USE_SYSTEM_OPENSSL:BOOL=ON
")
\ No newline at end of file
#
# Copyright (C) 2005-2024 Centre National d'Etudes Spatiales (CNES)
#
# This file is part of Orfeo Toolbox
#
# https://www.orfeo-toolbox.org/
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# For know OTB_DEPENDS is build with default value
set ( cmake_configure_option
"CMAKE_BUILD_TYPE=${CTEST_BUILD_CONFIGURATION}
CMAKE_INSTALL_PREFIX:PATH=${CTEST_INSTALL_DIRECTORY}")
if(WIN32)
set (cmake_configure_option
"${cmake_configure_option}
CMAKE_C_COMPILER_LAUNCHER=buildcache
CMAKE_CXX_COMPILER_LAUNCHER=buildcache")
endif()
set ( full_otb_options )
if(OTB_FULL_BUILD)
set(full_otb_options "OTB_BUILD_FeaturesExtraction:BOOL=ON
OTB_BUILD_Hyperspectral:BOOL=ON
OTB_BUILD_Learning:BOOL=ON
OTB_BUILD_Miscellaneous:BOOL=ON
OTB_BUILD_SAR:BOOL=ON
OTB_BUILD_Segmentation:BOOL=ON
OTB_BUILD_StereoProcessing:BOOL=ON"
)
endif()
set(concat_options
"${cmake_configure_option}
${full_otb_options}
")
#Transform the previous string in list
string (REPLACE "\n" ";" sb_options ${concat_options})
foreach(item ${sb_options})
set( SB_CONFIGURE_OPTIONS "${SB_CONFIGURE_OPTIONS}-D${item};")
endforeach(item)
#
# Copyright (C) 2005-2024 Centre National d'Etudes Spatiales (CNES)
#
# This file is part of Orfeo Toolbox
#
# https://www.orfeo-toolbox.org/
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
if ( $args.count -lt 1 ) {
echo "No arch"
echo "Usage: $0 <compiler_arch>"
echo " <compiler_arch> : 'x86' | 'x64'"
Break
}
$ARCH=$args[0]
$env:PATH="C:\tools\Python310-$ARCH;$env:PATH"
$env:PATH="C:\tools\Python310-$ARCH\Scripts;$env:PATH"
#
# Copyright (C) 2005-2024 Centre National d'Etudes Spatiales (CNES)
#
# This file is part of Orfeo Toolbox
#
# https://www.orfeo-toolbox.org/
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# We are included from main_superbuild.cmake
# This script is a prototype for the future CI, it may evolve rapidly in a near future
include( "${CMAKE_CURRENT_LIST_DIR}/macros.cmake" )
set (ENV{LANG} "C") # Only ascii output
get_filename_component( OTB_SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR} DIRECTORY )
if(WIN32)
file(TO_NATIVE_PATH "${XDK_INSTALL_PATH}" XDK_INSTALL_PATH_NATIVE)
file(TO_NATIVE_PATH "${CTEST_BINARY_DIRECTORY}/bin" OTB_BUILD_BIN_DIR_NATIVE)
set(ENV{PATH} "$ENV{PATH};${OTB_BUILD_BIN_DIR_NATIVE}" )
set(ENV{PATH} "${XDK_INSTALL_PATH_NATIVE}\\bin;$ENV{PATH}" )
set(ENV{PATH} "$ENV{PATH};${XDK_INSTALL_PATH_NATIVE}\\lib" )
set(ENV{GDAL_DATA} "${XDK_INSTALL_PATH_NATIVE}\\data" )
set(ENV{PROJ_LIB} "${XDK_INSTALL_PATH_NATIVE}\\share\\proj" )
set( CTEST_ENVIRONMENT
"PATH=$ENV{PATH}
GDAL_DATA=$ENV{GDAL_DATA}
PROJ_LIB=$ENV{PROJ_LIB}
")
else()
set(ENV{PATH} "${XDK_INSTALL_PATH}/lib:${XDK_INSTALL_PATH}/bin:$ENV{PATH}" )
set( GDAL_DATA "${XDK_INSTALL_PATH}/share/gdal" )
set( PROJ_LIB "${XDK_INSTALL_PATH}/share" )
set( CTEST_ENVIRONMENT
"PATH=$ENV{PATH}
")
endif()
set ( CTEST_BUILD_CONFIGURATION "Release" )
set ( CTEST_CMAKE_GENERATOR "Ninja" )
set ( CTEST_BUILD_FLAGS "-j1")
set ( CTEST_BUILD_NAME "Packages" )
# Detect site
if(NOT DEFINED IMAGE_NAME)
if(DEFINED ENV{IMAGE_NAME})
set(IMAGE_NAME $ENV{IMAGE_NAME})
endif()
endif()
set ( CTEST_SITE "${IMAGE_NAME}" )
# Find the build name and CI profile
set_dash_build_name()
# Directory variable
set ( CTEST_SOURCE_DIRECTORY "${OTB_SOURCE_DIR}" )
set ( CTEST_BINARY_DIRECTORY "${OTB_SOURCE_DIR}/build" )
set ( CTEST_INSTALL_DIRECTORY "${OTB_SOURCE_DIR}/install_packages" )
set ( PROJECT_SOURCE_DIR "${CTEST_SOURCE_DIRECTORY}" )
# Copy back xdk for RUN_PATH reason
# We might want to change the name of artifact in main_superbuild
# file ( COPY "${OTB_SOURCE_DIR}/install/xdk" DESTINATION "${CI_ROOT_DIR}")
# Packages case:
# SUPERBUILD_BINARY_DIR this is needed for OTB_BINARY_DIR, not sure we need it
# SUPERBUILD_INSTALL_DIR do we need it? it seems so... We will set it to anything
# DOWNLOAD_LOCATION
# OTB_BINARY_DIR
# CMAKE_INSTALL_PREFIX
set ( CONFIGURE_OPTIONS
"-DCMAKE_INSTALL_PREFIX=${CTEST_INSTALL_DIRECTORY};\
-DOTB_BINARY_DIR=${OTB_SOURCE_DIR}/build;\
-DXDK_INSTALL_PATH=${OTB_SOURCE_DIR}/xdk;\
-DNAME_SUFFIX=${NAME_SUFFIX};\
-DCPACK_ARCHIVE_COMPONENT_INSTALL=${PACKAGE_BY_MODULE}")
# Look for a GIT command-line client.
find_program(CTEST_GIT_COMMAND NAMES git git.cmd)
# Sources are already checked out : do nothing for update
set(CTEST_GIT_UPDATE_CUSTOM "${CMAKE_COMMAND}" "-E" "echo" "No update")
ctest_start( Experimental TRACK CI_Package )
ctest_update( SOURCE "${OTB_SOURCE_DIR}" )
ctest_configure(
BUILD "${CTEST_BINARY_DIRECTORY}"
SOURCE "${CTEST_SOURCE_DIRECTORY}"
OPTIONS "${CONFIGURE_OPTIONS}"
RETURN_VALUE _configure_rv
CAPTURE_CMAKE_ERROR _configure_error
)
if( NOT _configure_rv EQUAL 0 )
ctest_submit()
message( SEND_ERROR "An error occurs during ctest_configure.")
return()
endif()
ctest_build(
BUILD "${CTEST_BINARY_DIRECTORY}"
TARGET package
RETURN_VALUE _build_rv
CAPTURE_CMAKE_ERROR _build_error
)
if( NOT _build_rv EQUAL 0 )
message( SEND_ERROR "An error occurs during ctest_build.")
endif()
ctest_submit()
This folder aims at simulating a build directory. It contains the sub-durectory Testing with a Configure.xml file as the one generated by ctest.
<?xml version="1.0" encoding="UTF-8"?>
<Site BuildName="185_f-54sf_ghs-dgh (out_space)"
BuildStamp="20190320-1706-Experimental_test"
Name="debian-unstable-gcc.42"
Generator="ctest-3.13.4"
CompilerName=""
CompilerVersion=""
OSName="Linux"
Hostname="0e82a8db0490"
OSRelease="4.13.0-43-generic"
OSVersion="#48~16.04.1-Ubuntu SMP Thu May 17 12:56:46 UTC 2018"
OSPlatform="x86_64"
Is64Bits="1"
VendorString="GenuineIntel"
VendorID="Intel Corporation"
FamilyID="6"
ModelID="78"
ProcessorCacheSize="3072"
NumberOfLogicalCPU="4"
NumberOfPhysicalCPU="2"
TotalVirtualMemory="5720"
TotalPhysicalMemory="7858"
LogicalProcessorsPerPhysical="2"
ProcessorClockFrequency="1626.81"
>
<Configure>
<StartDateTime>Mar 20 17:06 UTC</StartDateTime>
<StartConfigureTime>1553101581</StartConfigureTime>
<ConfigureCommand>--</ConfigureCommand>
<Log>--</Log>
<ConfigureStatus>0</ConfigureStatus>
<EndDateTime>Mar 20 17:06 UTC</EndDateTime>
<EndConfigureTime>1553101601</EndConfigureTime>
<ElapsedMinutes>0</ElapsedMinutes>
</Configure>
</Site>
#!/usr/bin/env python3
#
# Copyright (C) 2005-2024 Centre National d'Etudes Spatiales (CNES)
#
# This file is part of Orfeo Toolbox
#
# https://www.orfeo-toolbox.org/
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
import unittest
import os.path
import sys
# This is done so we can access the module handler
synthetic_build_dir = os.path.dirname(os.path.realpath(__file__))
(module_path , _) = os.path.split(synthetic_build_dir)
sys.path.append(module_path)
import cdash_handler
class TestHandler(unittest.TestCase):
def test_GetConfigureFile (self):
handler = cdash_handler.Handler()
handler.build_dir = synthetic_build_dir
config_path = handler.GetConfigureFile()
self.assertTrue(os.path.exists(config_path))
def test_GetName (self):
handler = cdash_handler.Handler()
handler.build_dir = synthetic_build_dir
name = handler.GetName()
self.assertTrue("185_f-54sf_ghs-dgh (out_space)" == name)
def test_GetSite (self):
handler = cdash_handler.Handler()
handler.build_dir = synthetic_build_dir
site = handler.GetSite()
self.assertTrue("debian-unstable-gcc.42" == site)
def test_GetStamp (self):
handler = cdash_handler.Handler()
handler.build_dir = synthetic_build_dir
stamp = handler.GetStamp()
self.assertTrue("20190320-1706-Experimental_test" == stamp)
def test_GetBuildId (self):
handler = cdash_handler.Handler()
buildid= handler.GetBuildId( site="debian-unstable-gcc" ,\
stamp="20190319-1243-Experimental" , name="0388a356 (debian_CI)")
self.assertTrue( "1" == buildid )
def test_GetBuildUrl (self):
handler = cdash_handler.Handler()
url = handler.GetBuildUrl("1")
self.assertTrue( \
"https://cdash.orfeo-toolbox.org/buildSummary.php?buildid=1" == url)
def test_GetBuildStatus (self):
handler = cdash_handler.Handler()
# We need to test error in configure, build, test, and no error
# test buildid 720
(status , error) = handler.GetBuildStatus("720")
self.assertTrue( status == "failed")
self.assertTrue( error == "Errors occur during tests")
# configure buildid 352
(status , error) = handler.GetBuildStatus("352")
self.assertTrue( status == "failed")
self.assertTrue( error == "Errors occur during configure")
# build buildid 358
(status , error) = handler.GetBuildStatus("358")
self.assertTrue( status == "failed")
self.assertTrue( error == "Errors occur during build")
# passing buildid 373
(status , error) = handler.GetBuildStatus("373")
self.assertTrue( status == "success")
self.assertTrue( error == "")
if __name__ == '__main__':
unittest.main()