Kea  2.5.2
isc::test::LibLoadTest Class Reference

Test fixture for testing loading and unloading of hook libraries. More...

#include <lib_load_test_fixture.h>

+ Inheritance diagram for isc::test::LibLoadTest:

Public Member Functions

 LibLoadTest (const std::string lib_so_name="no-lib-specified")
 Constructor. More...
 
 ~LibLoadTest ()
 Destructor. Unloads any previously loaded libraries. More...
 
void addLibrary (const std::string &library, isc::data::ConstElementPtr parameters)
 Adds a library along with its parameters to the list of libraries to be loaded. More...
 
void clearLibraries ()
 
void invalidDaemonTest (const std::string &daemon_name, uint16_t family=AF_INET, const isc::data::ElementPtr &params=isc::data::ElementPtr())
 Verifies that an invalid daemon cannot load the library. More...
 
bool loadLibraries ()
 Load all libraries. More...
 
virtual void SetUp ()
 
bool unloadLibraries ()
 Unloads all libraries. More...
 
virtual isc::data::ElementPtr validConfigParams ()
 Creates a set configuration parameters valid for the library. More...
 
void validDaemonTest (const std::string &daemon_name, uint16_t family=AF_INET, const isc::data::ElementPtr &params=isc::data::ElementPtr())
 Verifies that a valid daemon can load and unload a library multiple times. More...
 

Public Attributes

std::string lib_so_name_
 full pathname to the library so file under test; More...
 
isc::hooks::HookLibsCollection libraries_
 Libraries. More...
 
isc::data::ElementPtr valid_params_
 Contains a set configuration parameters valid for the library. More...
 

Detailed Description

Test fixture for testing loading and unloading of hook libraries.

Definition at line 19 of file lib_load_test_fixture.h.

Constructor & Destructor Documentation

◆ LibLoadTest()

isc::test::LibLoadTest::LibLoadTest ( const std::string  lib_so_name = "no-lib-specified")
inline

Constructor.

Unloads any previously loaded libraries.

Parameters
lib_so_name_full pathname to the library so file under test

Definition at line 24 of file lib_load_test_fixture.h.

References unloadLibraries().

+ Here is the call graph for this function:

◆ ~LibLoadTest()

isc::test::LibLoadTest::~LibLoadTest ( )
inline

Destructor. Unloads any previously loaded libraries.

Definition at line 34 of file lib_load_test_fixture.h.

References unloadLibraries().

+ Here is the call graph for this function:

Member Function Documentation

◆ addLibrary()

void isc::test::LibLoadTest::addLibrary ( const std::string &  library,
isc::data::ConstElementPtr  parameters 
)
inline

Adds a library along with its parameters to the list of libraries to be loaded.

Parameters
librarythe path to the library to be loaded
parametersthe library's parameters in Element format

Definition at line 43 of file lib_load_test_fixture.h.

References libraries_.

Referenced by invalidDaemonTest(), and validDaemonTest().

◆ clearLibraries()

void isc::test::LibLoadTest::clearLibraries ( )
inline

Definition at line 48 of file lib_load_test_fixture.h.

References libraries_.

Referenced by invalidDaemonTest(), and validDaemonTest().

◆ invalidDaemonTest()

void isc::test::LibLoadTest::invalidDaemonTest ( const std::string &  daemon_name,
uint16_t  family = AF_INET,
const isc::data::ElementPtr params = isc::data::ElementPtr() 
)
inline

Verifies that an invalid daemon cannot load the library.

Parameters
libnamefull path to the library's SO. Typically this value is defined in the Makefile (e.g. -DLIBDHCP_BOOTP_SO=...)
daemon_namename of the daemon that should try to load the library
familyProtocol family of the loading daemon, either AF_INET or AF_INET6. Defaults to AF_INET.
paramsElementPtr to set of parameters that are valid for the library. Defaults to an empty pointer.
Note
: implemented here to avoid dependency with the dhcpsrv library.

Definition at line 113 of file lib_load_test_fixture.h.

References addLibrary(), ASSERT_NO_THROW_LOG, clearLibraries(), isc::dhcp::CfgMgr::instance(), lib_so_name_, loadLibraries(), isc::dhcp::CfgMgr::setFamily(), and isc::process::Daemon::setProcName().

+ Here is the call graph for this function:

◆ loadLibraries()

bool isc::test::LibLoadTest::loadLibraries ( )
inline

Load all libraries.

Returns
true if all libraries loaded successfully, false if one or more libraries failed to load.

Definition at line 56 of file lib_load_test_fixture.h.

References libraries_, and isc::hooks::HooksManager::loadLibraries().

Referenced by invalidDaemonTest(), and validDaemonTest().

+ Here is the call graph for this function:

◆ SetUp()

virtual void isc::test::LibLoadTest::SetUp ( )
inlinevirtual

Definition at line 29 of file lib_load_test_fixture.h.

References valid_params_, and validConfigParams().

+ Here is the call graph for this function:

◆ unloadLibraries()

bool isc::test::LibLoadTest::unloadLibraries ( )
inline

Unloads all libraries.

Returns
true if all libraries unloaded successfully, false if they are still in memory.

Definition at line 66 of file lib_load_test_fixture.h.

References isc::hooks::HooksManager::unloadLibraries().

Referenced by LibLoadTest(), ~LibLoadTest(), and validDaemonTest().

+ Here is the call graph for this function:

◆ validConfigParams()

virtual isc::data::ElementPtr isc::test::LibLoadTest::validConfigParams ( )
inlinevirtual

Creates a set configuration parameters valid for the library.

Definition at line 131 of file lib_load_test_fixture.h.

References isc::data::Element::createMap().

Referenced by SetUp().

+ Here is the call graph for this function:

◆ validDaemonTest()

void isc::test::LibLoadTest::validDaemonTest ( const std::string &  daemon_name,
uint16_t  family = AF_INET,
const isc::data::ElementPtr params = isc::data::ElementPtr() 
)
inline

Verifies that a valid daemon can load and unload a library multiple times.

Parameters
daemon_namename of the daemon that should try to load the library
familyProtocol family of the loading daemon, either AF_INET or AF_INET6. Defaults to AF_INET.
paramsElementPtr to set of parameters that are valid for the library. Defaults to an empty pointer.
Note
: implemented here to avoid dependency with the dhcpsrv library.

Definition at line 82 of file lib_load_test_fixture.h.

References addLibrary(), ASSERT_NO_THROW_LOG, clearLibraries(), isc::dhcp::CfgMgr::instance(), lib_so_name_, loadLibraries(), isc::dhcp::CfgMgr::setFamily(), isc::process::Daemon::setProcName(), and unloadLibraries().

+ Here is the call graph for this function:

Member Data Documentation

◆ lib_so_name_

std::string isc::test::LibLoadTest::lib_so_name_

full pathname to the library so file under test;

Definition at line 136 of file lib_load_test_fixture.h.

Referenced by invalidDaemonTest(), and validDaemonTest().

◆ libraries_

isc::hooks::HookLibsCollection isc::test::LibLoadTest::libraries_

Libraries.

Definition at line 139 of file lib_load_test_fixture.h.

Referenced by addLibrary(), clearLibraries(), and loadLibraries().

◆ valid_params_

isc::data::ElementPtr isc::test::LibLoadTest::valid_params_

Contains a set configuration parameters valid for the library.

Definition at line 142 of file lib_load_test_fixture.h.

Referenced by SetUp().


The documentation for this class was generated from the following file: