Skip to content

Commit

Permalink
Merge pull request #1903 from avancinirodrigo/master
Browse files Browse the repository at this point in the history
Solving issues varied
  • Loading branch information
pedro-andrade-inpe authored Jul 14, 2017
2 parents 5b5d0fa + 53685bb commit 3a9371b
Show file tree
Hide file tree
Showing 95 changed files with 1,841 additions and 2,183 deletions.
2 changes: 1 addition & 1 deletion build/scripts/linux/terrame-conf.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ set(TERRALIB_DIR "$ENV{_TERRALIB_MODULES_DIR}" CACHE PATH "TerraLib directory" F
set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type" FORCE)
set(CMAKE_INSTALL_PREFIX "$ENV{_TERRAME_INSTALL_PATH}" CACHE PATH "Where to install TerraME?" FORCE)
set(CMAKE_PREFIX_PATH "${TERRALIB_3RDPARTY_DIR};${Qt5_DIR};${TERRAME_DEPENDENCIES_DIR}" CACHE PATH "Where are the dependencies of TerraME?" FORCE)
set(TERRAME_VERSION_STATUS "rc4-dev" CACHE STRING "Define name of installer" FORCE)
set(TERRAME_VERSION_STATUS "rc4" CACHE STRING "Define name of installer" FORCE)
set(TERRAME_BUILD_AS_BUNDLE $ENV{_TERRAME_BUILD_AS_BUNDLE} CACHE BOOL "If on, tells that the build will generate a bundle" FORCE)
set(TERRAME_CREATE_INSTALLER $ENV{_TERRAME_CREATE_INSTALLER} CACHE BOOL "Create the installer" FORCE)

Expand Down
2 changes: 1 addition & 1 deletion build/scripts/mac/terrame-conf.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ set(TERRALIB_DIR "$ENV{_TERRALIB_MODULES_DIR}" CACHE PATH "TerraLib directory" F
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Build type" FORCE)
set(CMAKE_INSTALL_PREFIX "$ENV{_TERRAME_INSTALL_PATH}" CACHE PATH "Where to install TerraME?" FORCE)
set(CMAKE_PREFIX_PATH "${TERRALIB_3RDPARTY_DIR};${Qt5_DIR};${TERRAME_DEPENDENCIES_DIR}" CACHE PATH "Where are the dependencies of TerraME?" FORCE)
set(TERRAME_VERSION_STATUS "rc4-dev" CACHE STRING "Define name of installer" FORCE)
set(TERRAME_VERSION_STATUS "rc4" CACHE STRING "Define name of installer" FORCE)
set(TERRAME_BUILD_AS_BUNDLE $ENV{_TERRAME_BUILD_AS_BUNDLE} CACHE BOOL "If on, tells that the build will generate a bundle" FORCE)
set(TERRAME_CREATE_INSTALLER $ENV{_TERRAME_CREATE_INSTALLER} CACHE BOOL "Create the installer" FORCE)

Expand Down
2 changes: 1 addition & 1 deletion build/scripts/win/terrame-conf.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
set(CMAKE_BUILD_TYPE "Release" CACHE PATH "Build Type" FORCE)
set(CMAKE_INSTALL_PREFIX "$ENV{_TERRAME_INSTALL_PATH}" CACHE PATH "Where to install TerraME?" FORCE)
set(CMAKE_PREFIX_PATH "$ENV{_TERRALIB_3RDPARTY_DIR};$ENV{_Qt5_DIR}/lib/cmake;$ENV{_TERRAME_DEPENDS_DIR};$ENV{_MSYS_DIR}" CACHE PATH "Where are the dependencies of TerraME?" FORCE)
set(TERRAME_VERSION_STATUS "rc4-dev" CACHE STRING "Define name of installer" FORCE)
set(TERRAME_VERSION_STATUS "rc4" CACHE STRING "Define name of installer" FORCE)

set(TERRAME_BUILD_AS_BUNDLE $ENV{_TERRAME_BUILD_AS_BUNDLE} CACHE BOOL "If on, tells that the build will generate a bundle" FORCE)
set(TERRAME_CREATE_INSTALLER $ENV{_TERRAME_CREATE_INSTALLER} CACHE BOOL "Create the installer" FORCE)
Expand Down
4 changes: 2 additions & 2 deletions jenkins/linux/terrame-3rdparty-linux-ubuntu-14.04.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@
#

if [ -z "$_TERRALIB_TARGET_3RDPARTY_DIR" ]; then
export _TERRALIB_TARGET_3RDPARTY_DIR="$HOME/MyDevel/terrame/daily/terralib/3rdparty/5.2"
export _TERRALIB_TARGET_3RDPARTY_DIR="$HOME/MyDevel/terrame/terralib/3rdparty/5.2"
fi

if [ -z "$_TERRAME_TARGET_3RDPARTY_DIR" ]; then
export _TERRAME_TARGET_3RDPARTY_DIR="$HOME/MyDevel/terrame/daily/terrame/3rdparty"
export _TERRAME_TARGET_3RDPARTY_DIR="$HOME/MyDevel/terrame/3rdparty"
fi

if [ -z "$_TERRALIB_3RDPARTY_NAME" ]; then
Expand Down
4 changes: 1 addition & 3 deletions jenkins/linux/terrame-build-linux-ubuntu-14.04.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,14 @@
# indirect, special, incidental, or consequential damages arising out of the use
# of this software and its documentation.

#
#
## It performs TerraME compilation. It does not create installer or even build as bundle.
#
## USAGE:
## ./terrame-build-linux-ubuntu-14.04.sh
##
#

cd $_TERRAME_BUILD_BASE/solution

# Turning OFF installer flags
export _TERRAME_CREATE_INSTALLER="OFF"
export _TERRAME_BUILD_AS_BUNDLE="OFF"
Expand Down
6 changes: 2 additions & 4 deletions jenkins/linux/terrame-code-analysis-linux-ubuntu-14.04.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
# indirect, special, incidental, or consequential damages arising out of the use
# of this software and its documentation.

#
## It performs a TerraME code analysis of any package. For TerraME purporses, "base" and "gis" internal packages.
#
## It performs a TerraME code analysis of any package. For TerraME purporses, "base" and "gis" internal packages.
## It may be useful for TerraME external packages.
#
## USAGE:
Expand All @@ -38,8 +38,6 @@ export TME_PATH="$_TERRAME_INSTALL_PATH/bin"
export PATH=$PATH:$TME_PATH
export LD_LIBRARY_PATH=$TME_PATH

cd $_TERRAME_TEST_DIR

# TerraME command arguments. Used for packages like "gis", "sci", "calibration" etc.
TERRAME_COMMANDS=""
terrame -version
Expand Down
2 changes: 0 additions & 2 deletions jenkins/linux/terrame-doc-linux-ubuntu-14.04.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ export TME_PATH=$_TERRAME_INSTALL_PATH/bin
export PATH=$PATH:$TME_PATH
export LD_LIBRARY_PATH=$TME_PATH

cd $_TERRAME_TEST_DIR

TERRAME_COMMANDS=""
terrame -version
if [ "$1" != "" ] && [ "$1" != "base" ]; then
Expand Down
4 changes: 1 addition & 3 deletions jenkins/linux/terrame-installer-linux-ubuntu-14.04.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
# indirect, special, incidental, or consequential damages arising out of the use
# of this software and its documentation.

#
#
## It performs a TerraME Installer generation
#
## USAGE:
Expand All @@ -32,8 +32,6 @@
export _TERRAME_CREATE_INSTALLER="ON"
export _TERRAME_BUILD_AS_BUNDLE="OFF"

cd $_TERRAME_OUT_DIR/..

# Copying Generated documentation to Git directory
cp -rap $_TERRAME_INSTALL_PATH/bin/packages/base/doc $_TERRAME_GIT_DIR/packages/base/doc
cp -rap $_TERRAME_INSTALL_PATH/bin/packages/gis/doc $_TERRAME_GIT_DIR/packages/gis/doc
Expand Down
4 changes: 1 addition & 3 deletions jenkins/linux/terrame-repository-test-linux-ubuntu-14.04.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
# indirect, special, incidental, or consequential damages arising out of the use
# of this software and its documentation.

#
#
## It performs a TerraME Repository Tests.
#
## USAGE:
Expand All @@ -33,8 +33,6 @@ export TME_PATH="$_TERRAME_INSTALL_PATH/bin"
export PATH=$PATH:$TME_PATH
export LD_LIBRARY_PATH=$TME_PATH

cd $_TERRAME_REPOSITORY_DIR

terrame -version
terrame -color test.lua 2> /dev/null

Expand Down
64 changes: 37 additions & 27 deletions jenkins/linux/terrame-terralib-build-linux-ubuntu-14.04.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
# indirect, special, incidental, or consequential damages arising out of the use
# of this software and its documentation.

#
#
## It prepares a entire TerraME build process. Firstly, it prepares environment, cloning both TerraME and TerraLib.
## After that, It copies required scripts to respective folders. Once done, it compiles TerraLib.
#
Expand All @@ -42,47 +42,57 @@
## ./terrame-terralib-build-linux-ubuntu-14.04.sh
#

# Constants
_TERRALIB_BRANCH=release-5.2
# # Constants
# _TERRALIB_BRANCH=release-5.2

# Removing TerraLib Mod Binding Lua in order to re-generate folder if there is
rm -rf $_TERRALIB_OUT_DIR/terralib_mod_binding_lua $_TERRALIB_INSTALL_PATH $_TERRAME_GIT_DIR $_TERRAME_BUILD_BASE/solution
rm -rf $_TERRAME_REPOSITORY_DIR $_TERRAME_TEST_DIR $_TERRAME_EXECUTION_DIR
# # Removing TerraLib Mod Binding Lua in order to re-generate folder if there is
# rm -rf $_TERRALIB_OUT_DIR/terralib_mod_binding_lua $_TERRALIB_INSTALL_PATH $_TERRAME_GIT_DIR $_TERRAME_BUILD_BASE/solution
# rm -rf $_TERRAME_REPOSITORY_DIR $_TERRAME_TEST_DIR $_TERRAME_EXECUTION_DIR

echo "### TerraME ###"
# Identifying when PR to clone respective changes
if [ ! -z "$ghprbActualCommit" ]; then
mkdir -p $_TERRAME_GIT_DIR
cd $_TERRAME_GIT_DIR
git init
git config remote.origin.url https://github.com/terrame/terrame.git
git fetch --tags --progress https://github.com/TerraME/terrame.git +refs/pull/*:refs/remotes/origin/pr/* --quiet > /dev/null
git checkout -f $ghprbActualCommit --quiet > /dev/null
cd -
else
# Just clone
git clone https://github.com/terrame/terrame.git $_TERRAME_GIT_DIR --quiet
rm -rf $_TERRALIB_GIT_DIR $_TERRALIB_BUILD_BASE/solution
fi
# echo "### TerraME ###"
# # Identifying when PR to clone respective changes
# if [ ! -z "$ghprbActualCommit" ]; then
# mkdir -p $_TERRAME_GIT_DIR
# cd $_TERRAME_GIT_DIR
# git init
# git config remote.origin.url https://github.com/TerraME/terrame.git
# git fetch --tags https://github.com/TerraME/terrame.git +refs/pull/*:refs/remotes/origin/pr/* --quiet > /dev/null
# git checkout -f $ghprbActualCommit --quiet > /dev/null
# cd -
# else
# # Just clone
# git clone https://github.com/terrame/terrame.git $_TERRAME_GIT_DIR --quiet
# rm -rf $_TERRALIB_GIT_DIR $_TERRALIB_BUILD_BASE/solution/*
# mkdir $_TERRALIB_GIT_DIR
# fi

echo "### TerraLib ###"
git clone -b $_TERRALIB_BRANCH https://gitlab.dpi.inpe.br/rodrigo.avancini/terralib.git $_TERRALIB_GIT_DIR --quiet

# Creating TerraME Test folders and TerraLib solution
mkdir $_TERRAME_REPOSITORY_DIR $_TERRAME_TEST_DIR $_TERRAME_EXECUTION_DIR $_TERRALIB_BUILD_BASE/solution $_TERRAME_BUILD_BASE/solution
mkdir $_TERRAME_REPOSITORY_DIR $_TERRAME_TEST_DIR $_TERRAME_EXECUTION_DIR $_TERRAME_BUILD_BASE/solution

cd $_TERRALIB_BUILD_BASE/solution
# Copying TerraLib compilation scripts to TerraLib Solution folder
cp --verbose $_TERRAME_GIT_DIR/build/scripts/linux/terralib-conf.* $_TERRALIB_BUILD_BASE/solution

# Copying TerraME Git Repository to Test Repository Folder
cp -r $_TERRAME_GIT_DIR/repository/* $_TERRAME_REPOSITORY_DIR
cp $_TERRAME_GIT_DIR/jenkins/linux/terrame-repository-test-linux-ubuntu-14.04.sh $_TERRAME_REPOSITORY_DIR

# Copying TerraME Git Test Execution to Test Execution Folder
cp -r $_TERRAME_GIT_DIR/test/* $_TERRAME_EXECUTION_DIR
cp $_TERRAME_GIT_DIR/jenkins/linux/terrame-test-execution-linux-ubuntu-14.04.sh $_TERRAME_EXECUTION_DIR

# Copying TerraME test and config file to Test folder
cp $_TERRAME_GIT_DIR/jenkins/all/*.lua $_TERRAME_TEST_DIR
# Copying TerraME TerraLib compilation scripts to TerraLib solution folder
cp $_TERRAME_GIT_DIR/build/scripts/linux/terralib-conf.* .
cp --verbose $_TERRAME_GIT_DIR/jenkins/all/*.lua $_TERRAME_TEST_DIR
cp --verbose $_TERRAME_GIT_DIR/jenkins/linux/terrame-unittest-linux-ubuntu-14.04.sh $_TERRAME_TEST_DIR
cp --verbose $_TERRAME_GIT_DIR/jenkins/linux/terrame-code-analysis-linux-ubuntu-14.04.sh $_TERRAME_TEST_DIR
cp --verbose $_TERRAME_GIT_DIR/jenkins/linux/terrame-doc-linux-ubuntu-14.04.sh $_TERRAME_TEST_DIR
cp --verbose $_TERRAME_GIT_DIR/jenkins/linux/terrame-syntaxcheck-cpp-linux-ubuntu-14.04.sh $_TERRAME_TEST_DIR

# Copying TerraME compilation scripts to TerraME Solution folder
cp $_TERRAME_GIT_DIR/build/scripts/linux/terrame-conf.* $_TERRAME_BUILD_BASE/solution
cp --verbose $_TERRAME_GIT_DIR/build/scripts/linux/terrame-conf.* $_TERRAME_BUILD_BASE/solution
cp --verbose $_TERRAME_GIT_DIR/jenkins/linux/terrame-build-linux-ubuntu-14.04.sh $_TERRAME_BUILD_BASE/solution

# Compile TerraLib
./terralib-conf.sh
Expand Down
5 changes: 1 addition & 4 deletions jenkins/linux/terrame-test-execution-linux-ubuntu-14.04.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
# indirect, special, incidental, or consequential damages arising out of the use
# of this software and its documentation.

#
#
## It performs a TerraME test execution.
#
## USAGE:
Expand All @@ -34,9 +34,6 @@ export TME_PATH=$_TERRAME_INSTALL_PATH/bin
export PATH=$PATH:$TME_PATH
export LD_LIBRARY_PATH=$TME_PATH

# Copying TerraME configuration
cd $_TERRAME_EXECUTION_DIR

terrame -version
terrame -color run.lua 2> /dev/null
RESULT=$?
Expand Down
16 changes: 7 additions & 9 deletions jenkins/linux/terrame-unittest-linux-ubuntu-14.04.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
# indirect, special, incidental, or consequential damages arising out of the use
# of this software and its documentation.

#
## It performs a TerraME functional test of any package. For TerraME purporses, "base" and "gis" internal packages.
#
## It performs a TerraME functional test of any package. For TerraME purporses, "base" and "gis" internal packages.
## It may be useful for TerraME external packages.
#
## USAGE:
Expand All @@ -38,10 +38,6 @@ export TME_PATH=$_TERRAME_INSTALL_PATH/bin
export PATH=$PATH:$TME_PATH
export LD_LIBRARY_PATH=$TME_PATH

cd $_TERRAME_TEST_DIR

terrame -version

# You may use $ghprbActualCommit for handling if job has triggered by CI event or daily timer.
# In this way, if you need a specific configuration for CI execution, use this flag
#
Expand All @@ -57,14 +53,16 @@ terrame -version
# # CI execution config
# fi

terrame -version

TERRAME_COMMANDS=""
# Extra commands if package is gis
if [ "$1" != "" ] && [ "$1" != "base" ]; then
TERRAME_COMMANDS="-package $1"
# if [ ! -z "$ghprbActualCommit" ]; then
# if [ ! -z "$ghprbActualCommit" ]; then
# # Temp code to ensure unittest gis does not take too long to execute. Only CI trigger
# echo -e '\ndirectory = {"functional", "shapefile", "postgis", "tif", "geojson", "asc", "wms", "nc"}' >> test.lua
# fi
# echo -e '\ndirectory = {"functional", "shapefile", "postgis", "tif", "geojson", "asc", "wms", "nc"}' > test.lua
# fi
fi

# Executing unittest
Expand Down
6 changes: 2 additions & 4 deletions packages/base/lua/CellularSpace.lua
Original file line number Diff line number Diff line change
Expand Up @@ -969,16 +969,14 @@ CellularSpace_ = {
positiveTableArgument(data, "m")

if data.m % 2 == 0 then
data.m = data.m + 1
customWarning("Argument 'm' is even. It will be increased by one to keep the Cell in the center of the Neighborhood.")
customError("Value or argument 'm' should be even, got "..data.m..".")
end

defaultTableValue(data, "n", data.m)
integerTableArgument(data, "n")
positiveTableArgument(data, "n")
if data.n % 2 == 0 then
data.n = data.n + 1
customWarning("Argument 'n' is even. It will be increased by one to keep the Cell in the center of the Neighborhood.")
customError("Value or argument 'n' should be even, got "..data.n..".")
end

data.func = getMxNNeighborhood
Expand Down
12 changes: 2 additions & 10 deletions packages/base/tests/database/alternative/Cell.lua
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,13 @@ return{
title = title
}

local customWarningBkp = customWarning
customWarning = function(msg)
return msg
end

local layerName1 = "Brazil"

gis.Layer{
project = proj,
name = layerName1,
file = filePath("brazilstates.shp", "base")
file = filePath("brazilstates.shp", "base"),
epsg = 4326
}

-- SHAPE
Expand Down Expand Up @@ -80,7 +76,6 @@ return{

-- POSTGIS
local clName2 = "Brazil_Cells_PG"
local user = "postgres"
local password = getConfig().password
local database = "postgis_22_sample"

Expand All @@ -90,7 +85,6 @@ return{
input = layerName1,
name = clName2,
resolution = 100e3,
user = user,
password = password,
database = database,
clean = true
Expand All @@ -111,7 +105,5 @@ return{
File(filePath1):deleteIfExists()

pgLayer:delete()

customWarning = customWarningBkp
end
}
24 changes: 0 additions & 24 deletions packages/base/tests/database/alternative/CellularSpace.lua
Original file line number Diff line number Diff line change
Expand Up @@ -64,24 +64,6 @@ return{

unitTest:assertError(error_func, "File '"..pgmFile.."' does not contain the PGM identifier 'P2' in its first line.")

pgmFile = filePath("test/error/pgm-invalid-size.pgm", "base")
error_func = function()
CellularSpace{
file = pgmFile
}
end

unitTest:assertWarning(error_func, "Data from file '"..pgmFile.."' does not match declared size: expected '(2, 2)', got '(10, 10)'.")

pgmFile = filePath("test/error/pgm-invalid-max.pgm", "base")
error_func = function()
CellularSpace{
file = pgmFile
}
end

unitTest:assertWarning(error_func, "File '"..pgmFile.."' does not have a maximum value declared.")

error_func = function()
cs = CellularSpace{file = 2, source = "pgm", sep = ";"}
end
Expand Down Expand Up @@ -265,12 +247,6 @@ return{
file = filePath("brazilstates.shp")
}

error_func = function()
cs:loadNeighborhood{file = filePath("test/brazil-ok.gal"), che = false}
end

unitTest:assertWarning(error_func, unnecessaryArgumentMsg("che"))

mfile = filePath("test/brazil.gal")

error_func = function()
Expand Down
Loading

0 comments on commit 3a9371b

Please sign in to comment.