|
From: Jiri J. <jja...@re...> - 2013-10-07 11:31:04
|
Instead of waiting "static" 10 seconds, force the test server
to clean up. This not only eliminates the 10 second sleep, but it also
ensures that the server is cleaned up - with the static 10 seconds,
it is just a guess.
Signed-off-by: Jiri Jaburek <jja...@re...>
---
audit-test/netfilebt/run.conf | 7 ++-----
audit-test/netfilter/run.conf | 4 +---
audit-test/network/run.conf | 8 +++-----
audit-test/utils/functions.bash | 10 ++++++++++
4 files changed, 16 insertions(+), 13 deletions(-)
diff --git a/audit-test/netfilebt/run.conf b/audit-test/netfilebt/run.conf
index 02712f6..3778fe2 100644
--- a/audit-test/netfilebt/run.conf
+++ b/audit-test/netfilebt/run.conf
@@ -597,8 +597,8 @@ function run_test {
host_local=$(get_host_local $ipv $host)
host_remote=$(get_host_remote $ipv $host)
- # run the
- # default setup
+ # prepare cleanup and run the default setup
+ append_cleanup "tstsvr_cleanup $host_remote"
ebtaudit_setup
setup_default
@@ -780,9 +780,6 @@ function run_test {
)
status=$?
- # whenever the test fails, pause so the test server can cleanup
- [[ "$expres" == "fail" || "$status" != "0" ]] && sleep 10
-
# display the audit log items
if [[ $status != 0 ]]; then
echo
diff --git a/audit-test/netfilter/run.conf b/audit-test/netfilter/run.conf
index c1eb65c..a48f400 100644
--- a/audit-test/netfilter/run.conf
+++ b/audit-test/netfilter/run.conf
@@ -646,6 +646,7 @@ function run_test {
# exclude ping and RST tests
if ! [[ $tnum -ge 29 && $tnum -le 36 ]] \
&& ! [[ $tnum -ge 45 && $tnum -le 46 ]]; then
+ append_cleanup "tstsvr_cleanup $host_remote"
setup_default
echo "going to setup_default"
fi
@@ -1199,9 +1200,6 @@ function run_test {
)
status=$?
- # whenever the test fails, pause so the test server can cleanup
- [[ "$expres" == "fail" || "$status" != "0" ]] && sleep 10
-
# display the audit log items
if [[ $status != 0 ]]; then
echo
diff --git a/audit-test/network/run.conf b/audit-test/network/run.conf
index d1b11f2..63258be 100644
--- a/audit-test/network/run.conf
+++ b/audit-test/network/run.conf
@@ -900,8 +900,9 @@ function run_test {
host_local=$(get_host_local $ipv $host)
host_remote=$(get_host_remote $ipv $host)
- # run the setup callback (which has access to the named params) or run the
- # default setup
+ # prepare cleanup and run the setup callback
+ # (which has access to the named params) or run the default setup
+ append_cleanup "tstsvr_cleanup $host_remote"
if [[ -n $setupfunc ]]; then
$setupfunc
else
@@ -946,9 +947,6 @@ function run_test {
)
status=$?
- # whenever the test fails, pause so the test server can cleanup
- [[ "$expres" == "fail" || "$status" != "0" ]] && sleep 10
-
# display the audit log items
if [[ $status != 0 ]]; then
echo
diff --git a/audit-test/utils/functions.bash b/audit-test/utils/functions.bash
index ed197fd..fece1a6 100644
--- a/audit-test/utils/functions.bash
+++ b/audit-test/utils/functions.bash
@@ -127,6 +127,16 @@ function xtables_empty {
grep -e '^\*' -e '^:[^ ]* [^-]' -e '^COMMIT$' | sed 's/DROP/ACCEPT/ ; s/\[[0-9]*:[0-9]*\]/\[0:0\]/'
}
+# tstsvr_cleanup - cleanup the network server at a specified host
+#
+# DESCRIPTION:
+# This script can be executed after each networking test as a sanity cleanup,
+# to either kill any unfinished lblnet_tst_server instances spawned by xinetd,
+# or to ensure that no remaining instances are frozen even when expres=success.
+function tstsvr_cleanup {
+ nc -w 3 "$1" 4009 </dev/null
+}
+
# parse_named - Parse key=value test arguments
#
# INPUT
--
1.8.3.1
|