I'm going to do something about it for an existing Apache C module to repair some possible security defects and general bad practices. Nevertheless the functionality from the code must remain unchanged (except in instances where its fixing a bug). Standard regression testing stuff appears to stay in order. I must determine if anybody knows of a great way to run some regression unit tests againt the code. I am thinking something like using C-Unit but with the tie inches towards the Apache APR and status structures I'm wondering if there's a great way to test this. What are the pre-built frameworks you can use with C-unit for instance?
I have been considering responding to this for some time, but figured another person might develop a much better answer, because mine is quite unsatisfactory: no, I am unaware of such unit testing framework.
I believe your best choice is to refactor your C module so that it's dependencies around the httpd code base are contained in an exceedingly thin glue layer. I would not worry an excessive amount of about dependencies on APR, that may be easily linked to your unit test code. It's such things as while using request record that gradually alter abstract out a bit.
I'll go as far and claim that this type of refactoring may be beneficial when the code is suspected to contain security defects and bad practices. It is simply often a pretty large job.
What you are able also consider is running integration tests instead of unit tests (ideally both), i.e. develop some demands and expected reactions in the server, and operate a program to check the particular to expected reactions.
So, not the response you have been searching for, and also you most likely considered something along this line yourself. But a minimum of I will tell you against experience when the module can not be changed with new things for business reasons, then refactoring it for testability will probably lead to the long run.
Spent a while searching round the interwebs for you personally since it's an issue i had been curious myself. discovered a wiki article proclaiming that
was adopted for that apache portable c runtime testing. may be worth checking that out.