Fix tests on *BSD.
[tinc] / test / testlib.sh
1 #!/bin/sh
2
3 # Paths to executables
4
5 tincd=../src/tincd
6 tinc=../src/tinc
7 sptps_test=../src/sptps_test
8 sptps_keypair=../src/sptps_keypair
9
10 # Test directories
11
12 scriptname=`basename $0`
13 d1=$PWD/$scriptname.1
14 d2=$PWD/$scriptname.2
15 d3=$PWD/$scriptname.3
16
17 # Default arguments for both tinc and tincd
18
19 c1="--config=$d1 --pidfile=$d1/pid"
20 c2="--config=$d2 --pidfile=$d2/pid"
21 c3="--config=$d3 --pidfile=$d3/pid"
22
23 # Arguments when running tincd
24
25 r1="--logfile=$d1/log -d5"
26 r2="--logfile=$d2/log -d5"
27 r3="--logfile=$d3/log -d5"
28
29 # Check for leftover tinc daemons
30
31 [ -f $d1/pid ] && $tinc $c1 stop
32 [ -f $d2/pid ] && $tinc $c2 stop
33 [ -f $d3/pid ] && $tinc $c3 stop
34
35 # Remove test directories
36
37 rm -rf $d1 $d2 $d3
38
39 # Exit on errors, log all commands being executed
40
41 set -ex