Skip to content

Commit

Permalink
Improve test coverage (#384)
Browse files Browse the repository at this point in the history
* Report coverage for almost all jobs
  * Some jobs fail and are omitted
* Add more tests to `gen_tile_test.cpp`
  * Also lightly cleaned up formatting
* Clean up cmake/* files
  * So they don't report an empty version
* Remove commented `check_*` lines from `CMakeLists.txt` file
  * These were left over from the initial CMake support implementation
  • Loading branch information
hummeltech authored Feb 2, 2024
1 parent d6309f6 commit 6d00447
Show file tree
Hide file tree
Showing 14 changed files with 734 additions and 454 deletions.
2 changes: 1 addition & 1 deletion .github/actions/coverage/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ runs:
shell: bash --noprofile --norc -euxo pipefail {0}

- name: Report `mod_tile` coverage results to `codecov.io`
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v3.1.5
with:
files: build/coverage.info
29 changes: 29 additions & 0 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ jobs:
container:
env:
CC: ${{ matrix.compiler == 'LLVM' && 'clang' || 'gcc' }}
CFLAGS: --coverage
CXX: ${{ matrix.compiler == 'LLVM' && 'clang++' || 'g++' }}
CXXFLAGS: --coverage
image: ${{ matrix.image }}
steps:
- name: Install `git` (openSUSE)
Expand All @@ -70,6 +72,14 @@ jobs:
- name: Test `mod_tile`
uses: ./.github/actions/test

- name: Process & Report `mod_tile` coverage results
uses: ./.github/actions/coverage
if: |
matrix.build_system == 'CMake' &&
matrix.compiler != 'LLVM' &&
matrix.image != 'opensuse/leap:15' &&
matrix.image != 'ubuntu:rolling'
- name: Install `mod_tile`
uses: ./.github/actions/install

Expand All @@ -96,7 +106,9 @@ jobs:
container:
env:
CC: ${{ matrix.compiler == 'LLVM' && 'clang' || 'gcc' }}
CFLAGS: --coverage
CXX: ${{ matrix.compiler == 'LLVM' && 'clang++' || 'g++' }}
CXXFLAGS: --coverage
image: ${{ matrix.image }}
steps:
- name: Checkout code
Expand All @@ -111,11 +123,17 @@ jobs:
- name: Test `mod_tile`
uses: ./.github/actions/test

- name: Process & Report `mod_tile` coverage results
uses: ./.github/actions/coverage
if: matrix.build_system == 'CMake'

- name: Install `mod_tile`
uses: ./.github/actions/install

macOS:
env:
CFLAGS: --coverage
CXXFLAGS: --coverage
LDFLAGS: -undefined dynamic_lookup
LIBRARY_PATH: /usr/local/lib
TEST_PARALLEL_LEVEL: 1
Expand Down Expand Up @@ -161,14 +179,22 @@ jobs:
- name: Test `mod_tile`
uses: ./.github/actions/test

- name: Process & Report `mod_tile` coverage results
uses: ./.github/actions/coverage
with:
lcov-extra-options: --ignore-errors gcov --ignore-errors inconsistent
if: matrix.build_system == 'CMake'

- name: Install `mod_tile`
uses: ./.github/actions/install

FreeBSD:
continue-on-error: true
env:
BUILD_PARALLEL_LEVEL: 2
CFLAGS: --coverage
CTEST_HOST: localhost
CXXFLAGS: --coverage
LIBRARY_PATH: /usr/local/lib
TEST_PARALLEL_LEVEL: 2
TMPDIR: /tmp
Expand Down Expand Up @@ -221,5 +247,8 @@ jobs:
- name: Test `mod_tile`
uses: ./.github/actions/test

- name: Process & Report `mod_tile` coverage results
uses: ./.github/actions/coverage

- name: Install `mod_tile`
uses: ./.github/actions/install
30 changes: 0 additions & 30 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,44 +56,14 @@ find_program(APXS_EXECUTABLE apxs REQUIRED)

# Functions
include(CheckFunctionExists)
# check_function_exists(bzero HAVE_BZERO)
check_function_exists(daemon HAVE_DAEMON)
# check_function_exists(gethostbyname HAVE_GETHOSTBYNAME)
check_function_exists(getloadavg HAVE_GETLOADAVG)
# check_function_exists(gettimeofday HAVE_GETTIMEOFDAY)
# check_function_exists(inet_ntoa HAVE_INET_NTOA)
# check_function_exists(memset HAVE_MEMSET)
# check_function_exists(mkdir HAVE_MKDIR)
# check_function_exists(pow HAVE_POW)
# check_function_exists(select HAVE_SELECT)
# check_function_exists(socket HAVE_SOCKET)
# check_function_exists(strchr HAVE_STRCHR)
# check_function_exists(strdup HAVE_STRDUP)
# check_function_exists(strerror HAVE_STRERROR)
# check_function_exists(strrchr HAVE_STRRCHR)
# check_function_exists(strstr HAVE_STRSTR)
# check_function_exists(strtol HAVE_STRTOL)
# check_function_exists(strtoul HAVE_STRTOUL)
# check_function_exists(utime HAVE_UTIME)

# Include files
include(CheckIncludeFile)
# check_include_file(arpa/inet.h HAVE_ARPA_INET_H)
# check_include_file(fcntl.h HAVE_FCNTL_H)
# check_include_file(limits.h HAVE_LIMITS_H)
# check_include_file(netdb.h HAVE_NETDB_H)
# check_include_file(netinet/in.h HAVE_NETINET_IN_H)
check_include_file(paths.h HAVE_PATHS_H)
# check_include_file(stdint.h HAVE_STDINT_H)
# check_include_file(stdlib.h HAVE_STDLIB_H)
# check_include_file(string.h HAVE_STRING_H)
check_include_file(sys/cdefs.h HAVE_SYS_CDEFS_H)
check_include_file(sys/loadavg.h HAVE_SYS_LOADAVG_H)
# check_include_file(sys/socket.h HAVE_SYS_SOCKET_H)
# check_include_file(sys/time.h HAVE_SYS_TIME_H)
# check_include_file(syslog.h HAVE_SYSLOG_H)
# check_include_file(unistd.h HAVE_UNISTD_H)
# check_include_file(utime.h HAVE_UTIME_H)

#-----------------------------------------------------------------------------
#
Expand Down
16 changes: 11 additions & 5 deletions cmake/FindAPR.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,16 @@ if((NOT APR_FOUND) AND (APR_INCLUDE_DIRS) AND (APR_LIBRARIES))
endif()

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(APR
FOUND_VAR APR_FOUND
REQUIRED_VARS APR_FOUND APR_INCLUDE_DIRS APR_LIBRARIES
VERSION_VAR APR_VERSION
)

if(APR_FOUND)
find_package_handle_standard_args(APR
REQUIRED_VARS APR_FOUND APR_INCLUDE_DIRS APR_LIBRARIES
VERSION_VAR APR_VERSION
)
else()
find_package_handle_standard_args(APR
REQUIRED_VARS APR_FOUND
)
endif()

mark_as_advanced(APR_INCLUDE_DIR APR_LIBRARY)
16 changes: 11 additions & 5 deletions cmake/FindCAIRO.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,16 @@ if((NOT CAIRO_FOUND) AND (CAIRO_INCLUDE_DIRS) AND (CAIRO_LIBRARIES))
endif()

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(CAIRO
FOUND_VAR CAIRO_FOUND
REQUIRED_VARS CAIRO_FOUND CAIRO_INCLUDE_DIRS CAIRO_LIBRARIES
VERSION_VAR CAIRO_VERSION
)

if(CAIRO_FOUND)
find_package_handle_standard_args(CAIRO
REQUIRED_VARS CAIRO_FOUND CAIRO_INCLUDE_DIRS CAIRO_LIBRARIES
VERSION_VAR CAIRO_VERSION
)
else()
find_package_handle_standard_args(CAIRO
REQUIRED_VARS CAIRO_FOUND
)
endif()

mark_as_advanced(CAIRO_INCLUDE_DIR CAIRO_LIBRARY)
16 changes: 11 additions & 5 deletions cmake/FindGLIB.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,16 @@ if((NOT GLIB_FOUND) AND (GLIB_INCLUDE_DIRS) AND (GLIB_LIBRARIES))
endif()

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(GLIB
FOUND_VAR GLIB_FOUND
REQUIRED_VARS GLIB_FOUND GLIB_INCLUDE_DIRS GLIB_LIBRARIES
VERSION_VAR GLIB_VERSION
)

if(GLIB_FOUND)
find_package_handle_standard_args(GLIB
REQUIRED_VARS GLIB_FOUND GLIB_INCLUDE_DIRS GLIB_LIBRARIES
VERSION_VAR GLIB_VERSION
)
else()
find_package_handle_standard_args(GLIB
REQUIRED_VARS GLIB_FOUND
)
endif()

mark_as_advanced(GLIB_INCLUDE_DIR GLIB_LIBRARY)
16 changes: 11 additions & 5 deletions cmake/FindHTTPD.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,16 @@ if((NOT HTTPD_VERSION) AND (HTTPD_FOUND))
endif()

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(HTTPD
FOUND_VAR HTTPD_FOUND
REQUIRED_VARS HTTPD_FOUND HTTPD_INCLUDE_DIRS
VERSION_VAR HTTPD_VERSION
)

if(HTTPD_FOUND)
find_package_handle_standard_args(HTTPD
REQUIRED_VARS HTTPD_FOUND HTTPD_INCLUDE_DIRS
VERSION_VAR HTTPD_VERSION
)
else()
find_package_handle_standard_args(HTTPD
REQUIRED_VARS HTTPD_FOUND
)
endif()

mark_as_advanced(HTTPD_INCLUDE_DIR)
14 changes: 10 additions & 4 deletions cmake/FindINIPARSER.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,15 @@ if((NOT INIPARSER_FOUND) AND (INIPARSER_INCLUDE_DIRS) AND (INIPARSER_LIBRARIES))
endif()

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(INIPARSER
FOUND_VAR INIPARSER_FOUND
REQUIRED_VARS INIPARSER_FOUND INIPARSER_INCLUDE_DIRS INIPARSER_LIBRARIES
)

if(INIPARSER_FOUND)
find_package_handle_standard_args(INIPARSER
REQUIRED_VARS INIPARSER_FOUND INIPARSER_INCLUDE_DIRS INIPARSER_LIBRARIES
)
else()
find_package_handle_standard_args(INIPARSER
REQUIRED_VARS INIPARSER_FOUND
)
endif()

mark_as_advanced(INIPARSER_INCLUDE_DIR INIPARSER_LIBRARY)
16 changes: 11 additions & 5 deletions cmake/FindLIBMAPNIK.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,16 @@ if((NOT LIBMAPNIK_VERSION) AND (LIBMAPNIK_FOUND))
endif()

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(LIBMAPNIK
FOUND_VAR LIBMAPNIK_FOUND
REQUIRED_VARS LIBMAPNIK_FOUND LIBMAPNIK_INCLUDE_DIRS LIBMAPNIK_LIBRARIES
VERSION_VAR LIBMAPNIK_VERSION
)

if(LIBMAPNIK_FOUND)
find_package_handle_standard_args(LIBMAPNIK
REQUIRED_VARS LIBMAPNIK_FOUND LIBMAPNIK_INCLUDE_DIRS LIBMAPNIK_LIBRARIES
VERSION_VAR LIBMAPNIK_VERSION
)
else()
find_package_handle_standard_args(LIBMAPNIK
REQUIRED_VARS LIBMAPNIK_FOUND
)
endif()

mark_as_advanced(LIBMAPNIK_INCLUDE_DIR LIBMAPNIK_LIBRARY)
16 changes: 11 additions & 5 deletions cmake/FindLIBMEMCACHED.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,16 @@ if((NOT LIBMEMCACHED_FOUND) AND (LIBMEMCACHED_INCLUDE_DIRS) AND (LIBMEMCACHED_LI
endif()

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(LIBMEMCACHED
FOUND_VAR LIBMEMCACHED_FOUND
REQUIRED_VARS LIBMEMCACHED_FOUND LIBMEMCACHED_INCLUDE_DIRS LIBMEMCACHED_LIBRARIES
VERSION_VAR LIBMEMCACHED_VERSION
)

if(LIBMEMCACHED_FOUND)
find_package_handle_standard_args(LIBMEMCACHED
REQUIRED_VARS LIBMEMCACHED_FOUND LIBMEMCACHED_INCLUDE_DIRS LIBMEMCACHED_LIBRARIES
VERSION_VAR LIBMEMCACHED_VERSION
)
else()
find_package_handle_standard_args(LIBMEMCACHED
REQUIRED_VARS LIBMEMCACHED_FOUND
)
endif()

mark_as_advanced(LIBMEMCACHED_INCLUDE_DIR LIBMEMCACHED_LIBRARY)
16 changes: 11 additions & 5 deletions cmake/FindLIBRADOS.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,16 @@ if((NOT LIBRADOS_VERSION) AND (LIBRADOS_FOUND))
endif()

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(LIBRADOS
FOUND_VAR LIBRADOS_FOUND
REQUIRED_VARS LIBRADOS_FOUND LIBRADOS_INCLUDE_DIRS LIBRADOS_LIBRARIES
VERSION_VAR LIBRADOS_VERSION
)

if(LIBRADOS_FOUND)
find_package_handle_standard_args(LIBRADOS
REQUIRED_VARS LIBRADOS_FOUND LIBRADOS_INCLUDE_DIRS LIBRADOS_LIBRARIES
VERSION_VAR LIBRADOS_VERSION
)
else()
find_package_handle_standard_args(LIBRADOS
REQUIRED_VARS LIBRADOS_FOUND
)
endif()

mark_as_advanced(LIBRADOS_INCLUDE_DIR LIBRADOS_LIBRARY)
11 changes: 6 additions & 5 deletions docker/centos/7/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ RUN --mount=id=centos:centos7-/var/cache/yum,target=/var/cache/yum,type=cache,sh
boost169-devel \
bzip2 \
cairo-devel \
freetype-devel \
devtoolset-9-gcc \
devtoolset-9-gcc-c++ \
freetype-devel \
gdal-devel \
harfbuzz-devel \
libicu-devel \
Expand Down Expand Up @@ -81,14 +81,14 @@ RUN --mount=id=centos:centos7-/var/cache/yum,target=/var/cache/yum,type=cache,sh
ulimit -n 40000; \
echo "install_weak_deps=0" >> /etc/yum.conf && \
sed --in-place 's/keepcache=0/keepcache=1/g' /etc/yum.conf && \
yum --assumeyes install epel-release && \
yum --assumeyes install epel-release centos-release-scl && \
yum --assumeyes upgrade && \
yum --assumeyes install \
boost169-devel \
cairo-devel \
cmake3 \
gcc \
gcc-c++ \
devtoolset-9-gcc \
devtoolset-9-gcc-c++ \
gdal \
glib2-devel \
harfbuzz-devel \
Expand All @@ -111,7 +111,8 @@ COPY --from=mapnik-builder /tmp/mapnik /
## Build, Test & Install `mod_tile`
COPY . /tmp/mod_tile_src
WORKDIR /tmp/mod_tile_build
RUN export CMAKE_BUILD_PARALLEL_LEVEL=$(nproc) && \
RUN source /opt/rh/devtoolset-9/enable && \
export CMAKE_BUILD_PARALLEL_LEVEL=$(nproc) && \
export CFLAGS="-I/usr/include/boost169" && \
export CXXFLAGS="-I/usr/include/boost169" && \
cmake3 -B . -S /tmp/mod_tile_src \
Expand Down
5 changes: 4 additions & 1 deletion docs/build/building_on_centos.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@ sudo yum --assumeyes update

# Install build dependencies
# (libmemcached-devel & librados2-devel are optional)
sudo yum --assumeyes install epel-release
sudo yum --assumeyes install epel-release centos-release-scl
sudo yum --assumeyes --setopt=install_weak_deps=False install \
boost169-devel \
cairo-devel \
cmake3 \
devtoolset-9-gcc \
devtoolset-9-gcc-c++ \
gcc \
gcc-c++ \
gdal \
Expand All @@ -42,6 +44,7 @@ sudo yum --assumeyes --setopt=install_weak_deps=False install \
proj

# Download, Build, Test & Install `mod_tile`
source /opt/rh/devtoolset-9/enable
export CFLAGS="-I/usr/include/boost169"
export CMAKE_BUILD_PARALLEL_LEVEL=$(nproc)
export CXXFLAGS="-I/usr/include/boost169"
Expand Down
Loading

0 comments on commit 6d00447

Please sign in to comment.