]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[gitlab9] Keactrl now returns its version.
authorTomek Mrugalski <tomasz@isc.org>
Fri, 6 Jul 2018 17:27:55 +0000 (19:27 +0200)
committerTomek Mrugalski <tomasz@isc.org>
Wed, 8 Aug 2018 11:28:47 +0000 (13:28 +0200)
src/bin/keactrl/keactrl.in
src/bin/keactrl/tests/keactrl_tests.sh.in

index 3510282e9f230743a4d2e87e812492ce4b5b7a42..f5fa27e0edd496fcbfc1936575ee89daf8204ea8 100644 (file)
@@ -10,6 +10,8 @@
 # This script is used to run Kea from installation directory,
 # as well as for running tests.
 
+VERSION=@PACKAGE_VERSION@
+
 ### Logging functions ###
 
 # Logs message at the error level.
@@ -280,6 +282,13 @@ if [ -z ${command} ]; then
     usage
     exit 1
 fi
+
+# Check if this is a simple question about version.
+if test "${command}" = "-v" || test "${command}" = "--version" ; then
+    echo "${VERSION}"
+    exit 0
+fi
+
 is_in_list "${command}" "start stop reload status"
 if [ ${_inlist} -eq 0 ]; then
     log_error "invalid command: ${command}"
index e9e349b57e91969daf3cc9a6c8b1dd81e8b915ef..64b2c18312f78c7b8f3d2356b279b6e74a5e239a 100644 (file)
@@ -1083,6 +1083,32 @@ status_no_config_test() {
     test_finish 0
 }
 
+# This test checks version reported by kea-admin. It has nothing to do
+# with memfile, but that is the only test file that is always ran,
+# so decided to put the generic test here.
+version_test() {
+    test_start "version"
+
+    # This is what we expect to get.
+    EXPECTED_VERSION=@PACKAGE_VERSION@
+
+    # Let's use short version: -v
+    reported_version=$(${keactrl} -v)
+
+    assert_str_eq ${EXPECTED_VERSION} ${reported_version} \
+                  "Expected keactrl -v to report %s, but it reported %s"
+
+    # Let's try the long version: --version
+    reported_version=$(${keactrl} --version)
+
+    assert_str_eq ${EXPECTED_VERSION} ${reported_version} \
+                  "Expected keactrl -v to report %s, but it reported %s"
+
+    test_finish 0
+}
+
+
+version_test
 start_all_servers_no_verbose_test
 start_all_servers_verbose_test
 start_v4_server_test