X-Git-Url: https://www.tinc-vpn.org/git/browse?a=blobdiff_plain;f=test%2Fsecurity.test;h=76b825dc2e5e52c1274572c7232cfa3770251424;hb=612ad2749ae504e6513748f881f0884ceeab2ed7;hp=6c15bdab30126908b75de83e89086cf0ca0ad7a2;hpb=9ca716d6270335cf44455fc1667a1647c19410ef;p=tinc diff --git a/test/security.test b/test/security.test index 6c15bdab..76b825dc 100755 --- a/test/security.test +++ b/test/security.test @@ -1,103 +1,129 @@ #!/bin/sh -. "${0%/*}/testlib.sh" +# shellcheck source=testlib.sh +. ./testlib.sh -# Skip this test if tools are missing +echo [STEP] Skip this test if tools are missing -which nc >/dev/null || exit 77 +command -v nc >/dev/null || exit $EXIT_SKIP_TEST +command -v timeout >/dev/null || exit $EXIT_SKIP_TEST -if [ "$(uname)" = "Darwin" ]; then - alias timeout=gtimeout -fi +foo_port=30050 +bar_port=30051 -which timeout >/dev/null || exit 77 +# usage: splice protocol_version +splice() { + ./splice foo localhost $foo_port bar localhost $bar_port "$1" & + sleep 10 +} -# Initialize two nodes +# usage: send_with_timeout "data to send" "data expected to receive" +send_with_timeout() { + data=$1 + expected=$3 -$tinc $c1 <