Skip to contentSkip to conversation

add POSTINIT_CMD_suf to t_client.sh and sample config

PATCH In review Gert Doering 2 participants 3 messages Oct 4, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 add POSTINIT_CMD_suf to t_client.sh and sample config

We have pre-init and cleanup commands, but some test cases might need or want to run a shell script after openvpn has initialized, but before executing any tests (ifconfig comparison and ping).

Example: POSTINIT_CMD_4="sleep 5" on MacOS X for tap tests (IPv6 DAD)

---
 tests/t_client.rc-sample | 3 +++
 tests/t_client.sh.in     | 7 +++++++
 2 files changed, 10 insertions(+)
tests/t_client.rc-sample +3 -0
index fb2abfa..59f34c7 100644
@@ -75,6 +75,9 @@ RUN_TITLE_2="testing tun/tcp/ipv4+ipv6"
 OPENVPN_CONF_2="$OPENVPN_BASE_P2MP --dev tun --proto tcp --remote $REMOTE --port 51194"
 PING4_HOSTS_2="10.100.51.1 10.100.0.1"
 PING6_HOSTS_2="2001:db8::1 2001:db8:a051::1"
+#
+# run command after openvpn initialization is done - here: delay 5 seconds
+POSTINIT_CMD_2="sleep 5"
 
 # Test 3: UDP / p2p tun
 # ...
tests/t_client.sh.in +7 -0
index b2428b9..6c81bc4 100755
@@ -263,6 +263,7 @@ for SUF in $TEST_RUN_LIST
 do
     # get config variables
     eval test_prep=\"\$PREPARE_$SUF\"
+    eval test_postinit=\"\$POSTINIT_CMD_$SUF\"
     eval test_cleanup=\"\$CLEANUP_$SUF\"
     eval test_run_title=\"\$RUN_TITLE_$SUF\"
     eval openvpn_conf=\"\$OPENVPN_CONF_$SUF\"
@@ -362,6 +363,12 @@ do
 	echo -e " OK!\n"
     fi
 
+    # post init script needed?
+    if [ -n "$test_postinit" ]; then
+        echo -e "running post-init cmd: '$test_postinit'"
+        eval $test_postinit
+    fi
+
     # expected ifconfig values in there?
     check_ifconfig 4 "$expect_ifconfig4"
     check_ifconfig 6 "$expect_ifconfig6"
Signature · 1 line
2.9.0
#1 lore raw

Am 04.10.16 um 13:38 schrieb Gert Doering:

Quoted 17 lines

We have pre-init and cleanup commands, but some test cases might need or want to run a shell script after openvpn has initialized, but before executing any tests (ifconfig comparison and ping).

Example: POSTINIT_CMD_4="sleep 5" on MacOS X for tap tests (IPv6 DAD)

---
 tests/t_client.rc-sample | 3 +++
 tests/t_client.sh.in     | 7 +++++++
 2 files changed, 10 insertions(+)
tests/t_client.rc-sample +0 -0
index fb2abfa..59f34c7 100644

tests/t_client.rc-sample RUN_TITLE_2="testing tun/tcp/ipv4+ipv6" · line 80

Quoted 6 lines
tests/t_client.rc-sample +3 -0
@@ -75,6 +75,9 @@ RUN_TITLE_2="testing tun/tcp/ipv4+ipv6"
 OPENVPN_CONF_2="$OPENVPN_BASE_P2MP --dev tun --proto tcp --remote $REMOTE --port 51194"
 PING4_HOSTS_2="10.100.51.1 10.100.0.1"
 PING6_HOSTS_2="2001:db8::1 2001:db8:a051::1"
+#
+# run command after openvpn initialization is done - here: delay 5 seconds
+POSTINIT_CMD_2="sleep 5"

ACK. Also workaround/fixes the DAD problem on OS X for tap.

Arne

#2 lore raw
In reply to Gert Doering

Your patch has been applied to the following branches

commit bae1ad7005fd9a1fadeed56370a9ac5422a33fee (master) commit 7891c8ce93b33749ee75ab579aa391bc5eab6e2f (release/2.3)

Author: Gert Doering
Date:   Tue Oct 4 13:38:54 2016 +0200
     add POSTINIT_CMD_suf to t_client.sh and sample config

     Signed-off-by: Gert Doering <[email protected]...>
     Acked-by: Arne Schwabe <[email protected]...>
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg12594.html
     Signed-off-by: Gert Doering <[email protected]...>

Also(!), I had to cherry-pick 8fedf86abaf8fca8d0e9e81f70d7a5888a98b9ee into 2.3 as 6ac1cf103e77b0d2aa3360c4373099bf4d9f1919:

commit 6ac1cf103e77b0d2aa3360c4373099bf4d9f1919

Author: David Sommerseth <[email protected]...>
Date:   Sat Nov 16 16:17:54 2013 +0100

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

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

otherwise, this patch did not apply - and it doesn't really make sense to have only the POSTINIT_CMD_ and not PREPARE/CLEANUP. Tested :-) --
kind regards,

Gert Doering