Add compression.test
[tinc] / test / import-export.test
index a65f0f8..9fdfa49 100755 (executable)
@@ -2,37 +2,65 @@
 
 . ./testlib.sh
 
-# Initialize three nodes
+echo [STEP] Initialize three nodes
 
-$tinc $c1 <<EOF
+tinc foo <<EOF
 init foo
-add Subnet 10.0.0.1
+set DeviceType dummy
+set Port 30000
+set Address localhost
 EOF
 
-$tinc $c2 <<EOF
+tinc bar <<EOF
 init bar
-add Subnet 10.0.0.2
+set DeviceType dummy
+set Port 0
 EOF
 
-$tinc $c3 <<EOF
+tinc baz <<EOF
 init baz
-add Subnet 10.0.0.3
+set DeviceType dummy
+set Port 0
 EOF
 
-# Test import, export and exchange commands
+echo [STEP] Test import, export and exchange commands
 
-$tinc $c1 export | $tinc $c2 exchange | $tinc $c1 import
+tinc foo export | tinc bar exchange | tinc foo import
 
-# Test export-all and exchange-all
+echo [STEP] Test export-all and exchange-all
 
-$tinc $c1 export-all | $tinc $c3 exchange | $tinc $c1 import
-$tinc $c1 exchange-all </dev/null | $tinc $c2 import
+tinc foo export-all | tinc baz exchange | tinc foo import
+tinc foo exchange-all </dev/null | tinc bar import
 
-# Test equivalence of host config files
+echo [STEP] Test equivalence of host config files
 
-cmp $d1/hosts/foo $d2/hosts/foo
-cmp $d1/hosts/foo $d3/hosts/foo
-cmp $d1/hosts/bar $d2/hosts/bar
-cmp $d1/hosts/bar $d3/hosts/bar
-cmp $d1/hosts/baz $d2/hosts/baz
-cmp $d1/hosts/baz $d3/hosts/baz
+diff -w "$DIR_FOO/hosts/foo" "$DIR_BAR/hosts/foo"
+diff -w "$DIR_FOO/hosts/foo" "$DIR_BAZ/hosts/foo"
+diff -w "$DIR_FOO/hosts/bar" "$DIR_BAR/hosts/bar"
+diff -w "$DIR_FOO/hosts/bar" "$DIR_BAZ/hosts/bar"
+diff -w "$DIR_FOO/hosts/baz" "$DIR_BAR/hosts/baz"
+diff -w "$DIR_FOO/hosts/baz" "$DIR_BAZ/hosts/baz"
+
+echo [STEP] Check whether the nodes can connect to each other
+
+create_script foo tinc-up '
+  tinc bar add ConnectTo foo
+  tinc baz add ConnectTo foo
+'
+
+create_script foo hosts/bar-up
+create_script foo hosts/baz-up
+
+start_tinc foo
+
+wait_script foo tinc-up
+
+start_tinc bar
+start_tinc baz
+
+wait_script foo hosts/bar-up
+wait_script foo hosts/baz-up
+
+require_nodes foo 3
+require_nodes bar 3
+require_nodes baz 3