tinc/test/sptps-basic.test

33 lines
843 B
Text
Raw Normal View History

2019-08-26 11:44:51 +00:00
#!/bin/sh
2019-08-26 11:44:53 +00:00
. "${0%/*}/testlib.sh"
2019-08-26 11:44:51 +00:00
2019-08-26 11:44:52 +00:00
# Skip this test if we did not compile sptps_test
2019-08-26 11:44:53 +00:00
test -e $sptps_test -a -e $sptps_keypair || exit 77
2019-08-26 11:44:52 +00:00
2019-08-26 11:44:51 +00:00
# Generate keys
mkdir -p $d1
2019-08-26 11:44:51 +00:00
$sptps_keypair $d1/server.priv $d1/server.pub
$sptps_keypair $d1/client.priv $d1/client.pub
2019-08-26 11:44:51 +00:00
# Test transfer of a simple file.
2019-08-26 11:44:53 +00:00
(sleep 1; $sptps_test -4 -q $d1/client.priv $d1/server.pub localhost 32750 <Makefile) &
2019-08-26 11:44:52 +00:00
$sptps_test -4 $d1/server.priv $d1/client.pub 32750 >$d1/out1
2019-08-26 11:44:53 +00:00
cmp $d1/out1 Makefile
2019-08-26 11:44:51 +00:00
2019-08-26 11:44:53 +00:00
$sptps_test -4 -q $d1/server.priv $d1/client.pub 32750 <Makefile &
2019-08-26 11:44:51 +00:00
sleep 1
2019-08-26 11:44:52 +00:00
$sptps_test -4 $d1/client.priv $d1/server.pub localhost 32750 > $d1/out2
2019-08-26 11:44:53 +00:00
cmp $d1/out2 Makefile
2019-08-26 11:44:51 +00:00
# Datagram mode
2019-08-26 11:44:53 +00:00
$sptps_test -4 -dq $d1/server.priv $d1/client.pub 32750 <Makefile &
2019-08-26 11:44:51 +00:00
sleep 1
2019-08-26 11:44:52 +00:00
sleep 1 | $sptps_test -4 -dq $d1/client.priv $d1/server.pub localhost 32750 >$d1/out3
2019-08-26 11:44:53 +00:00
cmp $d1/out3 Makefile