Skip to contentSkip to conversation

t_client.sh: Add prepare/cleanup possibilties for each test case

PATCH In review David Sommerseth 2 participants 2 messages Nov 16, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 t_client.sh: Add prepare/cleanup possibilties for each test case

From: David Sommerseth <[email protected]...>

By adding PREPARE_$NUM and CLEANUP_$NUM variables containing command lines to execute before and after the test case is run.

---
 tests/t_client.sh.in | 13 +++++++++++++
 1 file changed, 13 insertions(+)
tests/t_client.sh.in +13 -0
index b13c802..9b83e14 100755
@@ -221,6 +221,8 @@ SUMMARY_FAIL=
 for SUF in $TEST_RUN_LIST
 do
     # get config variables
+    eval test_prep=\"\$PREPARE_$SUF\"
+    eval test_cleanup=\"\$CLEANUP_$SUF\"
     eval test_run_title=\"\$RUN_TITLE_$SUF\"
     eval openvpn_conf=\"\$OPENVPN_CONF_$SUF\"
     eval expect_ifconfig4=\"\$EXPECT_IFCONFIG4_$SUF\"
@@ -231,6 +233,11 @@ do
     echo -e "\n### test run $SUF: '$test_run_title' ###\n"
     fail_count=0
 
+    if [ -n "$test_prep" ]; then
+        echo -e "running preparation: '$test_prep'"
+        eval $test_prep
+    fi
+
     echo "save pre-openvpn ifconfig + route"
     get_ifconfig_route >$LOGDIR/$SUF:ifconfig_route_pre.txt
 
@@ -316,6 +323,12 @@ do
 	SUMMARY_FAIL="$SUMMARY_FAIL $SUF"
 	exit_code=30
     fi
+
+    if [ -n "$test_cleanup" ]; then
+        echo -e "cleaning up: '$test_cleanup'"
+        eval $test_cleanup
+    fi
+
 done
 
 if [ -z "$SUMMARY_OK" ] ; then SUMMARY_OK=" none"; fi
Signature · 1 line
1.8.3.1
#1 lore raw

ACK.

Your patch has been applied to the master branch.

commit 8fedf86abaf8fca8d0e9e81f70d7a5888a98b9ee

Author: David Sommerseth
Date:   Sat Nov 16 16:17:54 2013 +0100
     t_client.sh: Add prepare/cleanup possibilties for each test case

     Signed-off-by: David Sommerseth <[email protected]...>
     Acked-by: Gert Doering <[email protected]...>
     Message-Id: <[email protected]...>
     URL: http://article.gmane.org/gmane.network.openvpn.devel/7990
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering