1
1
#! /bin/sh
2
2
3
+ GREEN=' \x1B[0;32m'
4
+ RED=' \x1B[0;31m'
5
+ YELLOW=' \x1B[0;33m'
6
+ DEFAULT=' \x1B[0;0m'
7
+
3
8
all_tests_result=0
4
9
5
10
if [ 0 -eq $all_tests_result ]; then
6
- echo && echo ' Compiling and running Notecard Test Suite...'
11
+ echo && echo -e " ${YELLOW} Compiling and running Notecard Test Suite...${DEFAULT} "
7
12
g++ -fprofile-arcs -ftest-coverage -Wall -Wextra -Werror -Wpedantic -std=c++11 -O0 -g \
8
13
src/Notecard.cpp \
9
14
test/Notecard.test.cpp \
@@ -19,9 +24,9 @@ if [ 0 -eq $all_tests_result ]; then
19
24
valgrind --leak-check=full --error-exitcode=66 ./a.out
20
25
tests_result=$?
21
26
if [ 0 -eq ${tests_result} ]; then
22
- echo ' Notecard tests passed!'
27
+ echo -e " ${GREEN} Notecard tests passed!${DEFAULT} "
23
28
else
24
- echo " Notecard tests failed!"
29
+ echo -e " ${RED} Notecard tests failed!${DEFAULT} "
25
30
fi
26
31
all_tests_result=$(( all_tests_result+ tests_result))
27
32
else
@@ -30,7 +35,7 @@ if [ 0 -eq $all_tests_result ]; then
30
35
fi
31
36
32
37
if [ 0 -eq $all_tests_result ]; then
33
- echo && echo ' Compiling and running NoteI2c_Arduino Test Suite (no flags)...'
38
+ echo && echo -e " ${YELLOW} Compiling and running NoteI2c_Arduino Test Suite (no flags)...${DEFAULT} "
34
39
g++ -fprofile-arcs -ftest-coverage -Wall -Wextra -Werror -Wpedantic -std=c++11 -O0 -g \
35
40
src/NoteI2c_Arduino.cpp \
36
41
test/NoteI2c_Arduino.test.cpp \
@@ -43,9 +48,9 @@ if [ 0 -eq $all_tests_result ]; then
43
48
valgrind --leak-check=full --error-exitcode=66 ./a.out
44
49
tests_result=$?
45
50
if [ 0 -eq ${tests_result} ]; then
46
- echo ' NoteI2c_Arduino tests passed!'
51
+ echo -e " ${GREEN} NoteI2c_Arduino tests passed!${DEFAULT} "
47
52
else
48
- echo " NoteI2c_Arduino tests failed!"
53
+ echo -e " ${RED} NoteI2c_Arduino tests failed!${DEFAULT} "
49
54
fi
50
55
all_tests_result=$(( all_tests_result+ tests_result))
51
56
else
@@ -54,7 +59,7 @@ if [ 0 -eq $all_tests_result ]; then
54
59
fi
55
60
56
61
if [ 0 -eq $all_tests_result ]; then
57
- echo && echo ' Compiling and running NoteI2c_Arduino Test Suite (-DWIRE_HAS_END)...'
62
+ echo && echo -e " ${YELLOW} Compiling and running NoteI2c_Arduino Test Suite (-DWIRE_HAS_END)...${DEFAULT} "
58
63
g++ -fprofile-arcs -ftest-coverage -Wall -Wextra -Werror -Wpedantic -std=c++11 -O0 -g \
59
64
src/NoteI2c_Arduino.cpp \
60
65
test/NoteI2c_Arduino.test.cpp \
@@ -68,9 +73,9 @@ if [ 0 -eq $all_tests_result ]; then
68
73
valgrind --leak-check=full --error-exitcode=66 ./a.out
69
74
tests_result=$?
70
75
if [ 0 -eq ${tests_result} ]; then
71
- echo ' NoteI2c_Arduino tests passed! (-DWIRE_HAS_END)'
76
+ echo -e " ${GREEN} NoteI2c_Arduino tests passed! (-DWIRE_HAS_END)${DEFAULT} "
72
77
else
73
- echo " NoteI2c_Arduino tests failed!"
78
+ echo -e " ${RED} NoteI2c_Arduino tests failed!${DEFAULT} "
74
79
fi
75
80
all_tests_result=$(( all_tests_result+ tests_result))
76
81
else
@@ -79,7 +84,7 @@ if [ 0 -eq $all_tests_result ]; then
79
84
fi
80
85
81
86
if [ 0 -eq $all_tests_result ]; then
82
- echo && echo ' Compiling and running NoteLog_Arduino Test Suite...'
87
+ echo && echo -e " ${YELLOW} Compiling and running NoteLog_Arduino Test Suite...${DEFAULT} "
83
88
g++ -fprofile-arcs -ftest-coverage -Wall -Wextra -Werror -Wpedantic -std=c++11 -O0 -g \
84
89
src/NoteLog_Arduino.cpp \
85
90
test/NoteLog_Arduino.test.cpp \
@@ -91,9 +96,9 @@ if [ 0 -eq $all_tests_result ]; then
91
96
valgrind --leak-check=full --error-exitcode=66 ./a.out
92
97
tests_result=$?
93
98
if [ 0 -eq ${tests_result} ]; then
94
- echo ' NoteLog_Arduino tests passed!'
99
+ echo -e " ${GREEN} NoteLog_Arduino tests passed!${DEFAULT} "
95
100
else
96
- echo " NoteLog_Arduino tests failed!"
101
+ echo -e " ${RED} NoteLog_Arduino tests failed!${DEFAULT} "
97
102
fi
98
103
all_tests_result=$(( all_tests_result+ tests_result))
99
104
else
@@ -102,7 +107,7 @@ if [ 0 -eq $all_tests_result ]; then
102
107
fi
103
108
104
109
if [ 0 -eq $all_tests_result ]; then
105
- echo && echo ' Compiling and running NoteSerial_Arduino Test Suite...'
110
+ echo && echo -e " ${YELLOW} Compiling and running NoteSerial_Arduino Test Suite...${DEFAULT} "
106
111
g++ -fprofile-arcs -ftest-coverage -Wall -Wextra -Werror -Wpedantic -std=c++11 -O0 -g \
107
112
src/NoteSerial_Arduino.cpp \
108
113
test/NoteSerial_Arduino.test.cpp \
@@ -114,9 +119,9 @@ if [ 0 -eq $all_tests_result ]; then
114
119
valgrind --leak-check=full --error-exitcode=66 ./a.out
115
120
tests_result=$?
116
121
if [ 0 -eq ${tests_result} ]; then
117
- echo ' NoteSerial_Arduino tests passed!'
122
+ echo -e " ${GREEN} NoteSerial_Arduino tests passed!${DEFAULT} "
118
123
else
119
- echo " NoteSerial_Arduino tests failed!"
124
+ echo -e " ${RED} NoteSerial_Arduino tests failed!${DEFAULT} "
120
125
fi
121
126
all_tests_result=$(( all_tests_result+ tests_result))
122
127
else
126
131
127
132
# Print summary statement
128
133
if [ 0 -eq ${all_tests_result} ]; then
129
- echo && echo ' All tests have passed!' && echo
134
+ echo && echo -e " ${GREEN} All tests have passed!${DEFAULT} " && echo
130
135
131
136
# Run coverage if available
132
137
if [ $( which lcov) ]; then
@@ -140,14 +145,14 @@ if [ 0 -eq ${all_tests_result} ]; then
140
145
--output-file ./coverage/lcov.info \
141
146
--rc lcov_branch_coverage=1
142
147
if [ ! -f " ./coverage/lcov.info" ]; then
143
- echo " COVERAGE REPORT NOT PRODUCED!!!" ;
148
+ echo -e " ${YELLOW} COVERAGE REPORT NOT PRODUCED!!!${DEFAULT} " ;
144
149
all_tests_result=998
145
150
else
146
151
lcov --summary ./coverage/lcov.info
147
152
fi
148
153
fi
149
154
else
150
- echo && echo ' TESTS FAILED!!!'
155
+ echo && echo -e " ${RED} TESTS FAILED!!!${DEFAULT} "
151
156
fi
152
157
153
158
# Clean testing artifacts
0 commit comments