git.net

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Experimental C unit test suite available for hacking


Building on Windows it errors.

branches/httpdunit is a based on an "old" trunk which does not build.

Current trunk build on windows.

On 23-05-18 14:48, Micha Lenk wrote:
On 05/25/2017 11:44 PM, Jacob Champion wrote (almost a year ago):
Last week I had a personal hackathon since I couldn't make it out to ApacheCon. As a result there is now a C-language unit test suite available in branches/httpdunit (based on trunk). I've tested it with a Windows+CMake toolchain as well as an Ubuntu+autoconf toolchain.

The suite itself is based on Check, which is a testing library I've had some success with in the past. It's supported on a wide variety of platforms and has a nice feature of running each test in a separate process space, so a crash doesn't derail the entire suite. (Note: Check is LGPL.) The build system has been augmented slightly to generate some of the more tedious boilerplate code.

If you want to give it a try, just install Check (and, if using the configure scripts, make sure Check is visible via pkg-config). The test suite will then automatically be added to the default targets. Once everything builds you just run the suite directly with

     $ ./test/httpdunit

As a Check binary, it has multiple knobs to control which tests run and how the reporting is done, but by default it just runs all the tests and prints TAP to stdout.

The example tests that are currently running are testing a new API for strict Base64 decoding. Right now it's a feature without a client; I included it here because it was a good showcase of the test suite (see test/unit/base64.c for the test case code).

Let me know what you think!

I totally like the idea of having unit tests for httpd, so thanks a lot for adding them!

I recently struggled compiling trunk locally on Debian 9.4 because of these unit tests. Apparently it fails to link test/httpdunit because of undefined references to ap_queue_info_push_pool and other symbols. See the attached build log for more details.

Does anybody have an idea what went wrong? Am I missing something?
How does buildbot build?

Best regards,
Micha