Skip to content
Permalink
Browse files

add perl to travis, run some tests

  • Loading branch information...
andy
andy committed Apr 4, 2019
1 parent 076701f commit e7a42a6fb509a3bec8effce58559cfc27c126a02
Showing with 73 additions and 3 deletions.
  1. +2 −2 .travis.yml
  2. +8 −1 Makefile
  3. +3 −0 mapscript/perl/CMakeLists.txt
  4. +60 −0 mapscript/perl/tests/0-load.t
@@ -52,7 +52,7 @@ before_install:
- sudo apt-get remove postgresql*
- sudo add-apt-repository -y ppa:ubuntugis/ubuntugis-unstable
- sudo apt-get update
- sudo apt-get install --allow-unauthenticated protobuf-c-compiler libprotobuf-c0-dev bison flex python-lxml libfribidi-dev swig cmake librsvg2-dev colordiff libpq-dev libpng12-dev libjpeg-dev libgif-dev libgeos-dev libgd2-xpm-dev libfreetype6-dev libfcgi-dev libcurl4-gnutls-dev libcairo2-dev libgdal1-dev libproj-dev libxml2-dev python-dev libexempi-dev lcov lftp postgis libharfbuzz-dev gdal-bin
- sudo apt-get install --allow-unauthenticated protobuf-c-compiler libprotobuf-c0-dev bison flex python-lxml libfribidi-dev swig cmake librsvg2-dev colordiff libpq-dev libpng12-dev libjpeg-dev libgif-dev libgeos-dev libgd2-xpm-dev libfreetype6-dev libfcgi-dev libcurl4-gnutls-dev libcairo2-dev libgdal1-dev libproj-dev libxml2-dev python-dev libexempi-dev lcov lftp postgis libharfbuzz-dev gdal-bin libperl-dev
- sudo apt-get install --allow-unauthenticated libmono-system-drawing4.0-cil mono-mcs
- sudo apt-get install --allow-unauthenticated php5-dev || sudo apt-get install --allow-unauthenticated php7-dev
- sudo pip install git+git://github.com/tbonfort/cpp-coveralls.git@extensions
@@ -66,7 +66,7 @@ before_install:

script:
- make cmakebuild
- make mspython-wheel
- make mspython-wheel
- make -j4 test

after_success:
@@ -3,12 +3,13 @@ PHP_MAPSCRIPT=build/mapscript/php/php_mapscript.so
PYTHON_MAPSCRIPT_PATH=build/mapscript/python
JAVA_MAPSCRIPT_PATH=build/mapscript/java
CSHARP_MAPSCRIPT_PATH=build/mapscript/csharp
PERL_MAPSCRIPT_PATH=build/mapscript/perl
BUILDPATH=../../build
FLEX=flex
YACC=yacc
CMAKEFLAGS=-DCMAKE_C_FLAGS="--coverage" -DCMAKE_CXX_FLAGS="--coverage" \
-DCMAKE_SHARED_LINKER_FLAGS="-lgcov" -DWITH_CLIENT_WMS=1 \
-DWITH_CLIENT_WFS=1 -DWITH_KML=1 -DWITH_SOS=1 -DWITH_CSHARP=1 -DWITH_PHP=1 \
-DWITH_CLIENT_WFS=1 -DWITH_KML=1 -DWITH_SOS=1 -DWITH_CSHARP=1 -DWITH_PHP=1 DWITH_PERL=1 \
-DWITH_PYTHON=1 -DWITH_JAVA=1 -DWITH_THREAD_SAFETY=1 -DWITH_FRIBIDI=1 -DWITH_FCGI=0 -DWITH_EXEMPI=1 \
-DCMAKE_BUILD_TYPE=Release -DWITH_RSVG=1 -DWITH_CURL=1 -DWITH_HARFBUZZ=1 -DWITH_POINT_Z_M=1
all: cmakebuild
@@ -50,11 +51,17 @@ java-testcase:
csharp-testcase:
test -d "$(CSHARP_MAPSCRIPT_PATH)" && (export CSHARP_MAPSCRIPT_SO="../../$(CSHARP_MAPSCRIPT_PATH)" && cd mapscript/csharp && ./run_test.sh)

