From: Tomek Mrugalski Date: Wed, 25 Jul 2018 21:25:43 +0000 (+0200) Subject: [5682] get-config unit-test rebuilds partially automated. X-Git-Tag: ha_phase2~20 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9e14140b26d4037cbf29e1cfcb4b0ebc98476d2f;p=thirdparty%2Fkea.git [5682] get-config unit-test rebuilds partially automated. --- diff --git a/src/bin/dhcp4/json_config_parser.cc b/src/bin/dhcp4/json_config_parser.cc index acdb52d3ca..758f23a8f3 100644 --- a/src/bin/dhcp4/json_config_parser.cc +++ b/src/bin/dhcp4/json_config_parser.cc @@ -392,6 +392,7 @@ configureDhcp4Server(Dhcpv4Srv& server, isc::data::ConstElementPtr config_set, if (config_pair.first == "sanity-checks") { SanityChecksParser parser; parser.parse(*srv_cfg, config_pair.second); + continue; } if (config_pair.first == "expired-leases-processing") { diff --git a/src/bin/dhcp4/tests/Makefile.am b/src/bin/dhcp4/tests/Makefile.am index f23e046e05..0c31643ae6 100644 --- a/src/bin/dhcp4/tests/Makefile.am +++ b/src/bin/dhcp4/tests/Makefile.am @@ -145,3 +145,21 @@ endif noinst_EXTRA_DIST = configs-list.txt noinst_PROGRAMS = $(TESTS) + +# Use this target if you want to rebuild the get-config unit-tests. +# +# TODO: We could also automate the replacement step with some variation +# of this: https://stackoverflow.com/questions/6790631 +rebuild-tests: + rm -f x u get_config_unittest.cc + cp -f get_config_unittest.cc.skel get_config_unittest.cc + $(MAKE) CXXFLAGS=-DEXTRACT_CONFIG V=1 + ./dhcp4_unittests --gtest_filter="Dhcp4Parser*" > /dev/null 2> x + echo "Please copy content of x file into EXTRACTED_CONFIGS in get_config_unittest.cc" + read -p "Press ENTER when ready" + $(MAKE) CXXFLAGS=-DGENERATE_ACTION V=1 + ./dhcp4_unittests --gtest_filter="Dhcp4GetConfig*" > /dev/null 2> u + echo "Please copy content of u file into UNPARSED_CONFIGS in get_config_unittest.cc" + read -p "Press ENTER when ready" + touch get_config_unittest.cc + $(MAKE) diff --git a/src/bin/dhcp6/json_config_parser.cc b/src/bin/dhcp6/json_config_parser.cc index 2de5e36898..c59395a4e0 100644 --- a/src/bin/dhcp6/json_config_parser.cc +++ b/src/bin/dhcp6/json_config_parser.cc @@ -506,6 +506,7 @@ configureDhcp6Server(Dhcpv6Srv& server, isc::data::ConstElementPtr config_set, if (config_pair.first == "sanity-checks") { SanityChecksParser parser; parser.parse(*srv_config, config_pair.second); + continue; } if (config_pair.first == "expired-leases-processing") { diff --git a/src/bin/dhcp6/tests/Makefile.am b/src/bin/dhcp6/tests/Makefile.am index 70dfc4176b..f862c374a1 100644 --- a/src/bin/dhcp6/tests/Makefile.am +++ b/src/bin/dhcp6/tests/Makefile.am @@ -144,3 +144,21 @@ dhcp6_unittests_LDADD += $(BOOST_LIBS) $(GTEST_LDADD) endif noinst_PROGRAMS = $(TESTS) + +# Use this target if you want to rebuild the get-config unit-tests. +# +# TODO: We could also automate the replacement step with some variation +# of this: https://stackoverflow.com/questions/6790631 +rebuild-tests: + rm -f x u get_config_unittest.cc + cp -f get_config_unittest.cc.skel get_config_unittest.cc + $(MAKE) CXXFLAGS=-DEXTRACT_CONFIG V=1 + ./dhcp6_unittests --gtest_filter="Dhcp6Parser*" > /dev/null 2> x + echo "Please copy content of x file into EXTRACTED_CONFIGS in get_config_unittest.cc" + read -p "Press ENTER when ready" + $(MAKE) CXXFLAGS=-DGENERATE_ACTION V=1 + ./dhcp6_unittests --gtest_filter="Dhcp6GetConfig*" > /dev/null 2> u + echo "Please copy content of u file into UNPARSED_CONFIGS in get_config_unittest.cc" + read -p "Press ENTER when ready" + touch get_config_unittest.cc + $(MAKE)