/test/*.log
/test/*.trs
/test/splice
+/test/testlib.sh
Makefile
Makefile.in
core*
dist_check_SCRIPTS = $(TESTS)
-EXTRA_DIST = testlib.sh
-
AM_CFLAGS = -iquote.
check_PROGRAMS = \
(sleep 0.1; kill \$pid) &
EOF
+cat >$d1/tinc-up.cmd <<EOF
+start /min ../$tinc $c1 stop
+EOF
+
# Test tincd command line options that should work
$tincd $c1 $r1 -D
# Generate an invitation offline and let another node join the VPN
-invitation=`$tinc $c1 invite bar`
+invitation=`$tinc $c1 invite bar | sed 's/\r//'`
$tinc $c1 start $r1
$tinc $c1 export >>\$INVITATION_FILE
EOF
+cat >$d1/invitation-created.cmd <<EOF
+echo Name = %NODE% >%INVITATION_FILE%
+echo Ifconfig = 93.184.216.34/24 >>%INVITATION_FILE%
+echo Route = 2606:2800:220:1::/64 2606:2800:220:1:248:1893:25c8:1946 >>%INVITATION_FILE%
+echo Route = 1.2.3.4 1234:: >>%INVITATION_FILE%
+$tinc $c1 export >>%INVITATION_FILE%
+EOF
+
chmod u+x $d1/invitation-created
-$tinc $c1 invite bar | $tinc $c2 --batch join
+$tinc $c1 invite bar | tail -1 | $tinc $c2 --batch join
# Test equivalence of host config files
. "${0%/*}/testlib.sh"
+echo Initializing node...
+
# Initialize server node
$tinc $c1 <<EOF
# Set up scripts
+echo Setting up scripts...
+
OUT=$d1/scripts.out
rm -f $OUT
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
+echo Starting server node...
+
$tinc -n netname $c1 start $r1
echo foo-started >>$OUT
# Invite client node
-url=`$tinc -n netname2 $c1 invite bar`
+echo Inviting client node...
+
+url=`$tinc -n netname2 $c1 invite bar | sed 's/\r//'`
file=`cd $d1/invitations; ls | grep -v ed25519_key.priv`
echo bar-invited >>$OUT
+
+echo Joining client node...
+
$tinc -n netname3 $c2 join $url
echo bar-joined >>$OUT
# Start and stop client node
+echo Starting client node...
+
$tinc $c2 << EOF
set DeviceType dummy
set Port 32760
tinc-down netname,foo,dummy,,,,,,,,,5
EOF
+sed -i 's/\r//' $OUT
cmp $OUT $OUT.expected
+++ /dev/null
-#!/bin/sh
-
-# Paths to executables
-
-tincd=../src/tincd
-tinc=../src/tinc
-sptps_test=../src/sptps_test
-sptps_keypair=../src/sptps_keypair
-
-# Test directories
-
-scriptname=`basename $0`
-d1=$PWD/$scriptname.1
-d2=$PWD/$scriptname.2
-d3=$PWD/$scriptname.3
-
-# Default arguments for both tinc and tincd
-
-c1="--config=$d1 --pidfile=$d1/pid"
-c2="--config=$d2 --pidfile=$d2/pid"
-c3="--config=$d3 --pidfile=$d3/pid"
-
-# Arguments when running tincd
-
-r1="--logfile=$d1/log -d5"
-r2="--logfile=$d2/log -d5"
-r3="--logfile=$d3/log -d5"
-
-# Check for leftover tinc daemons
-
-[ -f $d1/pid ] && $tinc $c1 stop
-[ -f $d2/pid ] && $tinc $c2 stop
-[ -f $d3/pid ] && $tinc $c3 stop
-
-# Remove test directories
-
-rm -rf $d1 $d2 $d3
-
-# Exit on errors, log all commands being executed
-
-set -ex
--- /dev/null
+#!/bin/sh
+
+# Paths to executables
+
+tincd=../src/tincd@EXEEXT@
+tinc=../src/tinc@EXEEXT@
+sptps_test=../src/sptps_test@EXEEXT@
+sptps_keypair=../src/sptps_keypair@EXEEXT@
+
+# Test directories
+
+scriptname=`basename $0`
+
+n1=$scriptname.1
+n2=$scriptname.2
+n3=$scriptname.3
+
+d1=$PWD/$n1
+d2=$PWD/$n2
+d3=$PWD/$n3
+
+# Default arguments for both tinc and tincd
+
+c1="-n $n1 --config=$d1 --pidfile=$d1/pid"
+c2="-n $n2 --config=$d2 --pidfile=$d2/pid"
+c3="-n $n3 --config=$d3 --pidfile=$d3/pid"
+
+# Arguments when running tincd
+
+r1="--logfile=$d1/log -d5"
+r2="--logfile=$d2/log -d5"
+r3="--logfile=$d3/log -d5"
+
+# Check for leftover tinc daemons
+
+[ -f $d1/pid ] && $tinc $c1 stop
+[ -f $d2/pid ] && $tinc $c2 stop
+[ -f $d3/pid ] && $tinc $c3 stop
+
+# Remove test directories
+
+rm -rf $d1 $d2 $d3
+
+# Exit on errors, log all commands being executed
+
+set -ex
# Initialize one node
$tinc $c1 init foo
-test "`$tinc $c1 get Name`" = "foo"
+test "`$tinc $c1 get Name | sed 's/\r//'`" = "foo"
# Test case sensitivity
$tinc $c1 set Mode switch
-test "`$tinc $c1 get Mode`" = "switch"
-test "`$tinc $c1 get mode`" = "switch"
+test "`$tinc $c1 get Mode | sed 's/\r//'`" = "switch"
+test "`$tinc $c1 get mode | sed 's/\r//'`" = "switch"
$tinc $c1 set mode router
-test "`$tinc $c1 get Mode`" = "router"
-test "`$tinc $c1 get mode`" = "router"
+test "`$tinc $c1 get Mode | sed 's/\r//'`" = "router"
+test "`$tinc $c1 get mode | sed 's/\r//'`" = "router"
$tinc $c1 set Mode Switch
-test "`$tinc $c1 get Mode`" = "Switch"
+test "`$tinc $c1 get Mode | sed 's/\r//'`" = "Switch"
# Test deletion
$tinc $c1 add Mode switch
$tinc $c1 add Mode hub
-test "`$tinc $c1 get Mode`" = "hub"
+test "`$tinc $c1 get Mode | sed 's/\r//'`" = "hub"
# Test addition/deletion of multivalued variables
$tinc $c1 add Subnet 2
$tinc $c1 add Subnet 2
$tinc $c1 add Subnet 3
-test "`$tinc $c1 get Subnet`" = "1
+test "`$tinc $c1 get Subnet | sed 's/\r//'`" = "1
2
3"
$tinc $c1 del Subnet 2
-test "`$tinc $c1 get Subnet`" = "1
+test "`$tinc $c1 get Subnet | sed 's/\r//'`" = "1
3"
$tinc $c1 del Subnet
test -z "`$tinc $c1 get Subnet`"
$tinc $c1 add bar.PMTU 1
$tinc $c1 add bar.PMTU 2
-test "`$tinc $c1 get bar.PMTU`" = "2"
+test "`$tinc $c1 get bar.PMTU | sed 's/\r//'`" = "2"
$tinc $c1 add bar.Subnet 1
$tinc $c1 add bar.Subnet 2
$tinc $c1 add bar.Subnet 2
$tinc $c1 add bar.Subnet 3
-test "`$tinc $c1 get bar.Subnet`" = "1
+test "`$tinc $c1 get bar.Subnet | sed 's/\r//'`" = "1
2
3"
$tinc $c1 del bar.Subnet 2
-test "`$tinc $c1 get bar.Subnet`" = "1
+test "`$tinc $c1 get bar.Subnet | sed 's/\r//'`" = "1
3"
$tinc $c1 del bar.Subnet
test -z "`$tinc $c1 get bar.Subnet`"
$tinc $c1 set PrivateKey 12345 && exit 1 || true
$tinc $c1 --force set PrivateKey 12345
-test "`$tinc $c1 get PrivateKey`" = "12345"
+test "`$tinc $c1 get PrivateKey | sed 's/\r//'`" = "12345"
$tinc $c1 del PrivateKey
test -z "`$tinc $c1 get PrivateKey`"