|
@@ -16,7 +16,7 @@
|
|
|
BIN="../b10-dhcp6"
|
|
|
|
|
|
|
|
|
-
|
|
|
+
|
|
|
test_start() {
|
|
|
printf "\nSTART TEST ${TEST_NAME}\n"
|
|
|
}
|
|
@@ -37,10 +37,10 @@ set_logger() {
|
|
|
|
|
|
|
|
|
|
|
|
-_GET_PIDS=
|
|
|
-_GET_PIDS_NUM=
|
|
|
+_GET_PIDS=
|
|
|
+_GET_PIDS_NUM=
|
|
|
get_pids() {
|
|
|
- _GET_PIDS=`ps -ax -o pid,command | grep b10-dhcp6 | grep -v grep | awk '{print $1}'`
|
|
|
+ _GET_PIDS=`ps axo pid,command | grep b10-dhcp6 | grep -v grep | awk '{print $1}'`
|
|
|
_GET_PIDS_NUM=`printf "%s" "${_GET_PIDS}" | wc -w | awk '{print $1}'`
|
|
|
}
|
|
|
|
|
@@ -56,8 +56,8 @@ get_log_messages() {
|
|
|
|
|
|
|
|
|
|
|
|
-_GET_RECONFIGS=
|
|
|
-_GET_RECONFIG_ERRORS=
|
|
|
+_GET_RECONFIGS=
|
|
|
+_GET_RECONFIG_ERRORS=
|
|
|
get_reconfigs() {
|
|
|
|
|
|
|
|
@@ -72,6 +72,9 @@ get_reconfigs() {
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
cleanup() {
|
|
|
get_pids
|
|
|
|
|
@@ -89,7 +92,8 @@ cleanup() {
|
|
|
|
|
|
|
|
|
clean_exit() {
|
|
|
- if [ $1 -eq 0 ]; then
|
|
|
+ exit_code=${1}
|
|
|
+ if [ ${exit_code} -eq 0 ]; then
|
|
|
cleanup
|
|
|
printf "PASSED ${TEST_NAME}\n\n"
|
|
|
else
|
|
@@ -101,7 +105,7 @@ clean_exit() {
|
|
|
cleanup
|
|
|
printf "FAILED ${TEST_NAME}\n\n"
|
|
|
fi
|
|
|
- exit $1
|
|
|
+ exit ${exit_code}
|
|
|
}
|
|
|
|
|
|
|
|
@@ -114,15 +118,15 @@ start_kea() {
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-_WAIT_FOR_KEA=0
|
|
|
+_WAIT_FOR_KEA=0
|
|
|
wait_for_kea() {
|
|
|
timeout=${1}
|
|
|
- loops=0
|
|
|
+ loops=0
|
|
|
_WAIT_FOR_KEA=0
|
|
|
while [ ! -s ${LOG_FILE} ] && [ ${loops} -le ${timeout} ]; do
|
|
|
printf "."
|
|
@@ -144,9 +148,10 @@ wait_for_kea() {
|
|
|
|
|
|
|
|
|
|
|
|
-_WAIT_FOR_MESSAGE=0
|
|
|
+_WAIT_FOR_MESSAGE=0
|
|
|
+
|
|
|
wait_for_message() {
|
|
|
- timeout=${1}
|
|
|
+ timeout=${1}
|
|
|
message=${2}
|
|
|
occurrences=${3}
|
|
|
loops=0
|
|
@@ -158,7 +163,7 @@ wait_for_message() {
|
|
|
get_log_messages ${message}
|
|
|
if [ ${_GET_LOG_MESSAGES} -eq ${occurrences} ]; then
|
|
|
printf "\n"
|
|
|
- _WAIT_FOR_MESSAGE=1
|
|
|
+ _WAIT_FOR_MESSAGE=1
|
|
|
return
|
|
|
fi
|
|
|
|
|
@@ -171,13 +176,13 @@ wait_for_message() {
|
|
|
|
|
|
|
|
|
send_signal() {
|
|
|
- sig=$1
|
|
|
+ sig=${1}
|
|
|
|
|
|
get_pids
|
|
|
if [ ${_GET_PIDS_NUM} -ne 1 ]; then
|
|
|
printf "ERROR: expected one Kea process to be started. Found %d processes started.\n" ${_GET_PIDS_NUM}
|
|
|
clean_exit 1
|
|
|
- fi
|
|
|
+ fi
|
|
|
printf "Sending signal ${sig} to Kea process (pid=%s).\n" ${_GET_PIDS}
|
|
|
|
|
|
kill -${sig} ${_GET_PIDS}
|