tinc/test/testlib.sh.in

47 lines
833 B
Bash
Raw Permalink Normal View History

2019-08-26 11:44:51 +00:00
#!/bin/sh
# Paths to executables
2022-04-22 18:24:15 +00:00
tincd=../src/tincd@EXEEXT@
tinc=../src/tinc@EXEEXT@
sptps_test=../src/sptps_test@EXEEXT@
sptps_keypair=../src/sptps_keypair@EXEEXT@
2019-08-26 11:44:51 +00:00
# Test directories
2019-08-26 11:44:52 +00:00
scriptname=`basename $0`
2022-04-22 18:24:15 +00:00
n1=$scriptname.1
n2=$scriptname.2
n3=$scriptname.3
d1=$PWD/$n1
d2=$PWD/$n2
d3=$PWD/$n3
2019-08-26 11:44:51 +00:00
# Default arguments for both tinc and tincd
2022-04-22 18:24:15 +00:00
c1="-n $n1 --config=$d1 --pidfile=$d1/pid"
c2="-n $n2 --config=$d2 --pidfile=$d2/pid"
c3="-n $n3 --config=$d3 --pidfile=$d3/pid"
2019-08-26 11:44:51 +00:00
# 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