perl-testcase:
cd "$(PERL_MAPSCRIPT_PATH)" \
&& prove tests \
&& perl examples/RFC24.pl ../../../tests/test.map

test: cmakebuild
@$(MAKE) $(MFLAGS) wxs-testcase renderers-testcase misc-testcase gdal-testcase query-testcase mspython-testcase
@./print-test-results.sh
@$(MAKE) $(MFLAGS) php-testcase
@$(MAKE) $(MFLAGS) csharp-testcase
@$(MAKE) $(MFLAGS) perl-testcase


lexer: maplexer.c
@@ -25,3 +25,6 @@ endif(APPLE)

install(FILES $<TARGET_FILE:${SWIG_MODULE_perlmapscript_REAL_NAME}> DESTINATION ${CUSTOM_PERL_SITE_ARCH_DIR}/auto/mapscript)
install(FILES $<TARGET_FILE_DIR:${SWIG_MODULE_perlmapscript_REAL_NAME}>/mapscript.pm DESTINATION ${CUSTOM_PERL_SITE_ARCH_DIR})

file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/tests DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/examples DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
@@ -0,0 +1,60 @@
#!/usr/bin/perl
use strict;
use warnings;
use Test::More tests => 11;
use File::Spec;

sub msHas
{
my ($mod) = @_;
my $ver = mapscript::msGetVersion();
if (index($ver, $mod) > -1) {
return 1;
} else {
return 0;
}
}

require_ok( 'mapscript' );
diag("Testing: " . $INC{'mapscript.pm'});
diag( mapscript::msGetVersion() );

SKIP: {
skip "no geos support", 10 unless msHas('SUPPORTS=GEOS');
my @wkt_list = (
'POINT (5.0000000000000000 7.0000000000000000)',
'LINESTRING (5.0000000000000000 7.0000000000000000, 7.0000000000000000 9.0000000000000000, 9.0000000000000000 -1.0000000000000000)',
'POLYGON ((500.0000000000000000 500.0000000000000000, 3500.0000000000000000 500.0000000000000000, 3500.0000000000000000 2500.0000000000000000, 500.0000000000000000 2500.0000000000000000, 500.0000000000000000 500.0000000000000000), (1000.0000000000000000 1000.0000000000000000, 1000.0000000000000000 1500.0000000000000000, 1500.0000000000000000 1500.0000000000000000, 1500.0000000000000000 1000.0000000000000000, 1000.0000000000000000 1000.0000000000000000))',
'MULTIPOINT (2000.0000000000000000 2000.0000000000000000, 2000.0000000000000000 1900.0000000000000000)',
'MULTILINESTRING ((600.0000000000000000 1500.0000000000000000, 1600.0000000000000000 2500.0000000000000000), (700.0000000000000000 1500.0000000000000000, 1700.0000000000000000 2500.0000000000000000))'
);

for my $orig (@wkt_list)
{
my $shp = mapscript::shapeObj::fromWKT( $orig );
ok( $shp, 'create shapeObj');
my $new_wkt = $shp->toWKT();
ok( $orig eq $new_wkt, 'from WKT <> toWKT' );
}
};

=pod
my $map = new mapscript::mapObj( "../mspython/test_mapio.map" );
mapscript::msIO_installStdoutToBuffer();
my $owreq = new mapscript::OWSRequest();
$owreq->loadParamsFromURL('service=WMS&version=1.1.1&request=GetMap&layers=grey&srs=EPSG:4326&bbox=-180,-90,180,90&format=image/png&width=80&height=40')
my $err = $map->OWSDispatch( $owreq );
ok($err == 0, 'OWSDispatch');
# warn(mapscript::msGetErrorString("\n"));
my $content_type = mapscript::msIO_stripStdoutBufferContentType();
$x = mapscript::msIO_getStdoutBufferBytes();
mapscript::msIO_resetHandlers();
$res->status(200);
$res->content_type($content_type);
$res->body($$x);
=cut

0 comments on commit e7a42a6

Please sign in to comment.
You can’t perform that action at this time.