Fix the scripts test.
[oweals/tinc.git] / test / scripts.test
index 3b3f27493e063aa6d22a5d229795592e26109b5e..e209d6912d9c83cbc9de47dbc56d160b7e97d71a 100755 (executable)
@@ -1,6 +1,8 @@
 #!/bin/sh
 
-. ./testlib.sh
+. "${0%/*}/testlib.sh"
+
+echo Initializing node...
 
 # Initialize server node
 
@@ -15,6 +17,8 @@ EOF
 
 # Set up scripts
 
+echo Setting up scripts...
+
 OUT=$d1/scripts.out
 rm -f $OUT 
 
@@ -24,24 +28,37 @@ cat >$d1/$script << EOF
 echo $script \$NETNAME,\$NAME,\$DEVICE,\$IFACE,\$NODE,\$REMOTEADDRESS,\$REMOTEPORT,\$SUBNET,\$WEIGHT,\$INVITATION_FILE,\$INVITATION_URL,\$DEBUG >>$OUT
 EOF
 chmod u+x $d1/$script
+
+cat >$d1/$script.cmd << EOF
+echo $script %NETNAME%,%NAME%,%DEVICE%,%IFACE%,%NODE%,%REMOTEADDRESS%,%REMOTEPORT%,%SUBNET%,%WEIGHT%,%INVITATION_FILE%,%INVITATION_URL%,%DEBUG% >>$OUT
+EOF
 done
 
 # Start server node
 
-$tinc -n netname $c1 start $r1
+echo Starting server node...
+
+$tinc $c1 -n netname start $r1
 
 echo foo-started >>$OUT
 
 # Invite client node
 
-url=`$tinc -n netname2 $c1 invite bar`
+echo Inviting client node...
+
+url=`$tinc $c1 -n netname2 invite bar | sed 's/\r//'`
 file=`cd $d1/invitations; ls | grep -v ed25519_key.priv`
 echo bar-invited >>$OUT
-$tinc -n netname3 $c2 join $url
+
+echo Joining client node...
+
+$tinc $c2 -n netname3 join $url
 echo bar-joined >>$OUT
 
 # Start and stop client node
 
+echo Starting client node...
+
 $tinc $c2 << EOF
 set DeviceType dummy
 set Port 32760
@@ -109,4 +126,5 @@ subnet-down netname,foo,dummy,,foo,,,fec0::/64,,,,5
 tinc-down netname,foo,dummy,,,,,,,,,5
 EOF
 
+sed -i 's/\r//' $OUT
 cmp $OUT $OUT.expected