Re: Experimental C unit test suite available for hacking
Le 23/05/2018 à 14:48, Micha Lenk a écrit :
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
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?
did you try to make a 'make clean'?
As explained in another message, 'test/httpdunit' is built if the
'check' library is found on the system. However, the .o files don't seem
to be updated when the code of httpd is updated. So the (previous) .o
files could have references to some functions that do not exists any more.
Could you please try to 'make clean' and 'make' to see if you still have
the build issue?