mirror of
https://gitlab.isc.org/isc-projects/kea
synced 2025-09-02 15:05:16 +00:00
[master] Merged trac4004 (enable-static and unit tests)
This commit is contained in:
26
configure.ac
26
configure.ac
@@ -241,13 +241,11 @@ AM_COND_IF([USE_STATIC_LINK], [AC_DEFINE([USE_STATIC_LINK], [1], [Was Kea static
|
|||||||
if test $enable_static_link = yes -a $enable_static = no; then
|
if test $enable_static_link = yes -a $enable_static = no; then
|
||||||
AC_MSG_ERROR([--enable-static-link requires --enable-static])
|
AC_MSG_ERROR([--enable-static-link requires --enable-static])
|
||||||
fi
|
fi
|
||||||
if test $enable_shared = no; then
|
if test $enable_static_link = no -a $enable_shared = no; then
|
||||||
AC_MSG_ERROR([Kea requires shared libraries to be built])
|
AC_MSG_ERROR([--disable-static-link requires --enable-shared])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# OS dependent configuration
|
# OS dependent configuration
|
||||||
SET_ENV_LIBRARY_PATH=no
|
|
||||||
ENV_LIBRARY_PATH=LD_LIBRARY_PATH
|
|
||||||
kea_undefined_pthread_behavior=no
|
kea_undefined_pthread_behavior=no
|
||||||
|
|
||||||
case "$host" in
|
case "$host" in
|
||||||
@@ -281,15 +279,6 @@ case "$host" in
|
|||||||
[AC_MSG_RESULT([OS X < 10.9])],
|
[AC_MSG_RESULT([OS X < 10.9])],
|
||||||
[AC_MSG_RESULT([OS X >= 10.9])
|
[AC_MSG_RESULT([OS X >= 10.9])
|
||||||
kea_undefined_pthread_behavior=yes])
|
kea_undefined_pthread_behavior=yes])
|
||||||
|
|
||||||
# libtool doesn't work perfectly with Darwin: libtool embeds the
|
|
||||||
# final install path in dynamic libraries and our loadable python
|
|
||||||
# modules always refer to that path even if it's loaded within the
|
|
||||||
# source tree. This prevents pre-install tests from working.
|
|
||||||
# To work around this problem we explicitly specify paths to dynamic
|
|
||||||
# libraries when we use them in the source tree.
|
|
||||||
SET_ENV_LIBRARY_PATH=yes
|
|
||||||
ENV_LIBRARY_PATH=DYLD_LIBRARY_PATH
|
|
||||||
;;
|
;;
|
||||||
*-freebsd*)
|
*-freebsd*)
|
||||||
# On FreeBSD10.1 pthread_cond_destroy doesn't work as documented, which
|
# On FreeBSD10.1 pthread_cond_destroy doesn't work as documented, which
|
||||||
@@ -302,19 +291,8 @@ case "$host" in
|
|||||||
# didn't seem to have support for the death tests on FreeBSD. As a
|
# didn't seem to have support for the death tests on FreeBSD. As a
|
||||||
# result, the test was not executed and the error didn't occur.
|
# result, the test was not executed and the error didn't occur.
|
||||||
kea_undefined_pthread_behavior=yes
|
kea_undefined_pthread_behavior=yes
|
||||||
|
|
||||||
SET_ENV_LIBRARY_PATH=yes
|
|
||||||
;;
|
|
||||||
*-netbsd*)
|
|
||||||
SET_ENV_LIBRARY_PATH=yes
|
|
||||||
;;
|
|
||||||
*-openbsd*)
|
|
||||||
SET_ENV_LIBRARY_PATH=yes
|
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
AM_CONDITIONAL(SET_ENV_LIBRARY_PATH, test $SET_ENV_LIBRARY_PATH = yes)
|
|
||||||
AC_SUBST(SET_ENV_LIBRARY_PATH)
|
|
||||||
AC_SUBST(ENV_LIBRARY_PATH)
|
|
||||||
if [ test $kea_undefined_pthread_behavior = "yes" ]; then
|
if [ test $kea_undefined_pthread_behavior = "yes" ]; then
|
||||||
AC_DEFINE([HAS_UNDEFINED_PTHREAD_BEHAVIOR], [1], [Does this platform have some undefined pthreads behavior?])
|
AC_DEFINE([HAS_UNDEFINED_PTHREAD_BEHAVIOR], [1], [Does this platform have some undefined pthreads behavior?])
|
||||||
fi
|
fi
|
||||||
|
@@ -207,7 +207,8 @@ private:
|
|||||||
// And the actual object type is the one that we expect.
|
// And the actual object type is the one that we expect.
|
||||||
// Note that for many options there are dedicated classes
|
// Note that for many options there are dedicated classes
|
||||||
// derived from Option class to represent them.
|
// derived from Option class to represent them.
|
||||||
EXPECT_TRUE(typeid(*option) == expected_type)
|
const Option* optptr = option.get();
|
||||||
|
EXPECT_TRUE(typeid(*optptr) == expected_type)
|
||||||
<< "Invalid class returned for option code " << code;
|
<< "Invalid class returned for option code " << code;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@@ -369,7 +369,8 @@ TEST_F(OptionDefinitionTest, ipv6AddressArray) {
|
|||||||
ASSERT_NO_THROW(
|
ASSERT_NO_THROW(
|
||||||
option_v6 = opt_def.optionFactory(Option::V6, D6O_NIS_SERVERS, buf);
|
option_v6 = opt_def.optionFactory(Option::V6, D6O_NIS_SERVERS, buf);
|
||||||
);
|
);
|
||||||
ASSERT_TRUE(typeid(*option_v6) == typeid(Option6AddrLst));
|
const Option* optptr = option_v6.get();
|
||||||
|
ASSERT_TRUE(typeid(*optptr) == typeid(Option6AddrLst));
|
||||||
boost::shared_ptr<Option6AddrLst> option_cast_v6 =
|
boost::shared_ptr<Option6AddrLst> option_cast_v6 =
|
||||||
boost::static_pointer_cast<Option6AddrLst>(option_v6);
|
boost::static_pointer_cast<Option6AddrLst>(option_v6);
|
||||||
ASSERT_TRUE(option_cast_v6);
|
ASSERT_TRUE(option_cast_v6);
|
||||||
@@ -424,7 +425,8 @@ TEST_F(OptionDefinitionTest, ipv6AddressArrayTokenized) {
|
|||||||
// Non-null pointer option is supposed to be returned and it
|
// Non-null pointer option is supposed to be returned and it
|
||||||
// should have Option6AddrLst type.
|
// should have Option6AddrLst type.
|
||||||
ASSERT_TRUE(option_v6);
|
ASSERT_TRUE(option_v6);
|
||||||
ASSERT_TRUE(typeid(*option_v6) == typeid(Option6AddrLst));
|
const Option* optptr = option_v6.get();
|
||||||
|
ASSERT_TRUE(typeid(*optptr) == typeid(Option6AddrLst));
|
||||||
// Cast to the actual option type to get IPv6 addresses from it.
|
// Cast to the actual option type to get IPv6 addresses from it.
|
||||||
boost::shared_ptr<Option6AddrLst> option_cast_v6 =
|
boost::shared_ptr<Option6AddrLst> option_cast_v6 =
|
||||||
boost::static_pointer_cast<Option6AddrLst>(option_v6);
|
boost::static_pointer_cast<Option6AddrLst>(option_v6);
|
||||||
@@ -467,7 +469,8 @@ TEST_F(OptionDefinitionTest, ipv4AddressArray) {
|
|||||||
ASSERT_NO_THROW(
|
ASSERT_NO_THROW(
|
||||||
option_v4 = opt_def.optionFactory(Option::V4, DHO_NAME_SERVERS, buf)
|
option_v4 = opt_def.optionFactory(Option::V4, DHO_NAME_SERVERS, buf)
|
||||||
);
|
);
|
||||||
ASSERT_TRUE(typeid(*option_v4) == typeid(Option4AddrLst));
|
const Option* optptr = option_v4.get();
|
||||||
|
ASSERT_TRUE(typeid(*optptr) == typeid(Option4AddrLst));
|
||||||
// Get the list of parsed addresses from the option object.
|
// Get the list of parsed addresses from the option object.
|
||||||
boost::shared_ptr<Option4AddrLst> option_cast_v4 =
|
boost::shared_ptr<Option4AddrLst> option_cast_v4 =
|
||||||
boost::static_pointer_cast<Option4AddrLst>(option_v4);
|
boost::static_pointer_cast<Option4AddrLst>(option_v4);
|
||||||
@@ -519,7 +522,8 @@ TEST_F(OptionDefinitionTest, ipv4AddressArrayTokenized) {
|
|||||||
// Non-null pointer option is supposed to be returned and it
|
// Non-null pointer option is supposed to be returned and it
|
||||||
// should have Option6AddrLst type.
|
// should have Option6AddrLst type.
|
||||||
ASSERT_TRUE(option_v4);
|
ASSERT_TRUE(option_v4);
|
||||||
ASSERT_TRUE(typeid(*option_v4) == typeid(Option4AddrLst));
|
const Option* optptr = option_v4.get();
|
||||||
|
ASSERT_TRUE(typeid(*optptr) == typeid(Option4AddrLst));
|
||||||
// Cast to the actual option type to get IPv4 addresses from it.
|
// Cast to the actual option type to get IPv4 addresses from it.
|
||||||
boost::shared_ptr<Option4AddrLst> option_cast_v4 =
|
boost::shared_ptr<Option4AddrLst> option_cast_v4 =
|
||||||
boost::static_pointer_cast<Option4AddrLst>(option_v4);
|
boost::static_pointer_cast<Option4AddrLst>(option_v4);
|
||||||
@@ -543,7 +547,8 @@ TEST_F(OptionDefinitionTest, empty) {
|
|||||||
ASSERT_NO_THROW(
|
ASSERT_NO_THROW(
|
||||||
option_v6 = opt_def.optionFactory(Option::V6, D6O_RAPID_COMMIT, OptionBuffer())
|
option_v6 = opt_def.optionFactory(Option::V6, D6O_RAPID_COMMIT, OptionBuffer())
|
||||||
);
|
);
|
||||||
ASSERT_TRUE(typeid(*option_v6) == typeid(Option));
|
const Option* optptr = option_v6.get();
|
||||||
|
ASSERT_TRUE(typeid(*optptr) == typeid(Option));
|
||||||
// Expect 'empty' DHCPv6 option.
|
// Expect 'empty' DHCPv6 option.
|
||||||
EXPECT_EQ(Option::V6, option_v6->getUniverse());
|
EXPECT_EQ(Option::V6, option_v6->getUniverse());
|
||||||
EXPECT_EQ(4, option_v6->getHeaderLen());
|
EXPECT_EQ(4, option_v6->getHeaderLen());
|
||||||
@@ -586,7 +591,8 @@ TEST_F(OptionDefinitionTest, emptyWithSuboptions) {
|
|||||||
sizeof(subopt_data)))
|
sizeof(subopt_data)))
|
||||||
);
|
);
|
||||||
// Returned option should be of the OptionCustom type.
|
// Returned option should be of the OptionCustom type.
|
||||||
ASSERT_TRUE(typeid(*option_v6) == typeid(OptionCustom));
|
const Option* optptr = option_v6.get();
|
||||||
|
ASSERT_TRUE(typeid(*optptr) == typeid(OptionCustom));
|
||||||
// Sanity-check length, universe etc.
|
// Sanity-check length, universe etc.
|
||||||
EXPECT_EQ(Option::V6, option_v6->getUniverse());
|
EXPECT_EQ(Option::V6, option_v6->getUniverse());
|
||||||
EXPECT_EQ(4, option_v6->getHeaderLen());
|
EXPECT_EQ(4, option_v6->getHeaderLen());
|
||||||
@@ -624,7 +630,8 @@ TEST_F(OptionDefinitionTest, binary) {
|
|||||||
option_v6 = opt_def.optionFactory(Option::V6, D6O_SERVERID, buf);
|
option_v6 = opt_def.optionFactory(Option::V6, D6O_SERVERID, buf);
|
||||||
);
|
);
|
||||||
// Expect base option type returned.
|
// Expect base option type returned.
|
||||||
ASSERT_TRUE(typeid(*option_v6) == typeid(Option));
|
const Option* optptr = option_v6.get();
|
||||||
|
ASSERT_TRUE(typeid(*optptr) == typeid(Option));
|
||||||
// Sanity check on universe, length and size. These are
|
// Sanity check on universe, length and size. These are
|
||||||
// the basic parameters identifying any option.
|
// the basic parameters identifying any option.
|
||||||
EXPECT_EQ(Option::V6, option_v6->getUniverse());
|
EXPECT_EQ(Option::V6, option_v6->getUniverse());
|
||||||
@@ -671,7 +678,8 @@ TEST_F(OptionDefinitionTest, recordIA6) {
|
|||||||
}
|
}
|
||||||
OptionPtr option_v6;
|
OptionPtr option_v6;
|
||||||
ASSERT_NO_THROW(option_v6 = opt_def.optionFactory(Option::V6, D6O_IA_NA, buf));
|
ASSERT_NO_THROW(option_v6 = opt_def.optionFactory(Option::V6, D6O_IA_NA, buf));
|
||||||
ASSERT_TRUE(typeid(*option_v6) == typeid(Option6IA));
|
const Option* optptr = option_v6.get();
|
||||||
|
ASSERT_TRUE(typeid(*optptr) == typeid(Option6IA));
|
||||||
boost::shared_ptr<Option6IA> option_cast_v6 =
|
boost::shared_ptr<Option6IA> option_cast_v6 =
|
||||||
boost::static_pointer_cast<Option6IA>(option_v6);
|
boost::static_pointer_cast<Option6IA>(option_v6);
|
||||||
EXPECT_EQ(0x00010203, option_cast_v6->getIAID());
|
EXPECT_EQ(0x00010203, option_cast_v6->getIAID());
|
||||||
@@ -714,7 +722,8 @@ TEST_F(OptionDefinitionTest, recordIAAddr6) {
|
|||||||
buf.push_back(i);
|
buf.push_back(i);
|
||||||
}
|
}
|
||||||
ASSERT_NO_THROW(option_v6 = opt_def.optionFactory(Option::V6, D6O_IAADDR, buf));
|
ASSERT_NO_THROW(option_v6 = opt_def.optionFactory(Option::V6, D6O_IAADDR, buf));
|
||||||
ASSERT_TRUE(typeid(*option_v6) == typeid(Option6IAAddr));
|
const Option* optptr = option_v6.get();
|
||||||
|
ASSERT_TRUE(typeid(*optptr) == typeid(Option6IAAddr));
|
||||||
boost::shared_ptr<Option6IAAddr> option_cast_v6 =
|
boost::shared_ptr<Option6IAAddr> option_cast_v6 =
|
||||||
boost::static_pointer_cast<Option6IAAddr>(option_v6);
|
boost::static_pointer_cast<Option6IAAddr>(option_v6);
|
||||||
EXPECT_EQ(addr_v6, option_cast_v6->getAddress());
|
EXPECT_EQ(addr_v6, option_cast_v6->getAddress());
|
||||||
@@ -751,7 +760,8 @@ TEST_F(OptionDefinitionTest, recordIAAddr6Tokenized) {
|
|||||||
OptionPtr option_v6;
|
OptionPtr option_v6;
|
||||||
ASSERT_NO_THROW(option_v6 = opt_def.optionFactory(Option::V6, D6O_IAADDR,
|
ASSERT_NO_THROW(option_v6 = opt_def.optionFactory(Option::V6, D6O_IAADDR,
|
||||||
data_field_values));
|
data_field_values));
|
||||||
ASSERT_TRUE(typeid(*option_v6) == typeid(Option6IAAddr));
|
const Option* optptr = option_v6.get();
|
||||||
|
ASSERT_TRUE(typeid(*optptr) == typeid(Option6IAAddr));
|
||||||
boost::shared_ptr<Option6IAAddr> option_cast_v6 =
|
boost::shared_ptr<Option6IAAddr> option_cast_v6 =
|
||||||
boost::static_pointer_cast<Option6IAAddr>(option_v6);
|
boost::static_pointer_cast<Option6IAAddr>(option_v6);
|
||||||
EXPECT_EQ("2001:db8::ff00:42:8329", option_cast_v6->getAddress().toText());
|
EXPECT_EQ("2001:db8::ff00:42:8329", option_cast_v6->getAddress().toText());
|
||||||
@@ -773,7 +783,8 @@ TEST_F(OptionDefinitionTest, boolValue) {
|
|||||||
option_v4 = opt_def.optionFactory(Option::V4, DHO_IP_FORWARDING,
|
option_v4 = opt_def.optionFactory(Option::V4, DHO_IP_FORWARDING,
|
||||||
OptionBuffer(1, 1));
|
OptionBuffer(1, 1));
|
||||||
);
|
);
|
||||||
ASSERT_TRUE(typeid(*option_v4) == typeid(OptionCustom));
|
const Option* optptr = option_v4.get();
|
||||||
|
ASSERT_TRUE(typeid(*optptr) == typeid(OptionCustom));
|
||||||
// Validate parsed value in the received option.
|
// Validate parsed value in the received option.
|
||||||
boost::shared_ptr<OptionCustom> option_cast_v4 =
|
boost::shared_ptr<OptionCustom> option_cast_v4 =
|
||||||
boost::static_pointer_cast<OptionCustom>(option_v4);
|
boost::static_pointer_cast<OptionCustom>(option_v4);
|
||||||
@@ -812,7 +823,8 @@ TEST_F(OptionDefinitionTest, boolTokenized) {
|
|||||||
option_v4 = opt_def.optionFactory(Option::V4, DHO_IP_FORWARDING,
|
option_v4 = opt_def.optionFactory(Option::V4, DHO_IP_FORWARDING,
|
||||||
values);
|
values);
|
||||||
);
|
);
|
||||||
ASSERT_TRUE(typeid(*option_v4) == typeid(OptionCustom));
|
const Option* optptr = option_v4.get();
|
||||||
|
ASSERT_TRUE(typeid(*optptr) == typeid(OptionCustom));
|
||||||
// Validate the value.
|
// Validate the value.
|
||||||
OptionCustomPtr option_cast_v4 =
|
OptionCustomPtr option_cast_v4 =
|
||||||
boost::static_pointer_cast<OptionCustom>(option_v4);
|
boost::static_pointer_cast<OptionCustom>(option_v4);
|
||||||
@@ -824,7 +836,8 @@ TEST_F(OptionDefinitionTest, boolTokenized) {
|
|||||||
option_v4 = opt_def.optionFactory(Option::V4, DHO_IP_FORWARDING,
|
option_v4 = opt_def.optionFactory(Option::V4, DHO_IP_FORWARDING,
|
||||||
values);
|
values);
|
||||||
);
|
);
|
||||||
ASSERT_TRUE(typeid(*option_v4) == typeid(OptionCustom));
|
optptr = option_v4.get();
|
||||||
|
ASSERT_TRUE(typeid(*optptr) == typeid(OptionCustom));
|
||||||
// Validate the value.
|
// Validate the value.
|
||||||
option_cast_v4 = boost::static_pointer_cast<OptionCustom>(option_v4);
|
option_cast_v4 = boost::static_pointer_cast<OptionCustom>(option_v4);
|
||||||
EXPECT_FALSE(option_cast_v4->readBoolean());
|
EXPECT_FALSE(option_cast_v4->readBoolean());
|
||||||
@@ -835,7 +848,8 @@ TEST_F(OptionDefinitionTest, boolTokenized) {
|
|||||||
option_v4 = opt_def.optionFactory(Option::V4, DHO_IP_FORWARDING,
|
option_v4 = opt_def.optionFactory(Option::V4, DHO_IP_FORWARDING,
|
||||||
values);
|
values);
|
||||||
);
|
);
|
||||||
ASSERT_TRUE(typeid(*option_v4) == typeid(OptionCustom));
|
optptr = option_v4.get();
|
||||||
|
ASSERT_TRUE(typeid(*optptr) == typeid(OptionCustom));
|
||||||
// Validate the value.
|
// Validate the value.
|
||||||
option_cast_v4 = boost::static_pointer_cast<OptionCustom>(option_v4);
|
option_cast_v4 = boost::static_pointer_cast<OptionCustom>(option_v4);
|
||||||
EXPECT_FALSE(option_cast_v4->readBoolean());
|
EXPECT_FALSE(option_cast_v4->readBoolean());
|
||||||
@@ -846,7 +860,8 @@ TEST_F(OptionDefinitionTest, boolTokenized) {
|
|||||||
option_v4 = opt_def.optionFactory(Option::V4, DHO_IP_FORWARDING,
|
option_v4 = opt_def.optionFactory(Option::V4, DHO_IP_FORWARDING,
|
||||||
values);
|
values);
|
||||||
);
|
);
|
||||||
ASSERT_TRUE(typeid(*option_v4) == typeid(OptionCustom));
|
optptr = option_v4.get();
|
||||||
|
ASSERT_TRUE(typeid(*optptr) == typeid(OptionCustom));
|
||||||
// Validate the value.
|
// Validate the value.
|
||||||
option_cast_v4 = boost::static_pointer_cast<OptionCustom>(option_v4);
|
option_cast_v4 = boost::static_pointer_cast<OptionCustom>(option_v4);
|
||||||
EXPECT_TRUE(option_cast_v4->readBoolean());
|
EXPECT_TRUE(option_cast_v4->readBoolean());
|
||||||
@@ -877,7 +892,8 @@ TEST_F(OptionDefinitionTest, uint8) {
|
|||||||
option_v6 = opt_def.optionFactory(Option::V6, D6O_PREFERENCE,
|
option_v6 = opt_def.optionFactory(Option::V6, D6O_PREFERENCE,
|
||||||
OptionBuffer(1, 1));
|
OptionBuffer(1, 1));
|
||||||
);
|
);
|
||||||
ASSERT_TRUE(typeid(*option_v6) == typeid(OptionInt<uint8_t>));
|
const Option* optptr = option_v6.get();
|
||||||
|
ASSERT_TRUE(typeid(*optptr) == typeid(OptionInt<uint8_t>));
|
||||||
// Validate the value.
|
// Validate the value.
|
||||||
boost::shared_ptr<OptionInt<uint8_t> > option_cast_v6 =
|
boost::shared_ptr<OptionInt<uint8_t> > option_cast_v6 =
|
||||||
boost::static_pointer_cast<OptionInt<uint8_t> >(option_v6);
|
boost::static_pointer_cast<OptionInt<uint8_t> >(option_v6);
|
||||||
@@ -905,7 +921,8 @@ TEST_F(OptionDefinitionTest, uint8Tokenized) {
|
|||||||
ASSERT_NO_THROW(
|
ASSERT_NO_THROW(
|
||||||
option_v6 = opt_def.optionFactory(Option::V6, D6O_PREFERENCE, values);
|
option_v6 = opt_def.optionFactory(Option::V6, D6O_PREFERENCE, values);
|
||||||
);
|
);
|
||||||
ASSERT_TRUE(typeid(*option_v6) == typeid(OptionInt<uint8_t>));
|
const Option* optptr = option_v6.get();
|
||||||
|
ASSERT_TRUE(typeid(*optptr) == typeid(OptionInt<uint8_t>));
|
||||||
// Validate the value.
|
// Validate the value.
|
||||||
boost::shared_ptr<OptionInt<uint8_t> > option_cast_v6 =
|
boost::shared_ptr<OptionInt<uint8_t> > option_cast_v6 =
|
||||||
boost::static_pointer_cast<OptionInt<uint8_t> >(option_v6);
|
boost::static_pointer_cast<OptionInt<uint8_t> >(option_v6);
|
||||||
@@ -928,7 +945,8 @@ TEST_F(OptionDefinitionTest, uint16) {
|
|||||||
ASSERT_NO_THROW(
|
ASSERT_NO_THROW(
|
||||||
option_v6 = opt_def.optionFactory(Option::V6, D6O_ELAPSED_TIME, buf);
|
option_v6 = opt_def.optionFactory(Option::V6, D6O_ELAPSED_TIME, buf);
|
||||||
);
|
);
|
||||||
ASSERT_TRUE(typeid(*option_v6) == typeid(OptionInt<uint16_t>));
|
const Option* optptr = option_v6.get();
|
||||||
|
ASSERT_TRUE(typeid(*optptr) == typeid(OptionInt<uint16_t>));
|
||||||
// Validate the value.
|
// Validate the value.
|
||||||
boost::shared_ptr<OptionInt<uint16_t> > option_cast_v6 =
|
boost::shared_ptr<OptionInt<uint16_t> > option_cast_v6 =
|
||||||
boost::static_pointer_cast<OptionInt<uint16_t> >(option_v6);
|
boost::static_pointer_cast<OptionInt<uint16_t> >(option_v6);
|
||||||
@@ -957,7 +975,8 @@ TEST_F(OptionDefinitionTest, uint16Tokenized) {
|
|||||||
ASSERT_NO_THROW(
|
ASSERT_NO_THROW(
|
||||||
option_v6 = opt_def.optionFactory(Option::V6, D6O_ELAPSED_TIME, values);
|
option_v6 = opt_def.optionFactory(Option::V6, D6O_ELAPSED_TIME, values);
|
||||||
);
|
);
|
||||||
ASSERT_TRUE(typeid(*option_v6) == typeid(OptionInt<uint16_t>));
|
const Option* optptr = option_v6.get();
|
||||||
|
ASSERT_TRUE(typeid(*optptr) == typeid(OptionInt<uint16_t>));
|
||||||
// Validate the value.
|
// Validate the value.
|
||||||
boost::shared_ptr<OptionInt<uint16_t> > option_cast_v6 =
|
boost::shared_ptr<OptionInt<uint16_t> > option_cast_v6 =
|
||||||
boost::static_pointer_cast<OptionInt<uint16_t> >(option_v6);
|
boost::static_pointer_cast<OptionInt<uint16_t> >(option_v6);
|
||||||
@@ -982,7 +1001,8 @@ TEST_F(OptionDefinitionTest, uint32) {
|
|||||||
ASSERT_NO_THROW(
|
ASSERT_NO_THROW(
|
||||||
option_v6 = opt_def.optionFactory(Option::V6, D6O_CLT_TIME, buf);
|
option_v6 = opt_def.optionFactory(Option::V6, D6O_CLT_TIME, buf);
|
||||||
);
|
);
|
||||||
ASSERT_TRUE(typeid(*option_v6) == typeid(OptionInt<uint32_t>));
|
const Option* optptr = option_v6.get();
|
||||||
|
ASSERT_TRUE(typeid(*optptr) == typeid(OptionInt<uint32_t>));
|
||||||
// Validate the value.
|
// Validate the value.
|
||||||
boost::shared_ptr<OptionInt<uint32_t> > option_cast_v6 =
|
boost::shared_ptr<OptionInt<uint32_t> > option_cast_v6 =
|
||||||
boost::static_pointer_cast<OptionInt<uint32_t> >(option_v6);
|
boost::static_pointer_cast<OptionInt<uint32_t> >(option_v6);
|
||||||
@@ -1010,7 +1030,8 @@ TEST_F(OptionDefinitionTest, uint32Tokenized) {
|
|||||||
ASSERT_NO_THROW(
|
ASSERT_NO_THROW(
|
||||||
option_v6 = opt_def.optionFactory(Option::V6, D6O_CLT_TIME, values);
|
option_v6 = opt_def.optionFactory(Option::V6, D6O_CLT_TIME, values);
|
||||||
);
|
);
|
||||||
ASSERT_TRUE(typeid(*option_v6) == typeid(OptionInt<uint32_t>));
|
const Option* optptr = option_v6.get();
|
||||||
|
ASSERT_TRUE(typeid(*optptr) == typeid(OptionInt<uint32_t>));
|
||||||
// Validate the value.
|
// Validate the value.
|
||||||
boost::shared_ptr<OptionInt<uint32_t> > option_cast_v6 =
|
boost::shared_ptr<OptionInt<uint32_t> > option_cast_v6 =
|
||||||
boost::static_pointer_cast<OptionInt<uint32_t> >(option_v6);
|
boost::static_pointer_cast<OptionInt<uint32_t> >(option_v6);
|
||||||
@@ -1039,7 +1060,8 @@ TEST_F(OptionDefinitionTest, uint16Array) {
|
|||||||
EXPECT_NO_THROW(
|
EXPECT_NO_THROW(
|
||||||
option_v6 = opt_def.optionFactory(Option::V6, opt_code, buf);
|
option_v6 = opt_def.optionFactory(Option::V6, opt_code, buf);
|
||||||
);
|
);
|
||||||
ASSERT_TRUE(typeid(*option_v6) == typeid(OptionIntArray<uint16_t>));
|
const Option* optptr = option_v6.get();
|
||||||
|
ASSERT_TRUE(typeid(*optptr) == typeid(OptionIntArray<uint16_t>));
|
||||||
boost::shared_ptr<OptionIntArray<uint16_t> > option_cast_v6 =
|
boost::shared_ptr<OptionIntArray<uint16_t> > option_cast_v6 =
|
||||||
boost::static_pointer_cast<OptionIntArray<uint16_t> >(option_v6);
|
boost::static_pointer_cast<OptionIntArray<uint16_t> >(option_v6);
|
||||||
// Get the values from the initiated options and validate.
|
// Get the values from the initiated options and validate.
|
||||||
@@ -1081,7 +1103,8 @@ TEST_F(OptionDefinitionTest, uint16ArrayTokenized) {
|
|||||||
EXPECT_NO_THROW(
|
EXPECT_NO_THROW(
|
||||||
option_v6 = opt_def.optionFactory(Option::V6, opt_code, str_values);
|
option_v6 = opt_def.optionFactory(Option::V6, opt_code, str_values);
|
||||||
);
|
);
|
||||||
ASSERT_TRUE(typeid(*option_v6) == typeid(OptionIntArray<uint16_t>));
|
const Option* optptr = option_v6.get();
|
||||||
|
ASSERT_TRUE(typeid(*optptr) == typeid(OptionIntArray<uint16_t>));
|
||||||
boost::shared_ptr<OptionIntArray<uint16_t> > option_cast_v6 =
|
boost::shared_ptr<OptionIntArray<uint16_t> > option_cast_v6 =
|
||||||
boost::static_pointer_cast<OptionIntArray<uint16_t> >(option_v6);
|
boost::static_pointer_cast<OptionIntArray<uint16_t> >(option_v6);
|
||||||
// Get the values from the initiated options and validate.
|
// Get the values from the initiated options and validate.
|
||||||
@@ -1112,7 +1135,8 @@ TEST_F(OptionDefinitionTest, uint32Array) {
|
|||||||
EXPECT_NO_THROW(
|
EXPECT_NO_THROW(
|
||||||
option_v6 = opt_def.optionFactory(Option::V6, opt_code, buf);
|
option_v6 = opt_def.optionFactory(Option::V6, opt_code, buf);
|
||||||
);
|
);
|
||||||
ASSERT_TRUE(typeid(*option_v6) == typeid(OptionIntArray<uint32_t>));
|
const Option* optptr = option_v6.get();
|
||||||
|
ASSERT_TRUE(typeid(*optptr) == typeid(OptionIntArray<uint32_t>));
|
||||||
boost::shared_ptr<OptionIntArray<uint32_t> > option_cast_v6 =
|
boost::shared_ptr<OptionIntArray<uint32_t> > option_cast_v6 =
|
||||||
boost::static_pointer_cast<OptionIntArray<uint32_t> >(option_v6);
|
boost::static_pointer_cast<OptionIntArray<uint32_t> >(option_v6);
|
||||||
// Get the values from the initiated options and validate.
|
// Get the values from the initiated options and validate.
|
||||||
@@ -1157,7 +1181,8 @@ TEST_F(OptionDefinitionTest, uint32ArrayTokenized) {
|
|||||||
EXPECT_NO_THROW(
|
EXPECT_NO_THROW(
|
||||||
option_v6 = opt_def.optionFactory(Option::V6, opt_code, str_values);
|
option_v6 = opt_def.optionFactory(Option::V6, opt_code, str_values);
|
||||||
);
|
);
|
||||||
ASSERT_TRUE(typeid(*option_v6) == typeid(OptionIntArray<uint32_t>));
|
const Option* optptr = option_v6.get();
|
||||||
|
ASSERT_TRUE(typeid(*optptr) == typeid(OptionIntArray<uint32_t>));
|
||||||
boost::shared_ptr<OptionIntArray<uint32_t> > option_cast_v6 =
|
boost::shared_ptr<OptionIntArray<uint32_t> > option_cast_v6 =
|
||||||
boost::static_pointer_cast<OptionIntArray<uint32_t> >(option_v6);
|
boost::static_pointer_cast<OptionIntArray<uint32_t> >(option_v6);
|
||||||
// Get the values from the initiated options and validate.
|
// Get the values from the initiated options and validate.
|
||||||
@@ -1183,7 +1208,8 @@ TEST_F(OptionDefinitionTest, utf8StringTokenized) {
|
|||||||
option_v6 = opt_def.optionFactory(Option::V6, opt_code, values);
|
option_v6 = opt_def.optionFactory(Option::V6, opt_code, values);
|
||||||
);
|
);
|
||||||
ASSERT_TRUE(option_v6);
|
ASSERT_TRUE(option_v6);
|
||||||
ASSERT_TRUE(typeid(*option_v6) == typeid(OptionString));
|
const Option* optptr = option_v6.get();
|
||||||
|
ASSERT_TRUE(typeid(*optptr) == typeid(OptionString));
|
||||||
OptionStringPtr option_v6_string =
|
OptionStringPtr option_v6_string =
|
||||||
boost::static_pointer_cast<OptionString>(option_v6);
|
boost::static_pointer_cast<OptionString>(option_v6);
|
||||||
EXPECT_TRUE(values[0] == option_v6_string->getValue());
|
EXPECT_TRUE(values[0] == option_v6_string->getValue());
|
||||||
|
@@ -40,7 +40,7 @@ lib_LTLIBRARIES = libkea-hooks.la
|
|||||||
libkea_hooks_la_SOURCES =
|
libkea_hooks_la_SOURCES =
|
||||||
libkea_hooks_la_SOURCES += callout_handle.cc callout_handle.h
|
libkea_hooks_la_SOURCES += callout_handle.cc callout_handle.h
|
||||||
libkea_hooks_la_SOURCES += callout_manager.cc callout_manager.h
|
libkea_hooks_la_SOURCES += callout_manager.cc callout_manager.h
|
||||||
libkea_hooks_la_SOURCES += hooks.h hooks.cc
|
libkea_hooks_la_SOURCES += hooks.h
|
||||||
libkea_hooks_la_SOURCES += hooks_log.cc hooks_log.h
|
libkea_hooks_la_SOURCES += hooks_log.cc hooks_log.h
|
||||||
libkea_hooks_la_SOURCES += hooks_manager.cc hooks_manager.h
|
libkea_hooks_la_SOURCES += hooks_manager.cc hooks_manager.h
|
||||||
libkea_hooks_la_SOURCES += library_handle.cc library_handle.h
|
libkea_hooks_la_SOURCES += library_handle.cc library_handle.h
|
||||||
|
@@ -1,36 +0,0 @@
|
|||||||
// Copyright (C) 2013, 2015 Internet Systems Consortium, Inc. ("ISC")
|
|
||||||
//
|
|
||||||
// Permission to use, copy, modify, and/or distribute this software for any
|
|
||||||
// purpose with or without fee is hereby granted, provided that the above
|
|
||||||
// copyright notice and this permission notice appear in all copies.
|
|
||||||
//
|
|
||||||
// THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
|
|
||||||
// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
||||||
// AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
||||||
// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
||||||
// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
|
||||||
// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
||||||
// PERFORMANCE OF THIS SOFTWARE.
|
|
||||||
|
|
||||||
#include <config.h>
|
|
||||||
|
|
||||||
#include <hooks/hooks.h>
|
|
||||||
#include <log/logger_support.h>
|
|
||||||
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
|
|
||||||
namespace isc {
|
|
||||||
namespace hooks {
|
|
||||||
|
|
||||||
// Load the logging message dictionary if not already loaded
|
|
||||||
|
|
||||||
void
|
|
||||||
hooksStaticLinkInit() {
|
|
||||||
if (!isc::log::isLoggingInitialized()) {
|
|
||||||
isc::log::initLogger(std::string("userlib"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace hooks
|
|
||||||
} // namespace isc
|
|
@@ -23,6 +23,7 @@
|
|||||||
#include <hooks/pointer_converter.h>
|
#include <hooks/pointer_converter.h>
|
||||||
#include <hooks/server_hooks.h>
|
#include <hooks/server_hooks.h>
|
||||||
#include <log/logger_manager.h>
|
#include <log/logger_manager.h>
|
||||||
|
#include <log/logger_support.h>
|
||||||
#include <log/message_initializer.h>
|
#include <log/message_initializer.h>
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
@@ -375,5 +376,13 @@ LibraryManager::validateLibrary(const std::string& name) {
|
|||||||
return (validated);
|
return (validated);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @note Moved from its own hooks.cc file to avoid undefined reference
|
||||||
|
// with static link.
|
||||||
|
void hooksStaticLinkInit() {
|
||||||
|
if (!isc::log::isLoggingInitialized()) {
|
||||||
|
isc::log::initLogger(std::string("userlib"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace hooks
|
} // namespace hooks
|
||||||
} // namespace isc
|
} // namespace isc
|
||||||
|
@@ -75,14 +75,12 @@ libbcl_la_SOURCES = basic_callout_library.cc
|
|||||||
libbcl_la_CXXFLAGS = $(AM_CXXFLAGS)
|
libbcl_la_CXXFLAGS = $(AM_CXXFLAGS)
|
||||||
libbcl_la_CPPFLAGS = $(AM_CPPFLAGS)
|
libbcl_la_CPPFLAGS = $(AM_CPPFLAGS)
|
||||||
libbcl_la_LDFLAGS = -avoid-version -export-dynamic -module -rpath /nowhere
|
libbcl_la_LDFLAGS = -avoid-version -export-dynamic -module -rpath /nowhere
|
||||||
libbcl_la_LIBADD = $(ALL_LIBS)
|
|
||||||
|
|
||||||
# The load callout library - contains a load function
|
# The load callout library - contains a load function
|
||||||
liblcl_la_SOURCES = load_callout_library.cc
|
liblcl_la_SOURCES = load_callout_library.cc
|
||||||
liblcl_la_CXXFLAGS = $(AM_CXXFLAGS)
|
liblcl_la_CXXFLAGS = $(AM_CXXFLAGS)
|
||||||
liblcl_la_CPPFLAGS = $(AM_CPPFLAGS)
|
liblcl_la_CPPFLAGS = $(AM_CPPFLAGS)
|
||||||
liblcl_la_LDFLAGS = -avoid-version -export-dynamic -module -rpath /nowhere
|
liblcl_la_LDFLAGS = -avoid-version -export-dynamic -module -rpath /nowhere
|
||||||
liblcl_la_LIBADD = $(ALL_LIBS)
|
|
||||||
|
|
||||||
# The load error callout library - contains a load function that returns
|
# The load error callout library - contains a load function that returns
|
||||||
# an error.
|
# an error.
|
||||||
@@ -103,7 +101,6 @@ libfcl_la_SOURCES = full_callout_library.cc
|
|||||||
libfcl_la_CXXFLAGS = $(AM_CXXFLAGS)
|
libfcl_la_CXXFLAGS = $(AM_CXXFLAGS)
|
||||||
libfcl_la_CPPFLAGS = $(AM_CPPFLAGS)
|
libfcl_la_CPPFLAGS = $(AM_CPPFLAGS)
|
||||||
libfcl_la_LDFLAGS = -avoid-version -export-dynamic -module -rpath /nowhere
|
libfcl_la_LDFLAGS = -avoid-version -export-dynamic -module -rpath /nowhere
|
||||||
libfcl_la_LIBADD = $(ALL_LIBS)
|
|
||||||
|
|
||||||
TESTS += run_unittests
|
TESTS += run_unittests
|
||||||
run_unittests_SOURCES = run_unittests.cc
|
run_unittests_SOURCES = run_unittests.cc
|
||||||
@@ -123,7 +120,7 @@ run_unittests_CXXFLAGS = $(AM_CXXFLAGS)
|
|||||||
run_unittests_CPPFLAGS = $(AM_CPPFLAGS) $(GTEST_INCLUDES)
|
run_unittests_CPPFLAGS = $(AM_CPPFLAGS) $(GTEST_INCLUDES)
|
||||||
run_unittests_LDFLAGS = $(AM_LDFLAGS) $(GTEST_LDFLAGS)
|
run_unittests_LDFLAGS = $(AM_LDFLAGS) $(GTEST_LDFLAGS)
|
||||||
if USE_STATIC_LINK
|
if USE_STATIC_LINK
|
||||||
run_unittests_LDFLAGS += -static
|
run_unittests_LDFLAGS += -static -export-dynamic
|
||||||
endif
|
endif
|
||||||
|
|
||||||
run_unittests_LDADD = $(AM_LDADD)
|
run_unittests_LDADD = $(AM_LDADD)
|
||||||
@@ -140,13 +137,6 @@ run_unittests_LDADD += $(GTEST_LDADD)
|
|||||||
# environment where we have to set the library path AND if linking statically,
|
# environment where we have to set the library path AND if linking statically,
|
||||||
# override the "check" target and run the unit tests ourselves.
|
# override the "check" target and run the unit tests ourselves.
|
||||||
|
|
||||||
if USE_STATIC_LINK
|
|
||||||
if SET_ENV_LIBRARY_PATH
|
|
||||||
check-TESTS:
|
|
||||||
$(LIBTOOL) --mode=execute -dlopen $(HOOKS_LIB) -dlopen $(LOG_LIB) -dlopen $(THREADS_LIB) -dlopen $(UTIL_LIB) -dlopen $(EXCEPTIONS_LIB) ./run_unittests
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
noinst_PROGRAMS = $(TESTS)
|
noinst_PROGRAMS = $(TESTS)
|
||||||
|
Reference in New Issue
Block a user