mavtables  0.2.1
MAVLink router and firewall.
unit_tests/run_tests.sh
Go to the documentation of this file.
1 #!/bin/bash
2 
3 
4 function dir() {
5  DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
6  echo "$DIR"
7 }
8 
9 
10 source "$(dir)/../ansi_codes.sh"
11 
12 
13 function shutdown_background() {
14  array=($(jobs -p))
15  for ((i = ${#array[@]} - 1; i >= 0; i--)); do
16  kill -SIGINT ${array[i]} >/dev/null
17  sleep 0.5
18  done
19 }
20 
21 
22 echo -en "${_BOLD}${_BLUE}*---------------------------------------"
23 echo -en "--------------------------------------*\n"
24 echo -en "${_BOLD}${_BLUE}| "
25 echo -en "Unit Tests"
26 echo -en " |\n"
27 echo -en "${_BOLD}${_BLUE}*---------------------------------------"
28 echo -en "--------------------------------------*\n"
29 echo -en "${ANSI_RESET}"
30 
31 
32 socat pty,link=./ttyS0,raw,echo=0 pty,link=./ttyS1,raw,echo=0 &
33 sleep 5
34 
35 ./build/unit_tests
36 UNIT_TESTS_EXIT=$?
37 sleep 1
38 
39 shutdown_background
40 
41 if [ "$UNIT_TESTS_EXIT" -ne "0" ]; then
42  exit 1;
43 fi