51 Commits

Author SHA1 Message Date
f0811e8f29 Astyle/flawfinder updates (#487)
* Apply astyle updates from newer version of astyle
* Update `github/codeql-action/upload-sarif`
2025-06-01 08:20:43 -07:00
ba27f1b9a9 Add Origin header test for CORS not being set (#480)
Also moved `cors = NULL` fix from #479 into `_add_tile_config` instead as that fix only applied to configs added via `AddTileConfig` in `httpd.conf` files, not all methods.
2025-04-15 09:27:58 -07:00
aa53e609d0 Improved --verbose messaging for render_expired (#461) 2024-07-10 17:38:52 -07:00
c4e3e6230c Clarify optional libraries and allow optionally disabling them (#453)
`libcurl` & `libcairo` are also optional and their usage can now be optionally disabled (along with `libmemcached` & `librados`.)

* No longer test macOS Autotools building
2024-06-28 13:51:12 -07:00
e89046b5ee Also use renderd_config for mod_tile (#440)
Follow-up to #391 & #400
2024-06-19 09:20:50 -07:00
1f81434203 Move MAPNIK_MAJOR_VERSION checks around (#439) 2024-06-04 20:04:09 -07:00
0cc76cb72f Cleaning up tests (#424) 2024-03-27 17:58:11 -07:00
7f91d53ec3 Prevent duplicate renderd sections (#421)
In order to remove any confusion if the user has duplicate `renderd` sections in their `renderd.conf` file.

Currently with a configuration like this one:
```ini
[renderd]
pid_file=/run/renderd/renderd.pid
socketname=/run/renderd/renderd.sock
stats_file=/run/renderd/renderd.stats
tile_dir=/var/cache/renderd/tiles

[renderd0]
pid_file=/run/renderd/renderd0.pid
socketname=/run/renderd/renderd0.sock
stats_file=/run/renderd/renderd0.stats
tile_dir=/var/cache/renderd/tiles
```
only the second `renderd` section (`renderd0`) will actually be used.

After this patch is merged, an error message will be shown and the application will exit.
2024-03-24 21:25:57 -07:00
aebb506485 Prevent socketnames in renderd.conf exceeding maximum allowed length (#422)
The maximum allowed length of a socket file name is 108:
https://www4.cs.fau.de/Services/Doc/C/libc.html#SEC189

Exceeding this length will likely lead to difficult to troubleshoot behavior.
2024-03-24 20:55:27 -07:00
2ce51df526 Test error output in catch tests (#419) 2024-03-23 21:58:30 -07:00
743cf651b1 Follow up to #190 for render_list (#417)
* Fixed `render_list` build needs `libm`
* Added tests
* Updated man page
* Created function to set double
* Cleaned up / optimized a bit
* Removed `--dont-render` option
2024-03-21 13:22:02 -07:00
2a4532f002 Improve render_expired/render_list test coverage (#415) 2024-03-19 09:15:41 -07:00
21713d0319 Fix/improve X-Forwarded-For/throttling testing (#410)
* Previously it was not actually sending the header
* Now runs in serial, regardless of parallel specification
* Now runs only once, rather than for each map layer

_Also_:
* Removed no-longer used `storage_mutex`
  * Was only used for Apache HTTP Server < v2.4
2024-03-15 10:11:37 -07:00
7389b160bf Add renderd_config.c usage into render_* targets (#400)
* Add support for reading `renderd.conf` to `render_expired`
* Add support for reading `renderd.conf` to `render_list`
* Add support for reading `renderd.conf` to `render_old`
* Add support for reading `renderd.conf` to `render_speedtest`
* Move renderd/render_* execution tests to own files
* Reduce variable scope & minor clean up
* Use `stat` rather than `access` to check if file exists
2024-03-04 12:03:16 -07:00
b37cfd9ebb Handle mod_tile not having a valid storage context (causing a segmentation fault) (#398)
This only seems to happen after a delay pool is created (i.e. when `ModTileEnableTileThrottling` is enabled) and is then being manipulated.
2024-03-02 17:44:56 -07:00
2de946dde1 Split up renderd.conf processing by section type (#397) 2024-03-01 20:04:09 -07:00
04a0bf0f09 Fix segmentation fault in modtile.c:delay_allowed (#395) 2024-02-24 19:11:02 -07:00
a0e9681f51 Additional tests (#394)
* Add tests for `ModTileCacheExtendedHostName` and expired tileOld/TileVeryOld
* Add tests for `ModTileEnableTileThrottling`/`ModTileEnableTileThrottlingXForward`
2024-02-22 21:29:10 -07:00
c31d526441 Cleaning up CTest tests (#393)
* Improve service startup "tests"
* Address intermittent download test failure
  * Caused by load exceeding threshold
* Add more missing bad HTTPD config tests
* Allow for newer `libpng` with Docker tests
  * Also test more image/file types
2024-02-20 19:52:57 -07:00
1c9f8b6fb5 Move renderd.conf processing code into new file (#391)
So that it can be easily re-used by other targets.
2024-02-18 11:07:19 -07:00
fdaa5a5750 Move foreground definition into src/g_logger.c (#390)
And setting it to `0`, no longer requiring defining it everywhere except in foreground executables as needed.

_Also_:
* Require `GLib` >= `v2.50`
  * Needed for [g_log_writer_standard_streams](https://docs.gtk.org/glib/func.log_writer_standard_streams.html)
* Set FreeBSD job `BUILD_PARALLEL_LEVEL` & `TEST_PARALLEL_LEVEL` environment variables via `run`
  * Rather than hard-coding them
2024-02-10 13:34:27 -07:00
19facb07eb Add Arch Linux build documentation and Dockerfile (#389)
_Also_:
* Added more tests
* Moved test code & test-related code into `/tests`
* Run Docker build tests in parallel
2024-02-06 16:14:11 -07:00
086cc8892e Add option to detect available cores when num_threads=-1 (#380)
When configuring `num_threads=-1` in `renderd.conf` for a `renderd` section, the value will be set to the number of cores on the running system.
2024-01-29 19:30:35 -07:00
6e2fc56888 Improve gen_tile_test test coverage (#382)
* Don't limit Coverage CTest parallel level to 1
* Additional tests
* Re-enable Fedora Rawhide
2024-01-29 16:11:08 -07:00
9408604811 CTest & GitHub Actions Improvements (#381)
* Run tests in parallel in some `GitHub Actions` Workflows
  * Except for `macOS` & `Coverage` jobs
* Update `Node.js 16` actions to `Node.js 20` versions
  * `actions/upload-artifact`
  * `actions/cache`
* Add server `IP:Port` in `CTest` HTTPD logs
* Make `render_speedtest_*` CTest tests require tiles to be downloaded
* Add & use tile download functions for CTest
  * Including `check` & `remove` "tests"
  * To remove much of the redundant code
* Split up HTTPD0/HTTPD1 downloads in CTest
* Remove Amazon Linux 2/CentOS 7 from CI workflow
* Comment out fedora:rawhide, it's not currently working
* Re-enable CentOS Stream tests
2024-01-24 21:45:21 -07:00
4143ab23bd Prepend host to Listen directive in httpd.conf for CTest (#377)
To follow up on #374
2024-01-22 09:43:17 -07:00
b3c19c13d9 Allow custom host specification with CTest (#374)
* To facilitate running `memcached` tests for all jobs
  * `CentOS`/`Debian`/`Fedora` jobs don't seem to like running `memcached` on `localhost`
  * `FreeBSD` jobs don't seem to like running `memcached` on `0.0.0.0`
2024-01-19 15:39:07 -07:00
8cca561116 Added tile_dir support to httpd.conf directive AddTileConfig (#370)
_Also_:
- Changed `AddTileConfig` parsing directive
  - From `AP_INIT_RAW_ARGS` to `AP_INIT_TAKE_ARGV`
  - Makes code a bit cleaner, e.g.:
    - Checking for first two "arguments"
    - Iterating "arguments"
- Applied Artistic Style Formatting 
  - After merging #346
- Added deprecation notice when using `AddTileMimeConfig`
- Enabled commented `AddTileConfig`/`AddTileMimeConfig` tests
2024-01-11 21:17:53 -07:00
d761f96c0b Added AddTileConfig documentation to example HTTPD config (#372)
_Also_:
- Removed `AddTileMimeConfig` from example `HTTPD` config
  - No longer needed after merging #346
  - Deprecation notice incoming with #370
- Added additional `AddTileConfig`/`AddTileMimeConfig` tests
  - Testing failing download with invalid map name in `httpd.conf`
  - Testing parsing invalid `httpd.conf`, e.g.:
    - `LoadTileConfigFile` without arguments
    - `LoadTileConfigFile` without non-existent file
- Replaced `grep` with `${GREP_EXECUTABLE}` in tests
2024-01-11 19:46:00 -07:00
097f941fad Added tests for ATTRIBUTION & DESCRIPTION (#371) 2024-01-11 16:51:07 -07:00
09e7fa1d43 Allow host:port specification for MemcacheD storage backend (#369)
So that MemcacheD hosts and ports other than `localhost` and `11211` can be used.

_Also_:
- Added `ctest --parallel` execution support
- Added tests for custom `MemcacheD` {host}:{port}
- Added tests for `AddTileConfig`/`AddTileMimeConfig`
2024-01-10 16:33:08 -07:00
d8cd8dea9a Add tests for MemcacheD storage backend (#362)
_Also_:
* Added background `renderd` process testing
* Added `renderd` section without `stats_file` testing
* Added `render_*` via TCP tests
* Added `render_* --verbose`  tests
* Added `render_expired --delete-from` tests
* Added `render_expired --no-progress` tests
* Added `render_expired --touch-from` tests
* Added `PARAMETERIZE_STYPE=language` map configuration testing
* Added `HTCPHOST`/`HOST` map configuration testing
2024-01-06 13:25:49 -07:00
ff06794c00 Added missing signal handlers (#364)
`renderd` coverage is otherwise not properly reported

_Also:_
- Removed `freebsd12` from CI
  - Packages are no longer provided (http://pkg.freebsd.org/)
- Added test for `HTCP host name` specification
- Renamed files in `src`/`includes` to match target names
  - `src/daemon.c` → `src/renderd.c`
  - `src/speedtest.cpp` →`src/render_speedtest.cpp`
  - `includes/daemon.h` → `includes/renderd.h`
2024-01-03 19:34:39 -07:00
53b77bc1db Added Docker-based building and testing method (#363)
* Build with Docker
* Use CUSTOM_DEFINES for Mapnik building
* Only run `install-package-and-test.yml` if etc, utils or YAML file have changed
2023-12-30 20:57:44 -07:00
3c324648e6 Minor coverage improvements and CTest clean up (#361) 2023-12-14 17:31:52 -07:00
8abe6eed6d Fix DEFAULT_ATTRIBUTION value and add tests (#360)
The value for `DEFAULT_ATTRIBUTION` in `includes/mod_tile.h` needed to be escaped, it was causing a JSON parsing failure.
* Added basic test for `/.../.../tile-layer.json` to ensure parsing is successful
* Added basic tests for `/metrics` & `/mod_tile` URLs
2023-12-12 12:48:15 -07:00
925183a960 Make /status and /dirty URLs controlable with apache conf (#359)
* Allow the …/status URL to be turned on or off (default of on remains)

Add ModTileEnableStatusURL On/Off to allow the …/status to be turned on
(default) or off. Previous behaviour has …/status on, which is not
changed in this patch.

* Allow the …/dirty URL to be turned on or off (default of on remains)

Add ModTileEnableDirtyURL On/Off to allow the …/dirty to be turned on
(default) or off. Previous behaviour has …/dirty on, which is not
changed in this patch.

* Make …/dirty & …/status disabled by default.

This is a breaking change. To get the old default behaviour back, you
must now manually add `ModTileEnableStatusURL On` &
`ModTileEnableDirtyURL On` to your apache configuration.

* Change default for ModTileEnable Dirty/Status URL to On

* Add log output for when `/dirty`/`/status` is Off

* Add tests for "ModTileEnable{Dirty|Status}URL Off"

---------

Co-authored-by: Amanda McCann <amanda@technomancy.org>
2023-12-11 20:47:50 -07:00
4580b2e887 Improve FreeBSD CI Workflows speeds (#358)
The `freebsd-vagrant-action` action now supports running on `Linux` runners, which almost halves the duration of `FreeBSD` building and testing.
2023-12-06 13:32:55 -07:00
c2896c78ec Added OpenSUSE support to build & test pipeline (#344)
* Also added build documentation

Resolves #89
2023-10-05 15:05:53 -07:00
bc0ddfef9c Added more linters (cmakelint & prettier) (#341)
For linting `CMakeLists.txt` & `*.cmake` files (`cmakelint`) as well as various other formats such as `HTML`, `MarkDown` & `YAML` (`prettier`.)

### Also:
* Upgrade `actions/checkout` from `v3` to `v4`
* Output coverage summary to GitHub Job step summary
* Minor build docs cleanup for `CentOS`  & `FreeBSD`
2023-10-02 10:17:22 -07:00
3c86206269 Allow adjusting ports used for CTest testing (#331)
* Allow customizing `httpd` & `renderd` CTest testing TCP ports
2023-09-28 14:53:47 -07:00
c8eba9f6e8 Resolve deprecation of FindDart (#329)
Deprecated with [CMake 3.27](https://cmake.org/cmake/help/latest/module/FindDart.html), which is currently only present in `Fedora Rawhide`
2023-09-28 13:49:15 -07:00
d13186ae7d FreeBSD via Vagrant allows reuse of existing actions (#339)
Currently, there is a lot of duplicate CI config for FreeBSD jobs, this removes that redundancy.
2023-09-28 12:31:53 -07:00
24a5752d93 Fixed various CI failures (#328)
* Fix `Unknown argument "--skip-broken" for command "dnf5"`

* Increase timeout for `render_list` & `render_old` tests

* Sync FreeBSD build command with others (and build Release by default)

* Fix non-default tile tests

* Fixed WEBP test for `libwebp.so.4`
2023-07-21 04:52:22 +02:00
f652ab1521 Configurable ImageIO output format (#318)
* Added the possibility to provide ImageIO's output format in the TYPE string.
For instance:
TYPE=png image/png
TYPE=png image/png png256
TYPE=png image/png png24
TYPE=png image/png png

* Removed useless comments.
Added documentation for output format.

* Added tests for 'webp' output format

* Also added tests for 'png32' output format

* Fix 'webp' sums vary based on version

* Add JPG & use multiple layers on example-map

---------

Co-authored-by: Tim <autintim@gmail.com>
2023-07-20 23:41:18 +02:00
6e20fba5e9 Generate config files and directories with CMake (#316)
* Generate config files and directories with CMake

CMake >= 3.13 required due to 'https://cmake.org/Bug/view.php?id=14444'

* Update CI pipeline
2023-07-20 23:34:21 +02:00
708527591a Add coverage reporting support (#313)
* Add coverage reporting

* No longer need to run `astyle` from within a container

* Multiple test runs seems to help catch more coverage

* Re-order renderd shutdown processes

* Move coverage job into a new workflow
2023-07-20 09:28:53 +00:00
d408481e3a Add a few more tests for render_* (#315) 2023-07-20 09:27:37 +00:00
f521540df1 Allow renderd* sections to follow map sections in renderd.conf (#308)
* Allow `renderd*` sections to precede `map` sections in config file

* Adding test

* astyle formatting
2023-03-09 15:58:00 +00:00
07c8ad19f7 Test CMake build system support in GitHub Actions (#288)
* GitHub Actions

* Consolidate Mapnik v3/v4 builds into one workflow

* Removed pkg-config from macos-build-dependencies

* Simplify FreeBSD build

* Remove now-merged patch from install latest Mapnik action
2023-03-03 17:24:29 +00:00