]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[3406] Moved script with common functions to testutils.
authorMarcin Siodelski <marcin@isc.org>
Wed, 28 May 2014 13:55:28 +0000 (15:55 +0200)
committerMarcin Siodelski <marcin@isc.org>
Wed, 28 May 2014 13:55:28 +0000 (15:55 +0200)
src/bin/dhcp6/tests/Makefile.am
src/bin/dhcp6/tests/dhcp6_reconfigure_test.sh
src/bin/dhcp6/tests/dhcp6_shutdown_test.sh
src/lib/testutils/Makefile.am
src/lib/testutils/dhcp_test_lib.sh [moved from src/bin/dhcp6/tests/dhcp6_test_func.sh with 92% similarity]

index 6afab0e40986fefb783e382f4167f7e53e3c0d92..7dae97193bb96aa27417394b8e3073983012b40e 100644 (file)
@@ -1,16 +1,14 @@
 PYCOVERAGE_RUN = @PYCOVERAGE_RUN@
 PYTESTS = dhcp6_test.py
-SHLIBS =
 SHTESTS =
 # The test of dynamic reconfiguration based on signals will work only
 # if we are using file based configuration approach.
 if CONFIG_BACKEND_JSON
-SHLIBS  += dhcp6_test_func.sh
 SHTESTS += dhcp6_reconfigure_test.sh
 SHTESTS += dhcp6_sigterm_test.sh
 SHTESTS += dhcp6_sigint_test.sh
 endif
-EXTRA_DIST = $(PYTESTS) $(SHTESTS) $(SHLIBS)
+EXTRA_DIST = $(PYTESTS) $(SHTESTS)
 
 # Explicitly specify paths to dynamic libraries required by loadable python
 # modules. That is required on Mac OS systems. Otherwise we will get exception
@@ -32,7 +30,7 @@ check-local:
 
        for shtest in $(SHTESTS) ; do \
        echo Running test: $$shtest ; \
-       B10_LOCKFILE_DIR_FROM_BUILD=$(abs_top_builddir) \
+       export B10_LOCKFILE_DIR_FROM_BUILD=$(abs_top_builddir); \
        $(abs_srcdir)/$$shtest || exit ; \
        done
 
index f341dc9a110ca676db7db6d11352853196e50d13..3100c6c73935ca0b35045ec3a82125fd8696e576 100755 (executable)
@@ -62,8 +62,12 @@ CONFIG_INVALID="{
     }
 }"
 
+# Set the location of the executable.
+BIN="b10-dhcp6"
+BIN_PATH=".."
+
 # Import common test library.
-. $(dirname $0)/dhcp6_test_func.sh
+. $(dirname $0)/../../../lib/testutils/dhcp_test_lib.sh
 
 # Log the start of the test and print test name.
 test_start
index 0ecee5dce184dd6b38ac4a1f07076e57d20ac5b9..52810cb91dc67eeb982573d090a981dd995a3630 100755 (executable)
@@ -47,8 +47,12 @@ CONFIG="{
     }
 }"
 
+# Set the location of the executable.
+BIN="b10-dhcp6"
+BIN_PATH=".."
+
 # Import common test library.
-. $(dirname $0)/dhcp6_test_func.sh
+. $(dirname $0)/../../../lib/testutils/dhcp_test_lib.sh
 
 # Log the start of the test and print test name.
 test_start
index 0c88b843bf994bbad3e0a27b1f86f62c4f292f48..0f105dc06c01bb579aa428fa7cd81c03d2cc6bba 100644 (file)
@@ -15,4 +15,7 @@ libkea_testutils_la_LIBADD  = $(top_builddir)/src/lib/asiolink/libkea-asiolink.l
 libkea_testutils_la_LIBADD += $(top_builddir)/src/lib/dns/libkea-dns++.la
 endif
 
-EXTRA_DIST = portconfig.h socket_request.h
+# Include common libraries being used by shell-based tests.
+SHLIBS = dhcp_test_lib.sh
+
+EXTRA_DIST = portconfig.h socket_request.h $(SHLIBS)
similarity index 92%
rename from src/bin/dhcp6/tests/dhcp6_test_func.sh
rename to src/lib/testutils/dhcp_test_lib.sh
index 666e91d857241353f416d46b0c4169b2ac7adce3..94a6a62866200d883e49c001729b1c9fd592fe2a 100755 (executable)
 # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 # PERFORMANCE OF THIS SOFTWARE.
 
-# Name of the Kea executable.
-BIN="../b10-dhcp6"
+# The following two parameters must to be specified in a script
+# including this library.
+# - BIN - Name of the Kea executable (excluding a path), e.g. b10-dhcp6
+# - BIN_PATH - Path to the Kea executable (excluding an executable name),
+#              e.g. ../
 
 # Begins a test by prining its name.
 # It requires the ${TEST_NAME} variable to hold the test name.
@@ -35,12 +38,11 @@ set_logger() {
     export B10_LOGGER_DESTINATION=${LOG_FILE}
 }
 
-# Returns the number of running b10-dhcp6 process pids and
-# the list of pids.
+# Returns the number of running process pids and the list of pids.
 _GET_PIDS=     # Return value: holds space separated list of DHCPv6 pids.
 _GET_PIDS_NUM= # Return value: holds the number of DHCPv6 server pids.
 get_pids() {
-    _GET_PIDS=`ps axo pid,command | grep b10-dhcp6 | grep -v grep | awk '{print $1}'`
+    _GET_PIDS=`ps axo pid,command | grep ${BIN} | grep -v grep | awk '{print $1}'`
     _GET_PIDS_NUM=`printf "%s" "${_GET_PIDS}" | wc -w | awk '{print $1}'`
 }
 
@@ -111,8 +113,8 @@ clean_exit() {
 # Starts Kea process in background using a configuration file specified
 # in the global variable ${CFG_FILE}
 start_kea() {
-    printf "Running command %s.\n" "\"$BIN -c ${CFG_FILE}\""
-    $BIN -c ${CFG_FILE} &
+    printf "Running command %s.\n" "\"${BIN_PATH}/${BIN} -c ${CFG_FILE}\""
+    ${BIN_PATH}/$BIN -c ${CFG_FILE} &
 }
 
 # Waits for Kea to startup with timeout.