X-Git-Url: https://tinc-vpn.org/git/browse?p=tinc;a=blobdiff_plain;f=test%2Ftestlib.sh;h=31033352c4137d19c474755294c5826af807d6de;hp=e65127d6acf9bd3b20779ad9a30b98195aedcf50;hb=5cbc12b3d482231fc7e71fbe176c91971993760e;hpb=05a7f0b2fb07f8ee7752604a2a87b85f2430aaa3 diff --git a/test/testlib.sh b/test/testlib.sh index e65127d6..31033352 100644 --- a/test/testlib.sh +++ b/test/testlib.sh @@ -5,16 +5,22 @@ tincd=../src/tincd tinc=../src/tinc sptps_test=../src/sptps_test +sptps_keypair=../src/sptps_keypair # Test directories -d1=$PWD/$_.1 -d2=$PWD/$_.2 -d3=$PWD/$_.3 - -# Remove test directories - -rm -rf $d1 $d2 $d3 +case "$_" in + /*) + d1=$_.1 + d2=$_.2 + d3=$_.3 + ;; + *) + d1=$PWD/$_.1 + d2=$PWD/$_.2 + d3=$PWD/$_.3 + ;; +esac # Default arguments for both tinc and tincd @@ -25,8 +31,18 @@ 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" +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