Start of a test suite.
This commit is contained in:
parent
d01ab07f78
commit
05a7f0b2fb
7 changed files with 95 additions and 2 deletions
|
@ -2,7 +2,7 @@
|
|||
|
||||
AUTOMAKE_OPTIONS = gnu
|
||||
|
||||
SUBDIRS = m4 src doc gui
|
||||
SUBDIRS = m4 src doc gui test
|
||||
|
||||
ACLOCAL_AMFLAGS = -I m4
|
||||
|
||||
|
|
|
@ -212,6 +212,6 @@ AC_ARG_ENABLE(jumbograms,
|
|||
]
|
||||
)
|
||||
|
||||
AC_CONFIG_FILES([Makefile src/Makefile doc/Makefile m4/Makefile gui/Makefile])
|
||||
AC_CONFIG_FILES([Makefile src/Makefile doc/Makefile m4/Makefile gui/Makefile test/Makefile])
|
||||
|
||||
AC_OUTPUT
|
||||
|
|
9
test/Makefile.am
Normal file
9
test/Makefile.am
Normal file
|
@ -0,0 +1,9 @@
|
|||
TESTS = \
|
||||
executables.test \
|
||||
basic.test \
|
||||
sptps_basic.test
|
||||
|
||||
EXTRA_DIST = testlib.sh
|
||||
|
||||
clean-local:
|
||||
-rm -rf *.test.?
|
22
test/basic.test
Executable file
22
test/basic.test
Executable file
|
@ -0,0 +1,22 @@
|
|||
#!/bin/sh
|
||||
|
||||
. ./testlib.sh
|
||||
|
||||
# Initialize and test one node
|
||||
|
||||
rm -rf config1
|
||||
|
||||
$tinc $c1 init foo
|
||||
$tinc $c1 set DeviceType dummy
|
||||
$tinc $c1 set Port 0
|
||||
|
||||
# Test running in the foreground
|
||||
|
||||
(sleep 1; $tinc $c1 stop) &
|
||||
$tinc $c1 start $r1 -D
|
||||
|
||||
# Test running tinc in the background
|
||||
|
||||
$tinc $c1 start $r1
|
||||
sleep 1
|
||||
$tinc $c1 stop
|
8
test/executables.test
Executable file
8
test/executables.test
Executable file
|
@ -0,0 +1,8 @@
|
|||
#!/bin/sh
|
||||
|
||||
. ./testlib.sh
|
||||
|
||||
# Just test whether the executables work
|
||||
$tincd --help
|
||||
$tinc --help
|
||||
$sptps_test --help
|
21
test/sptps_basic.test
Executable file
21
test/sptps_basic.test
Executable file
|
@ -0,0 +1,21 @@
|
|||
#!/bin/sh
|
||||
|
||||
. ./testlib.sh
|
||||
|
||||
# Generate keys
|
||||
|
||||
mkdir -p $d1
|
||||
|
||||
openssl ecparam -genkey -name secp521r1 -noout -out $d1/server.priv
|
||||
openssl ecparam -genkey -name secp521r1 -noout -out $d1/client.priv
|
||||
yes '' | openssl req -new -pubkey -key $d1/server.priv -noout -out $d1/server.pub
|
||||
echo
|
||||
yes '' | openssl req -new -pubkey -key $d1/client.priv -noout -out $d1/client.pub
|
||||
echo
|
||||
|
||||
# Test transfer of a simple file.
|
||||
|
||||
(sleep 2; cat ../README; sleep 1) | $sptps_test $d1/server.priv $d1/client.pub 32750 &
|
||||
sleep 1
|
||||
sleep 3 | $sptps_test $d1/client.priv $d1/server.pub localhost 32750 >$d1/out
|
||||
cmp $d1/out ../README
|
33
test/testlib.sh
Normal file
33
test/testlib.sh
Normal file
|
@ -0,0 +1,33 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Paths to executables
|
||||
|
||||
tincd=../src/tincd
|
||||
tinc=../src/tinc
|
||||
sptps_test=../src/sptps_test
|
||||
|
||||
# Test directories
|
||||
|
||||
d1=$PWD/$_.1
|
||||
d2=$PWD/$_.2
|
||||
d3=$PWD/$_.3
|
||||
|
||||
# Remove test directories
|
||||
|
||||
rm -rf $d1 $d2 $d3
|
||||
|
||||
# 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=$d1/log -d5"
|
||||
r3="--logfile=$d1/log -d5"
|
||||
|
||||
# Exit on errors, log all commands being executed
|
||||
|
||||
set -ex
|
Loading…
Reference in a new issue