Add test for import, export and exchange commands.
[tinc] / test / import-export.test
1 #!/bin/sh
2
3 . ./testlib.sh
4
5 # Initialize three nodes
6
7 $tinc $c1 <<EOF
8 init foo
9 add Subnet 10.0.0.1
10 EOF
11
12 $tinc $c2 <<EOF
13 init bar
14 add Subnet 10.0.0.2
15 EOF
16
17 $tinc $c3 <<EOF
18 init baz
19 add Subnet 10.0.0.3
20 EOF
21
22 # Test import, export and exchange commands
23
24 $tinc $c1 export | $tinc $c2 exchange | $tinc $c1 import
25
26 # Test export-all and exchange-all
27
28 $tinc $c1 export-all | $tinc $c3 exchange | $tinc $c1 import
29 $tinc $c1 exchange-all </dev/null | $tinc $c2 import
30
31 # Test equivalence of host config files
32
33 cmp $d1/hosts/foo $d2/hosts/foo
34 cmp $d1/hosts/foo $d3/hosts/foo
35 cmp $d1/hosts/bar $d2/hosts/bar
36 cmp $d1/hosts/bar $d3/hosts/bar
37 cmp $d1/hosts/baz $d2/hosts/baz
38 cmp $d1/hosts/baz $d3/hosts/baz