openstreetmap/mod_tile — pull request #11 by springmeyer (2013-04-10 19:53:37+00:00)
Title: add test framework that can be run with 'make test' - refs #10

This is a fresh start to having a test framework. Uses the zero-dependency https://github.com/philsquared/Catch.

Mod_tile/renderd generally is not modular or accessible as a library, so writing tests that exercise specific components by calling internal functions is blocked. Ideally the code could be refactored so that the core parts of the application are compiled into a library and have public header files. Then applications like renderd could simply provide `main`, startup code, and then link dynamically or statically to libmodtile.so. This design would make testing much more viable.

But currently this is not the design. So this test approach instead looks at stderr and tries to poke the few accessible renderd initialization functions and also starts up renderd from the command line. The idea here is that this could provide a useful starting point to ensure that good errors are thrown when invalid parameters are passed at startup and that current errors never regress.

My thought is that anyone that requests functionality be added to mod_tile could be required to write tests so that @apmon does not have to spend more time than is necessary validating that the code is correct.