/// @brief unparsed configurations
const char* UNPARSED_CONFIGS[] = {
-///put this after const char* UNPARSED_CONFIGS[] = {
+/// put this after const char* UNPARSED_CONFIGS[] = {
// CONFIGURATION 0
"{\n"
" \"allocator\": \"iterative\",\n"
--- /dev/null
+#!/bin/sh
+
+set -eu
+
+pwd=$(pwd -P)
+cd "@builddir@"
+npwd=$(pwd -P)
+
+if test "$pwd" != "$npwd"; then
+ echo "This script should be run from the build directory (@builddir@)"
+ read -p "Press ENTER to continue anyway"
+fi
+
+# Initialize.
+rm -f x u get_config_unittest_rebuild.cc
+cp -f "@skeleton@" get_config_unittest_rebuild.cc
+rm -f kea-dhcp4-tests-extract
+echo "Please recompile kea-dhcp4-tests-extract"
+read -p "Press ENTER when ready"
+
+# Extract step.
+./kea-dhcp4-tests-extract --gtest_filter="Dhcp4Parser*" > /dev/null 2> x
+rm -f kea-dhcp4-tests-generate
+echo "Please copy content of x file into EXTRACTED_CONFIGS in get_config_unittest_rebuild.cc and recompile kea-dhcp4-tests-generate"
+read -p "Press ENTER when ready"
+
+# Generate step
+./kea-dhcp4-tests-generate --gtest_filter="Dhcp4GetConfig*" > /dev/null 2> u
+echo "Please copy content of u file into UNPARSED_CONFIGS in get_config_unittest_rebuild.cc"
+read -p "Press ENTER when ready"
+mv get_config_unittest_rebuild.cc get_config_unittest.cc
+cp -f get_config_unittest.cc "@source@"
+echo "Please recompile the kea_dhcp4_tests target"
+echo "When done with success you can check it (test suite is Dhcp4GetConfigTest)"
name_suffix: 'so',
)
+dhcp4_tests_cpp_args = [
+ f'-DTEST_DATA_BUILDDIR="@current_build_dir@"',
+ f'-DCFG_EXAMPLES="@TOP_SOURCE_DIR@/doc/examples/kea4"',
+ f'-DDHCP_DATA_DIR="@current_build_dir@"',
+ f'-DSYNTAX_FILE="@current_source_dir@/../dhcp4_parser.yy"',
+ f'-DKEA_LFC_EXECUTABLE="@KEA_LFC_BUILT@"',
+ f'-DTEST_CA_DIR="@TEST_CA_DIR@"',
+]
+
# Not yet used configs-list.txt
kea_dhcp4_tests = executable(
'kea-dhcp4-tests',
'shared_network_unittest.cc',
'simple_parser4_unittest.cc',
'vendor_opts_unittest.cc',
- cpp_args: [
- f'-DTEST_DATA_BUILDDIR="@current_build_dir@"',
- f'-DCFG_EXAMPLES="@TOP_SOURCE_DIR@/doc/examples/kea4"',
- f'-DDHCP_DATA_DIR="@current_build_dir@"',
- f'-DSYNTAX_FILE="@current_source_dir@/../dhcp4_parser.yy"',
- f'-DKEA_LFC_EXECUTABLE="@KEA_LFC_BUILT@"',
- f'-DTEST_CA_DIR="@TEST_CA_DIR@"',
- ],
+ cpp_args: dhcp4_tests_cpp_args,
dependencies: dhcp4_tests_deps,
include_directories: [include_directories('.')] + INCLUDES,
link_with: [dhcp4_lib] + dhcp4_tests_libs + LIBS_BUILT_SO_FAR,
timeout: 60,
)
+get_config_unittest_rebuild = configure_file(
+ input: 'get_config_unittest.cc.skel',
+ output: 'get_config_unittest_rebuild.cc',
+ copy: true,
+)
+kea_dhcp4_tests_extract = executable(
+ 'kea-dhcp4-tests-extract',
+ get_config_unittest_rebuild,
+ 'config_parser_unittest.cc',
+ objects: kea_dhcp4_tests.extract_objects(
+ 'dhcp4_test_utils.cc',
+ 'dhcp4_unittests.cc',
+ 'marker_file.cc',
+ ),
+ cpp_args: ['-DEXTRACT_CONFIG'] + dhcp4_tests_cpp_args,
+ dependencies: dhcp4_tests_deps,
+ include_directories: [include_directories('.')] + INCLUDES,
+ link_with: [dhcp4_lib] + dhcp4_tests_libs + LIBS_BUILT_SO_FAR,
+ build_by_default: false,
+)
+kea_dhcp4_tests_generate = executable(
+ 'kea-dhcp4-tests-generate',
+ get_config_unittest_rebuild,
+ 'config_parser_unittest.cc',
+ objects: kea_dhcp4_tests.extract_objects(
+ 'dhcp4_test_utils.cc',
+ 'dhcp4_unittests.cc',
+ 'marker_file.cc',
+ ),
+ cpp_args: ['-DGENERATE_ACTION'] + dhcp4_tests_cpp_args,
+ dependencies: dhcp4_tests_deps,
+ include_directories: [include_directories('.')] + INCLUDES,
+ link_with: [dhcp4_lib] + dhcp4_tests_libs + LIBS_BUILT_SO_FAR,
+ build_by_default: false,
+)
+
+make_rebuild_conf = configuration_data()
+make_rebuild_conf.set('builddir', current_build_dir)
+make_rebuild_conf.set('source', current_source_dir / 'get_config_unittest.cc')
+make_rebuild_conf.set(
+ 'skeleton',
+ current_source_dir / 'get_config_unittest.cc.skel',
+)
+make_rebuild = configure_file(
+ input: 'make-rebuild.sh.in',
+ output: 'make-rebuild.sh',
+ configuration: make_rebuild_conf,
+)
+# Better when not use as a target.
+find_program(make_rebuild, required: true)
--- /dev/null
+#!/bin/sh
+
+set -eu
+
+pwd=$(pwd -P)
+cd "@builddir@"
+npwd=$(pwd -P)
+
+if test "$pwd" != "$npwd"; then
+ echo "This script should be run from the build directory (@builddir@)"
+ read -p "Press ENTER to continue anyway"
+fi
+
+# Initialize.
+rm -f x u get_config_unittest_rebuild.cc
+cp -f "@skeleton@" get_config_unittest_rebuild.cc
+rm -f kea-dhcp6-tests-extract
+echo "Please recompile kea-dhcp6-tests-extract"
+read -p "Press ENTER when ready"
+
+# Extract step.
+./kea-dhcp6-tests-extract --gtest_filter="Dhcp6Parser*" > /dev/null 2> x
+rm -f kea-dhcp6-tests-generate
+echo "Please copy content of x file into EXTRACTED_CONFIGS in get_config_unittest_rebuild.cc and recompile kea-dhcp6-tests-generate"
+read -p "Press ENTER when ready"
+
+# Generate step
+./kea-dhcp6-tests-generate --gtest_filter="Dhcp6GetConfig*" > /dev/null 2> u
+echo "Please copy content of u file into UNPARSED_CONFIGS in get_config_unittest_rebuild.cc"
+read -p "Press ENTER when ready"
+mv get_config_unittest_rebuild.cc get_config_unittest.cc
+cp -f get_config_unittest.cc "@source@"
+echo "Please recompile the kea_dhcp6_tests target"
+echo "When done with success you can check it (test suite is Dhcp6GetConfigTest)"
name_suffix: 'so',
)
+dhcp6_tests_cpp_args = [
+ f'-DTOP_BUILDDIR="@TOP_BUILD_DIR@"',
+ f'-DTEST_DATA_BUILDDIR="@current_build_dir@"',
+ f'-DCFG_EXAMPLES="@TOP_SOURCE_DIR@/doc/examples/kea6"',
+ f'-DDHCP_DATA_DIR="@current_build_dir@"',
+ f'-DSYNTAX_FILE="@current_source_dir@/../dhcp6_parser.yy"',
+ f'-DKEA_LFC_EXECUTABLE="@KEA_LFC_BUILT@"',
+ f'-DTEST_CA_DIR="@TEST_CA_DIR@"',
+]
+
kea_dhcp6_tests = executable(
'kea-dhcp6-tests',
'addr_reg_unittest.cc',
'simple_parser6_unittest.cc',
'tee_times_unittest.cc',
'vendor_opts_unittest.cc',
- cpp_args: [
- f'-DTOP_BUILDDIR="@TOP_BUILD_DIR@"',
- f'-DTEST_DATA_BUILDDIR="@current_build_dir@"',
- f'-DCFG_EXAMPLES="@TOP_SOURCE_DIR@/doc/examples/kea6"',
- f'-DDHCP_DATA_DIR="@current_build_dir@"',
- f'-DSYNTAX_FILE="@current_source_dir@/../dhcp6_parser.yy"',
- f'-DKEA_LFC_EXECUTABLE="@KEA_LFC_BUILT@"',
- f'-DTEST_CA_DIR="@TEST_CA_DIR@"',
- ],
+ cpp_args: dhcp6_tests_cpp_args,
dependencies: dhcp6_tests_deps,
include_directories: [include_directories('.')] + INCLUDES,
link_with: [dhcp6_lib] + dhcp6_tests_libs + LIBS_BUILT_SO_FAR,
timeout: 60,
)
+get_config_unittest_rebuild = configure_file(
+ input: 'get_config_unittest.cc.skel',
+ output: 'get_config_unittest_rebuild.cc',
+ copy: true,
+)
+kea_dhcp6_tests_extract = executable(
+ 'kea-dhcp6-tests-extract',
+ get_config_unittest_rebuild,
+ 'config_parser_unittest.cc',
+ objects: kea_dhcp6_tests.extract_objects(
+ 'dhcp6_client.cc',
+ 'dhcp6_test_utils.cc',
+ 'dhcp6_unittests.cc',
+ 'marker_file.cc',
+ ),
+ cpp_args: ['-DEXTRACT_CONFIG'] + dhcp6_tests_cpp_args,
+ dependencies: dhcp6_tests_deps,
+ include_directories: [include_directories('.')] + INCLUDES,
+ link_with: [dhcp6_lib] + dhcp6_tests_libs + LIBS_BUILT_SO_FAR,
+ build_by_default: false,
+)
+kea_dhcp6_tests_generate = executable(
+ 'kea-dhcp6-tests-generate',
+ get_config_unittest_rebuild,
+ 'config_parser_unittest.cc',
+ objects: kea_dhcp6_tests.extract_objects(
+ 'dhcp6_client.cc',
+ 'dhcp6_test_utils.cc',
+ 'dhcp6_unittests.cc',
+ 'marker_file.cc',
+ ),
+ cpp_args: ['-DGENERATE_ACTION'] + dhcp6_tests_cpp_args,
+ dependencies: dhcp6_tests_deps,
+ include_directories: [include_directories('.')] + INCLUDES,
+ link_with: [dhcp6_lib] + dhcp6_tests_libs + LIBS_BUILT_SO_FAR,
+ build_by_default: false,
+)
+
+make_rebuild_conf = configuration_data()
+make_rebuild_conf.set('builddir', current_build_dir)
+make_rebuild_conf.set('source', current_source_dir / 'get_config_unittest.cc')
+make_rebuild_conf.set(
+ 'skeleton',
+ current_source_dir / 'get_config_unittest.cc.skel',
+)
+make_rebuild = configure_file(
+ input: 'make-rebuild.sh.in',
+ output: 'make-rebuild.sh',
+ configuration: make_rebuild_conf,
+)
+# Better when not use as a target.
+find_program(make_rebuild, required: true)