]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
add POSTINIT_CMD_suf to t_client.sh and sample config
authorGert Doering <gert@greenie.muc.de>
Tue, 4 Oct 2016 11:38:54 +0000 (13:38 +0200)
committerGert Doering <gert@greenie.muc.de>
Tue, 4 Oct 2016 12:04:20 +0000 (14:04 +0200)
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)

Signed-off-by: Gert Doering <gert@greenie.muc.de>
Acked-by: Arne Schwabe <arne@rfc2549.org>
Message-Id: <20161004113854.42470-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg12594.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit bae1ad7005fd9a1fadeed56370a9ac5422a33fee)

tests/t_client.rc-sample
tests/t_client.sh.in

index fb2abfae24f21da47cedf16c7b903e3e95276052..59f34c7f27ebb7a91a6835d0aa334a029c74d7b8 100644 (file)
@@ -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
 # ...
index bb82be94044ca22ccb7886ce1e2ec09811ca2719..9934d46bf8fbe401af967a0f85bcbf5444de3fae 100755 (executable)
@@ -257,6 +257,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\"
@@ -356,6 +357,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"