Skip to content

Commit

Permalink
CI: test mapserv as a CGI and FastCGI binary
Browse files Browse the repository at this point in the history
  • Loading branch information
rouault committed Apr 14, 2021
1 parent ba2211f commit 9ed37f2
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 4 deletions.
56 changes: 56 additions & 0 deletions .github/workflows/start.sh
Expand Up @@ -40,3 +40,59 @@ cd "$WORK_DIR"

ci/travis/before_install.sh
ci/travis/script.sh

#####################################
# Test MapServer as CGI and FastCGI #
#####################################

make cmakebuild_nocoverage MFLAGS="-j${nproc}"

ln -s mapserv /tmp/install-mapserver/bin/mapserv.cgi
ln -s mapserv /tmp/install-mapserver/bin/mapserv.fcgi

DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends apache2 libapache2-mod-fcgid
a2enmod fcgid cgid
a2disconf serve-cgi-bin
a2dissite 000-default

echo "ServerName www.example.com" > /etc/apache2/conf-available/servername.conf
a2enconf servername

cat <<EOF >/etc/apache2/sites-available/001-mapserver.conf
<VirtualHost *:80>
ErrorLog \${APACHE_LOG_DIR}/mapserv-error.log
CustomLog \${APACHE_LOG_DIR}/mapserv-access.log combined
ScriptAlias /cgi-bin/ "/tmp/install-mapserver/bin/"
<Directory "/tmp/install-mapserver/bin">
AddHandler fcgid-script .fcgi
AddHandler cgi-script .cgi
AllowOverride All
Options +ExecCGI -MultiViews +FollowSymLinks
Order Allow,Deny
Allow from all
Require all granted
</Directory>
</VirtualHost>
EOF

a2ensite 001-mapserver

service apache2 restart

# Prepare mapfile and related resources
cat msautotest/wxs/wfs_simple.map | sed "s/\.\/data\/epsg2/\/tmp\/data\/epsg2/" | sed "s/SHAPEPATH \.\/data/SHAPEPATH \/tmp\/data/" | sed "s/ etc/ \/tmp\/etc/" > /tmp/wfs_simple.map
cp -r $WORK_DIR/msautotest/wxs/data /tmp
cp -r $WORK_DIR/msautotest/wxs/etc /tmp

# CGI
curl -s "http://localhost/cgi-bin/mapserv.cgi?MAP=/tmp/wfs_simple.map&SERVICE=WFS&REQUEST=GetCapabilities" > /tmp/res.xml
cat /tmp/res.xml | grep wfs:WFS_Capabilities >/dev/null || (cat /tmp/res.xml && /bin/false)

# Fast CGI
curl -s "http://localhost/cgi-bin/mapserv.fcgi?MAP=/tmp/wfs_simple.map&SERVICE=WFS&REQUEST=GetCapabilities" > /tmp/res.xml
cat /tmp/res.xml | grep wfs:WFS_Capabilities >/dev/null || (cat /tmp/res.xml && /bin/false)

# Again
curl -s "http://localhost/cgi-bin/mapserv.fcgi?MAP=/tmp/wfs_simple.map&SERVICE=WFS&REQUEST=GetCapabilities" > /tmp/res.xml
cat /tmp/res.xml | grep wfs:WFS_Capabilities >/dev/null || (cat /tmp/res.xml && /bin/false)
15 changes: 11 additions & 4 deletions Makefile
Expand Up @@ -7,17 +7,24 @@ PERL_MAPSCRIPT_PATH=build/mapscript/perl
BUILDPATH=../../build
FLEX=flex
YACC=yacc
CMAKEFLAGS=-DCMAKE_C_FLAGS="--coverage ${CMAKE_C_FLAGS}" -DCMAKE_CXX_FLAGS="--coverage ${CMAKE_CXX_FLAGS}" \
-DCMAKE_SHARED_LINKER_FLAGS="-lgcov" -DWITH_CLIENT_WMS=1 \
CMAKEFLAGS_NOCOVERAGE=-DWITH_CLIENT_WMS=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_MSSQL2008=ON ${EXTRA_CMAKEFLAGS} -DLIBMAPSERVER_EXTRA_FLAGS="${LIBMAPSERVER_EXTRA_FLAGS}"
-DWITH_PYTHON=1 -DWITH_JAVA=1 -DWITH_THREAD_SAFETY=1 -DWITH_FRIBIDI=1 -DWITH_FCGI=1 -DWITH_EXEMPI=1 \
-DCMAKE_BUILD_TYPE=Release -DWITH_RSVG=1 -DWITH_CURL=1 -DWITH_HARFBUZZ=1 -DWITH_MSSQL2008=ON ${EXTRA_CMAKEFLAGS} -DLIBMAPSERVER_EXTRA_FLAGS="${LIBMAPSERVER_EXTRA_FLAGS}" -DCMAKE_INSTALL_PREFIX=/tmp/install-mapserver

CMAKEFLAGS=-DCMAKE_C_FLAGS="--coverage ${CMAKE_C_FLAGS}" -DCMAKE_CXX_FLAGS="--coverage ${CMAKE_CXX_FLAGS}" \
-DCMAKE_SHARED_LINKER_FLAGS="-lgcov" ${CMAKEFLAGS_NOCOVERAGE}

all: cmakebuild

cmakebuild: lexer parser
if test ! -s build/Makefile; then mkdir -p build ; cd build ; cmake .. $(CMAKEFLAGS); fi
cd build && $(MAKE) $(MFLAGS)

cmakebuild_nocoverage: lexer parser
if test ! -s build_nocoverage/Makefile; then mkdir -p build_nocoverage ; cd build_nocoverage ; cmake .. $(CMAKEFLAGS_NOCOVERAGE); fi
cd build_nocoverage && $(MAKE) $(MFLAGS) && $(MAKE) $(MFLAGS) install

warning:
$(error "This Makefile is used to run the \"test\" target")

Expand Down

0 comments on commit 9ed37f2

Please sign in to comment.