Skip to content

Commit 6d00447

Browse files
authored
Improve test coverage (#384)
* 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
1 parent d6309f6 commit 6d00447

14 files changed

Lines changed: 734 additions & 454 deletions

.github/actions/coverage/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,6 @@ runs:
2323
shell: bash --noprofile --norc -euxo pipefail {0}
2424

2525
- name: Report `mod_tile` coverage results to `codecov.io`
26-
uses: codecov/codecov-action@v3
26+
uses: codecov/codecov-action@v3.1.5
2727
with:
2828
files: build/coverage.info

.github/workflows/build-and-test.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,9 @@ jobs:
5151
container:
5252
env:
5353
CC: ${{ matrix.compiler == 'LLVM' && 'clang' || 'gcc' }}
54+
CFLAGS: --coverage
5455
CXX: ${{ matrix.compiler == 'LLVM' && 'clang++' || 'g++' }}
56+
CXXFLAGS: --coverage
5557
image: ${{ matrix.image }}
5658
steps:
5759
- name: Install `git` (openSUSE)
@@ -70,6 +72,14 @@ jobs:
7072
- name: Test `mod_tile`
7173
uses: ./.github/actions/test
7274

75+
- name: Process & Report `mod_tile` coverage results
76+
uses: ./.github/actions/coverage
77+
if: |
78+
matrix.build_system == 'CMake' &&
79+
matrix.compiler != 'LLVM' &&
80+
matrix.image != 'opensuse/leap:15' &&
81+
matrix.image != 'ubuntu:rolling'
82+
7383
- name: Install `mod_tile`
7484
uses: ./.github/actions/install
7585

@@ -96,7 +106,9 @@ jobs:
96106
container:
97107
env:
98108
CC: ${{ matrix.compiler == 'LLVM' && 'clang' || 'gcc' }}
109+
CFLAGS: --coverage
99110
CXX: ${{ matrix.compiler == 'LLVM' && 'clang++' || 'g++' }}
111+
CXXFLAGS: --coverage
100112
image: ${{ matrix.image }}
101113
steps:
102114
- name: Checkout code
@@ -111,11 +123,17 @@ jobs:
111123
- name: Test `mod_tile`
112124
uses: ./.github/actions/test
113125

126+
- name: Process & Report `mod_tile` coverage results
127+
uses: ./.github/actions/coverage
128+
if: matrix.build_system == 'CMake'
129+
114130
- name: Install `mod_tile`
115131
uses: ./.github/actions/install
116132

117133
macOS:
118134
env:
135+
CFLAGS: --coverage
136+
CXXFLAGS: --coverage
119137
LDFLAGS: -undefined dynamic_lookup
120138
LIBRARY_PATH: /usr/local/lib
121139
TEST_PARALLEL_LEVEL: 1
@@ -161,14 +179,22 @@ jobs:
161179
- name: Test `mod_tile`
162180
uses: ./.github/actions/test
163181

182+
- name: Process & Report `mod_tile` coverage results
183+
uses: ./.github/actions/coverage
184+
with:
185+
lcov-extra-options: --ignore-errors gcov --ignore-errors inconsistent
186+
if: matrix.build_system == 'CMake'
187+
164188
- name: Install `mod_tile`
165189
uses: ./.github/actions/install
166190

167191
FreeBSD:
168192
continue-on-error: true
169193
env:
170194
BUILD_PARALLEL_LEVEL: 2
195+
CFLAGS: --coverage
171196
CTEST_HOST: localhost
197+
CXXFLAGS: --coverage
172198
LIBRARY_PATH: /usr/local/lib
173199
TEST_PARALLEL_LEVEL: 2
174200
TMPDIR: /tmp
@@ -221,5 +247,8 @@ jobs:
221247
- name: Test `mod_tile`
222248
uses: ./.github/actions/test
223249

250+
- name: Process & Report `mod_tile` coverage results
251+
uses: ./.github/actions/coverage
252+
224253
- name: Install `mod_tile`
225254
uses: ./.github/actions/install

CMakeLists.txt

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -56,44 +56,14 @@ find_program(APXS_EXECUTABLE apxs REQUIRED)
5656

5757
# Functions
5858
include(CheckFunctionExists)
59-
# check_function_exists(bzero HAVE_BZERO)
6059
check_function_exists(daemon HAVE_DAEMON)
61-
# check_function_exists(gethostbyname HAVE_GETHOSTBYNAME)
6260
check_function_exists(getloadavg HAVE_GETLOADAVG)
63-
# check_function_exists(gettimeofday HAVE_GETTIMEOFDAY)
64-
# check_function_exists(inet_ntoa HAVE_INET_NTOA)
65-
# check_function_exists(memset HAVE_MEMSET)
66-
# check_function_exists(mkdir HAVE_MKDIR)
67-
# check_function_exists(pow HAVE_POW)
68-
# check_function_exists(select HAVE_SELECT)
69-
# check_function_exists(socket HAVE_SOCKET)
70-
# check_function_exists(strchr HAVE_STRCHR)
71-
# check_function_exists(strdup HAVE_STRDUP)
72-
# check_function_exists(strerror HAVE_STRERROR)
73-
# check_function_exists(strrchr HAVE_STRRCHR)
74-
# check_function_exists(strstr HAVE_STRSTR)
75-
# check_function_exists(strtol HAVE_STRTOL)
76-
# check_function_exists(strtoul HAVE_STRTOUL)
77-
# check_function_exists(utime HAVE_UTIME)
7861

7962
# Include files
8063
include(CheckIncludeFile)
81-
# check_include_file(arpa/inet.h HAVE_ARPA_INET_H)
82-
# check_include_file(fcntl.h HAVE_FCNTL_H)
83-
# check_include_file(limits.h HAVE_LIMITS_H)
84-
# check_include_file(netdb.h HAVE_NETDB_H)
85-
# check_include_file(netinet/in.h HAVE_NETINET_IN_H)
8664
check_include_file(paths.h HAVE_PATHS_H)
87-
# check_include_file(stdint.h HAVE_STDINT_H)
88-
# check_include_file(stdlib.h HAVE_STDLIB_H)
89-
# check_include_file(string.h HAVE_STRING_H)
9065
check_include_file(sys/cdefs.h HAVE_SYS_CDEFS_H)
9166
check_include_file(sys/loadavg.h HAVE_SYS_LOADAVG_H)
92-
# check_include_file(sys/socket.h HAVE_SYS_SOCKET_H)
93-
# check_include_file(sys/time.h HAVE_SYS_TIME_H)
94-
# check_include_file(syslog.h HAVE_SYSLOG_H)
95-
# check_include_file(unistd.h HAVE_UNISTD_H)
96-
# check_include_file(utime.h HAVE_UTIME_H)
9767

9868
#-----------------------------------------------------------------------------
9969
#

cmake/FindAPR.cmake

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,16 @@ if((NOT APR_FOUND) AND (APR_INCLUDE_DIRS) AND (APR_LIBRARIES))
4040
endif()
4141

4242
include(FindPackageHandleStandardArgs)
43-
find_package_handle_standard_args(APR
44-
FOUND_VAR APR_FOUND
45-
REQUIRED_VARS APR_FOUND APR_INCLUDE_DIRS APR_LIBRARIES
46-
VERSION_VAR APR_VERSION
47-
)
43+
44+
if(APR_FOUND)
45+
find_package_handle_standard_args(APR
46+
REQUIRED_VARS APR_FOUND APR_INCLUDE_DIRS APR_LIBRARIES
47+
VERSION_VAR APR_VERSION
48+
)
49+
else()
50+
find_package_handle_standard_args(APR
51+
REQUIRED_VARS APR_FOUND
52+
)
53+
endif()
4854

4955
mark_as_advanced(APR_INCLUDE_DIR APR_LIBRARY)

cmake/FindCAIRO.cmake

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,16 @@ if((NOT CAIRO_FOUND) AND (CAIRO_INCLUDE_DIRS) AND (CAIRO_LIBRARIES))
4040
endif()
4141

4242
include(FindPackageHandleStandardArgs)
43-
find_package_handle_standard_args(CAIRO
44-
FOUND_VAR CAIRO_FOUND
45-
REQUIRED_VARS CAIRO_FOUND CAIRO_INCLUDE_DIRS CAIRO_LIBRARIES
46-
VERSION_VAR CAIRO_VERSION
47-
)
43+
44+
if(CAIRO_FOUND)
45+
find_package_handle_standard_args(CAIRO
46+
REQUIRED_VARS CAIRO_FOUND CAIRO_INCLUDE_DIRS CAIRO_LIBRARIES
47+
VERSION_VAR CAIRO_VERSION
48+
)
49+
else()
50+
find_package_handle_standard_args(CAIRO
51+
REQUIRED_VARS CAIRO_FOUND
52+
)
53+
endif()
4854

4955
mark_as_advanced(CAIRO_INCLUDE_DIR CAIRO_LIBRARY)

cmake/FindGLIB.cmake

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,16 @@ if((NOT GLIB_FOUND) AND (GLIB_INCLUDE_DIRS) AND (GLIB_LIBRARIES))
4040
endif()
4141

4242
include(FindPackageHandleStandardArgs)
43-
find_package_handle_standard_args(GLIB
44-
FOUND_VAR GLIB_FOUND
45-
REQUIRED_VARS GLIB_FOUND GLIB_INCLUDE_DIRS GLIB_LIBRARIES
46-
VERSION_VAR GLIB_VERSION
47-
)
43+
44+
if(GLIB_FOUND)
45+
find_package_handle_standard_args(GLIB
46+
REQUIRED_VARS GLIB_FOUND GLIB_INCLUDE_DIRS GLIB_LIBRARIES
47+
VERSION_VAR GLIB_VERSION
48+
)
49+
else()
50+
find_package_handle_standard_args(GLIB
51+
REQUIRED_VARS GLIB_FOUND
52+
)
53+
endif()
4854

4955
mark_as_advanced(GLIB_INCLUDE_DIR GLIB_LIBRARY)

cmake/FindHTTPD.cmake

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,16 @@ if((NOT HTTPD_VERSION) AND (HTTPD_FOUND))
3838
endif()
3939

4040
include(FindPackageHandleStandardArgs)
41-
find_package_handle_standard_args(HTTPD
42-
FOUND_VAR HTTPD_FOUND
43-
REQUIRED_VARS HTTPD_FOUND HTTPD_INCLUDE_DIRS
44-
VERSION_VAR HTTPD_VERSION
45-
)
41+
42+
if(HTTPD_FOUND)
43+
find_package_handle_standard_args(HTTPD
44+
REQUIRED_VARS HTTPD_FOUND HTTPD_INCLUDE_DIRS
45+
VERSION_VAR HTTPD_VERSION
46+
)
47+
else()
48+
find_package_handle_standard_args(HTTPD
49+
REQUIRED_VARS HTTPD_FOUND
50+
)
51+
endif()
4652

4753
mark_as_advanced(HTTPD_INCLUDE_DIR)

cmake/FindINIPARSER.cmake

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,15 @@ if((NOT INIPARSER_FOUND) AND (INIPARSER_INCLUDE_DIRS) AND (INIPARSER_LIBRARIES))
4040
endif()
4141

4242
include(FindPackageHandleStandardArgs)
43-
find_package_handle_standard_args(INIPARSER
44-
FOUND_VAR INIPARSER_FOUND
45-
REQUIRED_VARS INIPARSER_FOUND INIPARSER_INCLUDE_DIRS INIPARSER_LIBRARIES
46-
)
43+
44+
if(INIPARSER_FOUND)
45+
find_package_handle_standard_args(INIPARSER
46+
REQUIRED_VARS INIPARSER_FOUND INIPARSER_INCLUDE_DIRS INIPARSER_LIBRARIES
47+
)
48+
else()
49+
find_package_handle_standard_args(INIPARSER
50+
REQUIRED_VARS INIPARSER_FOUND
51+
)
52+
endif()
4753

4854
mark_as_advanced(INIPARSER_INCLUDE_DIR INIPARSER_LIBRARY)

cmake/FindLIBMAPNIK.cmake

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,16 @@ if((NOT LIBMAPNIK_VERSION) AND (LIBMAPNIK_FOUND))
5151
endif()
5252

5353
include(FindPackageHandleStandardArgs)
54-
find_package_handle_standard_args(LIBMAPNIK
55-
FOUND_VAR LIBMAPNIK_FOUND
56-
REQUIRED_VARS LIBMAPNIK_FOUND LIBMAPNIK_INCLUDE_DIRS LIBMAPNIK_LIBRARIES
57-
VERSION_VAR LIBMAPNIK_VERSION
58-
)
54+
55+
if(LIBMAPNIK_FOUND)
56+
find_package_handle_standard_args(LIBMAPNIK
57+
REQUIRED_VARS LIBMAPNIK_FOUND LIBMAPNIK_INCLUDE_DIRS LIBMAPNIK_LIBRARIES
58+
VERSION_VAR LIBMAPNIK_VERSION
59+
)
60+
else()
61+
find_package_handle_standard_args(LIBMAPNIK
62+
REQUIRED_VARS LIBMAPNIK_FOUND
63+
)
64+
endif()
5965

6066
mark_as_advanced(LIBMAPNIK_INCLUDE_DIR LIBMAPNIK_LIBRARY)

cmake/FindLIBMEMCACHED.cmake

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,16 @@ if((NOT LIBMEMCACHED_FOUND) AND (LIBMEMCACHED_INCLUDE_DIRS) AND (LIBMEMCACHED_LI
4040
endif()
4141

4242
include(FindPackageHandleStandardArgs)
43-
find_package_handle_standard_args(LIBMEMCACHED
44-
FOUND_VAR LIBMEMCACHED_FOUND
45-
REQUIRED_VARS LIBMEMCACHED_FOUND LIBMEMCACHED_INCLUDE_DIRS LIBMEMCACHED_LIBRARIES
46-
VERSION_VAR LIBMEMCACHED_VERSION
47-
)
43+
44+
if(LIBMEMCACHED_FOUND)
45+
find_package_handle_standard_args(LIBMEMCACHED
46+
REQUIRED_VARS LIBMEMCACHED_FOUND LIBMEMCACHED_INCLUDE_DIRS LIBMEMCACHED_LIBRARIES
47+
VERSION_VAR LIBMEMCACHED_VERSION
48+
)
49+
else()
50+
find_package_handle_standard_args(LIBMEMCACHED
51+
REQUIRED_VARS LIBMEMCACHED_FOUND
52+
)
53+
endif()
4854

4955
mark_as_advanced(LIBMEMCACHED_INCLUDE_DIR LIBMEMCACHED_LIBRARY)

0 commit comments

Comments
 (0)