[kea-dev] How to properly test callouts?

Marcin Siodelski marcin at isc.org
Wed Nov 5 15:05:37 UTC 2014


Marcin,

The hook libraries are normally compiled as shared libraries and loaded
by Kea from the specific location indicated in the Kea configuration.

I am not certain from your description, but it seems that you haven't
built your library as a shared module so it cannot be dynamically loaded
by Kea?

There is a good example of the hooks library, that we have implemented
for our needs, in the source code. It is located in
src/hooks/dhcp/user_chk. It comes along with the suitable Makefile.am
which builds it as a shared library. It also has a bunch of unit tests
for individual C++ classes and methods. I think it will be best for you
to start from there. It is also well documented in the developer's
guide:
http://git.kea.isc.org/~tester/kea/doxygen/d8/db2/libdhcp_user_chk.html

Apart from this, the developer's guide comprises a collection of other
documents about the hooks framework which you may find useful, e.g.
http://git.kea.isc.org/~tester/kea/doxygen/df/d46/hooksdgDevelopersGuide.html
or http://git.kea.isc.org/~tester/kea/doxygen/de/df3/dhcpv4Hooks.html

It is possible that I misunderstood your intent and you want to test
your library in a different way than loading it as a shared library. If
so, please be more specific what you're actually going to achieve.

Regards,

Marcin Siodelski
DHCP Software Engineer
at ISC


On 11/05/14 00:43, Marcin Wyszynski wrote:
> Dear KEA devs,
> 
> I have a statically linked hook library which I’d like to test and I’d want to know what the best approach would be. My naive attempt was to create an empty CalloutHandle object, pass it to my hook function and compare the result with my expectations. However, that is not so simple. CalloutHandle constructor expects at least a boost::shared_ptr<CalloutManager>. Unfortunately I see no way to create an actual instance since hooks/callout_manager.h header file is not explicitly exported.
> 
> Please kindly advise on the best way of dealing with this problem.
> 
> Thank you in advance!
> 
> Best,
> Marcin
> 
> _______________________________________________
> kea-dev mailing list
> kea-dev at lists.isc.org
> https://lists.isc.org/mailman/listinfo/kea-dev
> 


More information about the kea-dev mailing list