Skip to content

Commit 5e85578

Browse files
authored
feat: Report Coverage Statistics (#54)
1 parent 385b011 commit 5e85578

File tree

1 file changed

+47
-5
lines changed

1 file changed

+47
-5
lines changed

test/run_all_tests.sh

Lines changed: 47 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,17 @@
22

33
all_tests_result=0
44

5-
g++ -Wall -Wextra -Wpedantic src/Notecard.cpp src/NoteI2c_Arduino.cpp src/NoteLog_Arduino.cpp src/NoteSerial_Arduino.cpp test/Notecard.test.cpp test/mock/mock-arduino.cpp test/mock/mock-note-c-note.c -std=c++11 -Isrc -Itest -DNOTE_MOCK
5+
g++ -fprofile-arcs -ftest-coverage -Wall -Wextra -Wpedantic -std=c++11 -O0 -g \
6+
src/Notecard.cpp \
7+
src/NoteI2c_Arduino.cpp \
8+
src/NoteLog_Arduino.cpp \
9+
src/NoteSerial_Arduino.cpp \
10+
test/Notecard.test.cpp \
11+
test/mock/mock-arduino.cpp \
12+
test/mock/mock-note-c-note.c \
13+
-Isrc \
14+
-Itest \
15+
-DNOTE_MOCK
616
if [ 0 -eq $? ] && [ 0 -eq $all_tests_result ]; then
717
echo
818
valgrind --leak-check=full --error-exitcode=66 ./a.out
@@ -17,7 +27,14 @@ else
1727
all_tests_result=999
1828
fi
1929

20-
g++ -Wall -Wextra -Wpedantic src/NoteI2c_Arduino.cpp test/NoteI2c_Arduino.test.cpp test/mock/mock-arduino.cpp test/mock/mock-note-c-note.c -std=c++11 -Isrc -Itest -DNOTE_MOCK
30+
g++ -fprofile-arcs -ftest-coverage -Wall -Wextra -Wpedantic -std=c++11 -O0 -g \
31+
src/NoteI2c_Arduino.cpp \
32+
test/NoteI2c_Arduino.test.cpp \
33+
test/mock/mock-arduino.cpp \
34+
test/mock/mock-note-c-note.c \
35+
-Isrc \
36+
-Itest \
37+
-DNOTE_MOCK
2138
if [ 0 -eq $? ] && [ 0 -eq $all_tests_result ]; then
2239
echo
2340
valgrind --leak-check=full --error-exitcode=66 ./a.out
@@ -32,7 +49,15 @@ else
3249
all_tests_result=999
3350
fi
3451

35-
g++ -Wall -Wextra -Wpedantic src/NoteI2c_Arduino.cpp test/NoteI2c_Arduino.test.cpp test/mock/mock-arduino.cpp test/mock/mock-note-c-note.c -std=c++11 -Isrc -Itest -DNOTE_MOCK -DWIRE_HAS_END
52+
g++ -fprofile-arcs -ftest-coverage -Wall -Wextra -Wpedantic -std=c++11 -O0 -g \
53+
src/NoteI2c_Arduino.cpp \
54+
test/NoteI2c_Arduino.test.cpp \
55+
test/mock/mock-arduino.cpp \
56+
test/mock/mock-note-c-note.c \
57+
-Isrc \
58+
-Itest \
59+
-DNOTE_MOCK \
60+
-DWIRE_HAS_END
3661
if [ 0 -eq $? ] && [ 0 -eq $all_tests_result ]; then
3762
echo
3863
valgrind --leak-check=full --error-exitcode=66 ./a.out
@@ -47,7 +72,13 @@ else
4772
all_tests_result=999
4873
fi
4974

50-
g++ -Wall -Wextra -Wpedantic src/NoteLog_Arduino.cpp test/NoteLog_Arduino.test.cpp test/mock/mock-arduino.cpp -std=c++11 -Isrc -Itest -DNOTE_MOCK
75+
g++ -fprofile-arcs -ftest-coverage -Wall -Wextra -Wpedantic -std=c++11 -O0 -g \
76+
src/NoteLog_Arduino.cpp \
77+
test/NoteLog_Arduino.test.cpp \
78+
test/mock/mock-arduino.cpp \
79+
-Isrc \
80+
-Itest \
81+
-DNOTE_MOCK
5182
if [ 0 -eq $? ] && [ 0 -eq $all_tests_result ]; then
5283
echo
5384
valgrind --leak-check=full --error-exitcode=66 ./a.out
@@ -62,7 +93,13 @@ else
6293
all_tests_result=999
6394
fi
6495

65-
g++ -Wall -Wextra -Wpedantic src/NoteSerial_Arduino.cpp test/NoteSerial_Arduino.test.cpp test/mock/mock-arduino.cpp -std=c++11 -Isrc -Itest -DNOTE_MOCK
96+
g++ -fprofile-arcs -ftest-coverage -Wall -Wextra -Wpedantic -std=c++11 -O0 -g \
97+
src/NoteSerial_Arduino.cpp \
98+
test/NoteSerial_Arduino.test.cpp \
99+
test/mock/mock-arduino.cpp \
100+
-Isrc \
101+
-Itest \
102+
-DNOTE_MOCK
66103
if [ 0 -eq $? ] && [ 0 -eq $all_tests_result ]; then
67104
echo
68105
valgrind --leak-check=full --error-exitcode=66 ./a.out
@@ -80,6 +117,11 @@ fi
80117
echo
81118
if [ 0 -eq ${all_tests_result} ]; then
82119
echo 'All tests have passed!'
120+
gcovr --print-summary --sort-percentage --exclude-throw-branches --delete \
121+
--object-directory . \
122+
--root src \
123+
--exclude .*_error.* \
124+
&& rm ./a.out *.gcno
83125
else
84126
echo 'TESTS FAILED!!!'
85127
fi

0 commit comments

Comments
 (0)