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>
... | ... |
@@ -75,6 +75,9 @@ RUN_TITLE_2="testing tun/tcp/ipv4+ipv6" |
75 | 75 |
OPENVPN_CONF_2="$OPENVPN_BASE_P2MP --dev tun --proto tcp --remote $REMOTE --port 51194" |
76 | 76 |
PING4_HOSTS_2="10.100.51.1 10.100.0.1" |
77 | 77 |
PING6_HOSTS_2="2001:db8::1 2001:db8:a051::1" |
78 |
+# |
|
79 |
+# run command after openvpn initialization is done - here: delay 5 seconds |
|
80 |
+POSTINIT_CMD_2="sleep 5" |
|
78 | 81 |
|
79 | 82 |
# Test 3: UDP / p2p tun |
80 | 83 |
# ... |
... | ... |
@@ -263,6 +263,7 @@ for SUF in $TEST_RUN_LIST |
263 | 263 |
do |
264 | 264 |
# get config variables |
265 | 265 |
eval test_prep=\"\$PREPARE_$SUF\" |
266 |
+ eval test_postinit=\"\$POSTINIT_CMD_$SUF\" |
|
266 | 267 |
eval test_cleanup=\"\$CLEANUP_$SUF\" |
267 | 268 |
eval test_run_title=\"\$RUN_TITLE_$SUF\" |
268 | 269 |
eval openvpn_conf=\"\$OPENVPN_CONF_$SUF\" |
... | ... |
@@ -362,6 +363,12 @@ do |
362 | 362 |
echo -e " OK!\n" |
363 | 363 |
fi |
364 | 364 |
|
365 |
+ # post init script needed? |
|
366 |
+ if [ -n "$test_postinit" ]; then |
|
367 |
+ echo -e "running post-init cmd: '$test_postinit'" |
|
368 |
+ eval $test_postinit |
|
369 |
+ fi |
|
370 |
+ |
|
365 | 371 |
# expected ifconfig values in there? |
366 | 372 |
check_ifconfig 4 "$expect_ifconfig4" |
367 | 373 |
check_ifconfig 6 "$expect_ifconfig6" |