Attempt to make the test suite work with Windows executables.
[tinc] / test / invite-offline.test
1 #!/bin/sh
2
3 . "${0%/*}/testlib.sh"
4
5 # Initialize one node
6
7 $tinc $c1 <<EOF
8 init foo
9 set DeviceType dummy
10 set Mode switch
11 set Broadcast no
12 set Address localhost
13 set Port 32758
14 EOF
15
16 # Generate an invitation offline and let another node join the VPN
17
18 invitation=`$tinc $c1 invite bar | sed 's/\r//'`
19
20 $tinc $c1 start $r1
21
22 $tinc $c2 join $invitation
23
24 # Test equivalence of host config files
25
26 cmp $d1/hosts/foo $d2/hosts/foo
27 test "`grep ^Ed25519PublicKey $d1/hosts/bar`" = "`grep ^Ed25519PublicKey $d2/hosts/bar`"
28
29 # Test Mode, Broadcast and ConnectTo statements
30
31 test `$tinc $c2 get Mode` = switch
32 test `$tinc $c2 get Broadcast` = no
33 test `$tinc $c2 get ConnectTo` = foo
34
35 # Check whether the new node can join the VPN
36
37 $tinc $c2 << EOF
38 set DeviceType dummy
39 set Port 0
40 start $r2
41 EOF
42
43 sleep 1
44
45 test `$tinc $c1 dump reachable nodes | wc -l` = 2
46 test `$tinc $c2 dump reachable nodes | wc -l` = 2
47
48 $tinc $c2 stop
49 $tinc $c1 stop