assert_eq 1 "${EXIT_CODE}"
assert_str_eq 'ERROR/kea-admin: -x or --extra requires a parameter' "$(printf '%s\n' "${OUTPUT}" | head -n 1)"
test_finish ${?}
+
+ test_start 'kea_admin_version.version'
+ run_command \
+ "${kea_admin}" -v
+ assert_eq 0 "${EXIT_CODE}"
+ assert_str_eq '@version@' "$(printf '%s\n' "${OUTPUT}" | head -n 1)"
+ test_finish ${?}
+
+ test_start 'kea_admin_version.extended_version'
+ run_command \
+ "${kea_admin}" -V
+ assert_eq 0 "${EXIT_CODE}"
+ assert_str_eq '@extended_version@' "$(printf '%s\n' "${OUTPUT}" | head -n 1)"
+ test_finish ${?}
}
# Run tests.
kea_admin_tests_conf_data = configuration_data()
kea_admin_tests_conf_data.set('abs_top_builddir', TOP_BUILD_DIR)
kea_admin_tests_conf_data.set('abs_top_srcdir', TOP_SOURCE_DIR)
+kea_admin_tests_conf_data.set('version', PROJECT_VERSION)
+kea_admin_tests_conf_data.set('extended_version', EXTENDED_VERSION)
admin_tests = configure_file(
input: 'admin_tests.sh.in',
output: 'admin_tests.sh',
--- /dev/null
+#!/bin/sh
+
+# Copyright (C) 2025 Internet Systems Consortium, Inc. ("ISC")
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+# Exit with error if commands exit with non-zero and if undefined variables are
+# used.
+set -eu
+
+# Set the location of the executable.
+bin='kea-lfc'
+bin_path='@abs_top_builddir@/src/bin/lfc'
+
+# Import common test library.
+# shellcheck source=src/lib/testutils/dhcp_test_lib.sh.in
+. '@abs_top_builddir@/src/lib/testutils/dhcp_test_lib.sh'
+
+version_test "lfc.version"
depends: [kea_lfc],
protocol: 'gtest',
)
+
+lfc_tests_conf_data = configuration_data()
+lfc_tests_conf_data.set('abs_top_builddir', TOP_BUILD_DIR)
+lfc_process_tests = configure_file(
+ input: 'lfc_process_tests.sh.in',
+ output: 'lfc_process_tests.sh',
+ configuration: lfc_tests_conf_data,
+)
+test(
+ 'lfc_process_tests.sh',
+ lfc_process_tests,
+ workdir: current_build_dir,
+ is_parallel: false,
+ priority: -1,
+ suite: 'shell-tests',
+)
is_parallel: false,
priority: -1,
)
+
+perfdhcp_tests_conf_data = configuration_data()
+perfdhcp_tests_conf_data.set('abs_top_builddir', TOP_BUILD_DIR)
+perfdhcp_process_tests = configure_file(
+ input: 'perfdhcp_process_tests.sh.in',
+ output: 'perfdhcp_process_tests.sh',
+ configuration: perfdhcp_tests_conf_data,
+)
+test(
+ 'perfdhcp_process_tests.sh',
+ perfdhcp_process_tests,
+ workdir: current_build_dir,
+ is_parallel: false,
+ priority: -1,
+ suite: 'shell-tests',
+)
--- /dev/null
+#!/bin/sh
+
+# Copyright (C) 2025 Internet Systems Consortium, Inc. ("ISC")
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+# Exit with error if commands exit with non-zero and if undefined variables are
+# used.
+set -eu
+
+# Set the location of the executable.
+bin='perfdhcp'
+bin_path='@abs_top_builddir@/src/bin/perfdhcp'
+
+# Import common test library.
+# shellcheck source=src/lib/testutils/dhcp_test_lib.sh.in
+. '@abs_top_builddir@/src/lib/testutils/dhcp_test_lib.sh'
+
+version_test "perfdhcp.version"
priority: -1,
suite: 'shell-tests',
)
+shell_process_tests = configure_file(
+ input: 'shell_process_tests.sh.in',
+ output: 'shell_process_tests.sh',
+ configuration: shell_tests_conf_data,
+)
+test(
+ 'shell_process_tests.sh',
+ shell_process_tests,
+ workdir: current_build_dir,
+ is_parallel: false,
+ priority: -1,
+ suite: 'shell-tests',
+)
auth_bad_password_file = configure_file(
input: 'auth_bad_password_file.in',
output: 'auth_bad_password_file',
--- /dev/null
+#!/bin/sh
+
+# Copyright (C) 2025 Internet Systems Consortium, Inc. ("ISC")
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+# Exit with error if commands exit with non-zero and if undefined variables are
+# used.
+set -eu
+
+# Set the location of the executable.
+bin='kea-shell'
+bin_path='@abs_top_builddir@/src/bin/shell'
+
+# Import common test library.
+# shellcheck source=src/lib/testutils/dhcp_test_lib.sh.in
+. '@abs_top_builddir@/src/lib/testutils/dhcp_test_lib.sh'
+
+version_test "shell.version"
ASSERT_FALSE(cfgReport.empty());
EXPECT_NE(std::string::npos, cfgReport.find(VERSION));
EXPECT_NE(std::string::npos, cfgReport.find(EXTENDED_VERSION));
+ EXPECT_NE(std::string::npos, cfgReport.find(SOURCE_OF_INSTALLATION));
EXPECT_NE(std::string::npos, cfgReport.find(std::string("Hooks directory: ") +
HooksLibrariesParser::getHooksPath()));
}
prefix="@prefix@"
# Expected version
-EXPECTED_VERSION="@PACKAGE_VERSION@"
+VERSION='@VERSION@'
+EXTENDED_VERSION='@EXTENDED_VERSION@'
# Kea environment variables for shell tests.
# KEA_LOGGER_DESTINATION is set per test with set_logger.
run_command \
"${bin_path}/${bin}" "${v}"
- if test "${OUTPUT}" != "${EXPECTED_VERSION}"; then
+ if test 0 -ne "${EXIT_CODE}"; then
+ printf 'ERROR: Expected exit code 0, got "%s" when calling "%s"\n' \
+ "${EXIT_CODE}" "${bin} -V"
+ clean_exit 1
+ fi
+
+ if test "${OUTPUT}" != "${VERSION}"; then
printf 'ERROR: Expected version "%s", got "%s" when calling "%s"\n' \
- "${EXPECTED_VERSION}" "${OUTPUT}" "${bin} ${v}"
+ "${VERSION}" "${OUTPUT}" "${bin} ${v}"
test_finish 1
fi
done
+ # Check -V.
+ run_command \
+ "${bin_path}/${bin}" -V
+ if test 0 -ne "${EXIT_CODE}"; then
+ printf 'ERROR: Expected exit code 0, got "%s" when calling "%s"\n' \
+ "${EXIT_CODE}" "${bin} -V"
+ clean_exit 1
+ fi
+ if test "${EXTENDED_VERSION}" != "$(echo "${OUTPUT}" | head -n 1)"; then
+ printf 'ERROR: Expected version "%s", got "%s" when calling "%s"\n' \
+ "${EXTENDED_VERSION}" "${OUTPUT}" "${bin} -V"
+ clean_exit 1
+ fi
+
test_finish 0
}
}
# This test verifies that passwords are redacted in logs.
-# This function takes 2 parameters:
-# test_name
-# config - string with a content of the config (will be written to a file)
-# expected_code - expected exit code returned by kea (0 - success, 1 - failure)
+# This function takes 3 parameters:
+# - test_name
+# - config - string with a content of the config (will be written to a file)
+# - expected_code - expected exit code returned by kea (0 - success, 1 - failure)
password_redact_test() {
local test_name="${1}"
local config="${2}"
dhcp_test_lib_conf_data = configuration_data()
dhcp_test_lib_conf_data.set('abs_top_builddir', TOP_BUILD_DIR)
dhcp_test_lib_conf_data.set('prefix', PREFIX)
-dhcp_test_lib_conf_data.set('PACKAGE_VERSION', PROJECT_VERSION)
+dhcp_test_lib_conf_data.set('VERSION', PROJECT_VERSION)
+dhcp_test_lib_conf_data.set('EXTENDED_VERSION', EXTENDED_VERSION)
configure_file(
input: 'dhcp_test_lib.sh.in',
output: 'dhcp_test_lib.sh',