-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathexecute_unit_test.sh
83 lines (63 loc) · 2.48 KB
/
execute_unit_test.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#!/bin/bash
#Short description...
#This module is used to execute the unit tests for this project
#__author__ = "Dennis Jung"
#__copyright__ = "Copyright 2019, Dennis Jung"
#__credits__ = ["Dennis Jung"]
#__license__ = "GPL Version 3"
#__maintainer__ = "Dennis Jung"
#__email__ = "[email protected]"
#===============================================================================
# Constant declaration
#===============================================================================
# SHELL_COLORS
FORMAT_RED_NORMAL="\033[31;1m"
FORMAT_BLUE_NORMAL="\033[34;1m"
FORMAT_YELLOW_NORMAL="\033[33;1m"
FORMAT_GREEN_NORMAL="\033[32;1m"
FORMAT_DEFAULT="\033[0m"
#===============================================================================
# Determine system type
#===============================================================================
unameOut="$(uname -s)"
case "${unameOut}" in
Linux*) machine=Linux;;
Darwin*) machine=Mac;;
CYGWIN*) machine=Cygwin;;
MINGW*) machine=MinGw;;
*) machine="UNKNOWN:${unameOut}"
esac
#===============================================================================
# Adapt system commands to machine type
#===============================================================================
case "${unameOut}" in
Linux*) ESCAPED_ECHO=$(echo -e);;
Mac*) ESCAPED_ECHO=$(echo);;
esac
#===============================================================================
# Function definitions
#===============================================================================
# This functions writes a log message on the shell using
# the following parameters
#
# log_message (color, tag, message)
# color: Color from the list SHELL_COLORS
# tag: Will be written in braces in front of the log message;
# provided in quotes
# message: Message to be written on the shell; provided in quotes
log_message () {
color=$1
tag=$2
message=$3
echo $ESCAPED_ECHO "[$color$tag$FORMAT_DEFAULT] $message"
}
#===============================================================================
# Start of script
#===============================================================================
# Clear the shell screen
clear
# Write initial log message
log_message $FORMAT_YELLOW_NORMAL "info" "Start execution of: $0"
log_message $FORMAT_GREEN_NORMAL "info" "Start unit tests"
py.test -v --cov-report term-missing --cov FBPresence
log_message $FORMAT_GREEN_NORMAL "info" "Finalize unit tests"