testlib.sh 776 B

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