coverage: line and function coverage for core

This commit is contained in:
Matthias Ringwald 2019-09-17 15:11:58 +02:00
parent df6b38e67d
commit b338ca6049
24 changed files with 139 additions and 85 deletions

4
test/.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
*.gcda
*.gcno
coverage.info
coverage-html

View File

@ -53,4 +53,8 @@ test:
$(MAKE) -C $$dir test; \
done
coverage:
lcov --capture --directory . --exclude "/Applications/*" --exclude "/usr/*" --exclude "*/3rd-party/tinydir/*" --exclude "*/platform/posix/*" --exclude "*/test/*" --output-file coverage.info
genhtml coverage.info --branch-coverage --output-directory coverage-html

View File

@ -8,6 +8,8 @@ CFLAGS = -g -Wall \
-I.. \
-I${BTSTACK_ROOT}/src
CFLAGS += -fprofile-arcs -ftest-coverage
LDFLAGS += -lCppUTest -lCppUTestExt
VPATH += ${BTSTACK_ROOT}/src
@ -33,4 +35,5 @@ clean:
rm -f att_db_util_test
rm -f *.o
rm -rf *.dSYM
rm -f *.gcno *.gcda

View File

@ -118,3 +118,4 @@ test: all
clean:
rm -rf *.pyc *.o $(AVDTP_TESTS) *.dSYM *_test *.wav *.sbc ${BTSTACK_ROOT}/port/libusb/*.o
rm -f *.gcno *.gcda

View File

@ -97,3 +97,4 @@ test: all
clean:
rm -rf *.pyc *.o $(AVDTP_TESTS) *.dSYM *_test *.wav *.sbc
rm -f *.gcno *.gcda

View File

@ -6,6 +6,7 @@ BTSTACK_ROOT = ../..
CPPUTEST_HOME = ${BTSTACK_ROOT}/test/cpputest
CFLAGS = -g -Wall -I. -I../ -I${BTSTACK_ROOT}/src
CFLAGS += -fprofile-arcs -ftest-coverage
LDFLAGS += -lCppUTest -lCppUTestExt
VPATH += ${BTSTACK_ROOT}/src
@ -25,3 +26,4 @@ test: all
clean:
rm -fr base64_decoder_test *.dSYM *.o
rm -f *.gcno *.gcda

View File

@ -5,6 +5,7 @@ CC = g++
BTSTACK_ROOT = ../..
CFLAGS = -g -Wall -I.. -I${BTSTACK_ROOT}/src -I${BTSTACK_ROOT}/include
CFLAGS += -fprofile-arcs -ftest-coverage
LDFLAGS += -L$(CPPUTEST_HOME)/lib -lCppUTest -lCppUTestExt
VPATH += ${BTSTACK_ROOT}/src/ble
@ -12,16 +13,16 @@ VPATH += ${BTSTACK_ROOT}/src
VPATH += ${BTSTACK_ROOT}/platform/posix
COMMON = \
ad_parser.c \
btstack_linked_list.c \
btstack_memory.c \
btstack_memory_pool.c \
btstack_run_loop.c \
btstack_run_loop_posix.c \
btstack_util.c \
hci.c \
hci_cmd.c \
hci_dump.c \
ad_parser.c \
btstack_linked_list.c \
btstack_memory.c \
btstack_memory_pool.c \
btstack_run_loop.c \
btstack_run_loop_posix.c \
btstack_util.c \
hci.c \
hci_cmd.c \
hci_dump.c \
COMMON_OBJ = $(COMMON:.c=.o)
@ -37,4 +38,5 @@ clean:
rm -f ad_parser le_central
rm -f *.o
rm -rf *.dSYM
rm -f *.gcno *.gcda

View File

@ -11,6 +11,7 @@ CFLAGS = -g -Wall \
-I${BTSTACK_ROOT}/src \
-I${BTSTACK_ROOT}/platform/posix \
-I${BTSTACK_ROOT}/3rd-party/tinydir
CFLAGS += -fprofile-arcs -ftest-coverage
LDFLAGS += -lCppUTest -lCppUTestExt
@ -50,4 +51,5 @@ test: all
clean:
rm -f btstack_link_key_db_memory_test btstack_link_key_db_fs_test *.o ../src/*.o
rm -rf *.dSYM
rm -f *.gcno *.gcda

View File

@ -10,6 +10,7 @@ CFLAGS += -I. -I.. -I${BTSTACK_ROOT}/src -I${BTSTACK_ROOT}/platform/posix
CFLAGS += -I${BTSTACK_ROOT}/3rd-party/mbedtls/include
CFLAGS += -I${BTSTACK_ROOT}/3rd-party/micro-ecc
CFLAGS += -I${BTSTACK_ROOT}/test/rijndael
CFLAGS += -fprofile-arcs -ftest-coverage
LDFLAGS += -lCppUTest -lCppUTestExt
VPATH += ${BTSTACK_ROOT}/src
@ -29,6 +30,7 @@ MICROECC = \
all: aes_ccm_test aestest ecc_micro_ecc aes_cmac_test
aes_ccm_test: aes_ccm.o aes_ccm_test.o btstack_crypto.o btstack_linked_list.o hci_cmd.o btstack_util.o hci_dump.o aes_cmac.o rijndael.o mock.o
${CC} ${CFLAGS} $^ -o $@
aestest: aestest.o rijndael.o
${CC} ${CFLAGS} $^ -o $@
@ -52,4 +54,5 @@ clean:
rm -f aestest ecc_micro_ecc aes_cmac_test
rm -f *.o
rm -rf *.dSYM
rm -f *.gcno *.gcda

View File

@ -5,6 +5,7 @@ CC = g++
BTSTACK_ROOT = ../..
CFLAGS = -g -Wall -I.. -I${BTSTACK_ROOT}/src -I${BTSTACK_ROOT}/include
CFLAGS += -fprofile-arcs -ftest-coverage
LDFLAGS += -lCppUTest -lCppUTestExt
VPATH += ${BTSTACK_ROOT}/src
@ -29,4 +30,4 @@ test: all
clean:
rm -f des_iterator_test *.o
rm -rf *.dSYM

View File

@ -26,6 +26,7 @@ CFLAGS = \
-I${BTSTACK_ROOT}/src \
-I${BTSTACK_ROOT}/platform/embedded \
CFLAGS += -fprofile-arcs -ftest-coverage
LDFLAGS += -lCppUTest -lCppUTestExt
TESTS = tlv_test tlv_le_test
@ -34,6 +35,7 @@ all: ${TESTS}
clean:
rm -rf *.o $(TESTS) *.dSYM *.pklg
rm -f *.gcno *.gcda
tlv_test: ${COMMON_OBJ} btstack_link_key_db_tlv.o tlv_test.o
${CC} $^ ${CFLAGS} ${LDFLAGS} -o $@

View File

@ -5,6 +5,7 @@ CC = g++
BTSTACK_ROOT = ../..
CFLAGS = -DUNIT_TEST -x c++ -g -Wall -Wnarrowing -Wconversion-null -I. -I../ -I${BTSTACK_ROOT}/src
CFLAGS += -fprofile-arcs -ftest-coverage
LDFLAGS += -lCppUTest -lCppUTestExt
VPATH += ${BTSTACK_ROOT}/src
@ -12,18 +13,18 @@ VPATH += ${BTSTACK_ROOT}/src/ble
VPATH += ${BTSTACK_ROOT}/platform/posix
COMMON = \
ad_parser.c \
att_db.c \
att_dispatch.c \
btstack_linked_list.c \
btstack_memory.c \
btstack_memory_pool.c \
btstack_util.c \
gatt_client.c \
hci_cmd.c \
hci_dump.c \
le_device_db_memory.c \
mock.c \
ad_parser.c \
att_db.c \
att_dispatch.c \
btstack_linked_list.c \
btstack_memory.c \
btstack_memory_pool.c \
btstack_util.c \
gatt_client.c \
hci_cmd.c \
hci_dump.c \
le_device_db_memory.c \
mock.c \
COMMON_OBJ = $(COMMON:.c=.o)
@ -47,4 +48,5 @@ clean:
rm -f gatt_client_test le_central
rm -f *.o
rm -rf *.dSYM
rm -f *.gcno *.gcda

View File

@ -52,6 +52,7 @@ CFLAGS = -g -Wall -Wmissing-prototypes -Wnarrowing
# CFLAGS += -Werror
CFLAGS += -I. -I../ -I${BTSTACK_ROOT}/src -I${BTSTACK_ROOT}/src/classic -I${POSIX_ROOT} -I${BTSTACK_ROOT}/include
# CFLAGS += -D OCTAVE_OUTPUT
CFLAGS += -fprofile-arcs -ftest-coverage
LDFLAGS_CPPUTEST += -lCppUTest -lCppUTestExt
EXAMPLES = hfp_ag_parser_test hfp_ag_client_test hfp_hf_parser_test hfp_hf_client_test cvsd_plc_test pklg_cvsd_test
@ -60,6 +61,7 @@ all: ${EXAMPLES}
clean:
rm -rf *.o $(EXAMPLES) $(CLIENT_EXAMPLES) *.dSYM *.wav results/* pklg/*.wav
rm -f *.gcno *.gcda
hfp_ag_parser_test: ${COMMON_OBJ} hfp_gsm_model.o hfp_ag.o hfp.o hfp_ag_parser_test.c
${CC} $^ ${CFLAGS} ${LDFLAGS_CPPUTEST} -o $@

View File

@ -4,9 +4,11 @@ CC = g++
BTSTACK_ROOT = ../..
CFLAGS = -DUNIT_TEST -g
CPPFLAGS = -x c++ -Wall -Wno-unused
CFLAGS = -DUNIT_TEST -g
CFLAGS += -I. -I.. -I${BTSTACK_ROOT}/src
CFLAGS += -fprofile-arcs -ftest-coverage
LDFLAGS += -lCppUTest -lCppUTestExt
VPATH += ${BTSTACK_ROOT}/src
@ -27,4 +29,5 @@ clean:
rm -f hid_parser_test
rm -f *.o
rm -rf *.dSYM
rm -f *.gcno *.gcda

View File

@ -6,6 +6,7 @@ BTSTACK_ROOT = ../..
CPPUTEST_HOME = ${BTSTACK_ROOT}/test/cpputest
CFLAGS = -g -Wall -I. -I../ -I${BTSTACK_ROOT}/src -I${BTSTACK_ROOT}/include
CFLAGS += -fprofile-arcs -ftest-coverage
LDFLAGS += -lCppUTest -lCppUTestExt
VPATH += ${BTSTACK_ROOT}/src/ble
@ -28,5 +29,6 @@ test: all
./btstack_linked_list_test
clean:
rm -fr btstack_linked_list_test *.dSYM *.o ../src/*.o
rm -fr btstack_linked_list_test *.dSYM *.o ../src/*.o
rm -f *.gcno *.gcda

View File

@ -53,4 +53,5 @@ clean:
rm -f map_client_test
rm -f *.o
rm -rf *.dSYM
rm -f *.gcno *.gcda

View File

@ -18,6 +18,8 @@ CFLAGS += -I${BTSTACK_ROOT}/3rd-party/yxml
VPATH += ${BTSTACK_ROOT}/test/map_client
CFLAGS += -I${BTSTACK_ROOT}/test/map_client
CFLAGS += -fprofile-arcs -ftest-coverage
COMMON = \
yxml.c \
btstack_util.c \
@ -38,4 +40,5 @@ test: all
clean:
rm -fr map_xml_test *.dSYM *.o ../src/*.o
rm -f *.gcno *.gcda

View File

@ -38,6 +38,8 @@ CFLAGS += -g -DUNIT_TEST -Wall \
-I$(BTSTACK_ROOT)/3rd-party/tinydir \
-I$(BTSTACK_ROOT)/test/rijndael \
CFLAGS += -fprofile-arcs -ftest-coverage
VPATH += ${BTSTACK_ROOT}/test/rijndael
VPATH += ${BTSTACK_ROOT}/src/mesh
VPATH += ${BTSTACK_ROOT}/src/classic
@ -85,4 +87,5 @@ clean:
rm -rf *.dSYM
rm -f ${EXAMPLES}
rm -f mesh_provisioning_device.h
rm -f *.gcno *.gcda

View File

@ -6,6 +6,7 @@ BTSTACK_ROOT = ../..
CPPUTEST_HOME = ${BTSTACK_ROOT}/test/cpputest
CFLAGS = -g -Wall -I. -I../ -I${BTSTACK_ROOT}/src -I${BTSTACK_ROOT}/include
CFLAGS += -fprofile-arcs -ftest-coverage
LDFLAGS += -lCppUTest -lCppUTestExt
VPATH += ${BTSTACK_ROOT}/src/ble
@ -30,4 +31,5 @@ test: all
clean:
rm -fr obex_message_builder_test *.dSYM *.o
rm -f *.gcno *.gcda

View File

@ -6,6 +6,7 @@ BTSTACK_ROOT = ../..
CPPUTEST_HOME = ${BTSTACK_ROOT}/test/cpputest
CFLAGS = -g -Wall -I. -I../ -I${BTSTACK_ROOT}/src
CFLAGS += -fprofile-arcs -ftest-coverage
LDFLAGS += -lCppUTest -lCppUTestExt
VPATH += ${BTSTACK_ROOT}/src
@ -24,5 +25,6 @@ test: all
./btstack_ring_buffer_test
clean:
rm -fr btstack_ring_buffer_test *.dSYM *.o ../src/*.o
rm -fr btstack_ring_buffer_test *.dSYM *.o ../src/*.o *.gcda *.gcno
rm -f *.gcno *.gcda

View File

@ -8,51 +8,53 @@ CFLAGS = -g -Wall \
-I.. \
-I${BTSTACK_ROOT}/src \
CFLAGS += -fprofile-arcs -ftest-coverage
LDFLAGS += -lCppUTest -lCppUTestExt
VPATH += ${BTSTACK_ROOT}/src
VPATH += ${BTSTACK_ROOT}/src/classic
COMMON = \
btstack_util.c \
hci_dump.c \
hci.c \
hci_cmd.c \
btstack_run_loop.c \
rfcomm.c \
ad_parser.c \
sdp_client.c \
sdp_client_rfcomm.c \
l2cap.c \
l2cap_signaling.c \
btstack_linked_list.c \
btstack_memory.c \
btstack_memory_pool.c \
device_id_server.c \
avdtp.c \
a2dp_source.c \
a2dp_sink.c \
avdtp.c \
avdtp_util.c \
avdtp_sink.c \
avdtp_source.c \
avdtp_acceptor.c \
avdtp_initiator.c \
avrcp.c \
avrcp_controller.c \
avrcp_target.c \
hfp.c \
hfp_gsm_model.c \
hfp_ag.c \
hfp_hf.c \
hsp_hs.c \
hsp_ag.c \
hid_device.c \
pan.c \
sdp_util.c \
spp_server.c \
btstack_hid_parser.c \
btstack_util.c \
hci_dump.c \
hci.c \
hci_cmd.c \
btstack_run_loop.c \
rfcomm.c \
ad_parser.c \
sdp_client.c \
sdp_client_rfcomm.c \
l2cap.c \
l2cap_signaling.c \
btstack_linked_list.c \
btstack_memory.c \
btstack_memory_pool.c \
device_id_server.c \
avdtp.c \
a2dp_source.c \
a2dp_sink.c \
avdtp.c \
avdtp_util.c \
avdtp_sink.c \
avdtp_source.c \
avdtp_acceptor.c \
avdtp_initiator.c \
avrcp.c \
avrcp_controller.c \
avrcp_target.c \
hfp.c \
hfp_gsm_model.c \
hfp_ag.c \
hfp_hf.c \
hsp_hs.c \
hsp_ag.c \
hid_device.c \
pan.c \
sdp_util.c \
spp_server.c \
btstack_hid_parser.c \
COMMON_OBJ = $(COMMON:.c=.o)
all: sdp_record_builder
@ -67,4 +69,5 @@ clean:
rm -f sdp_record_builder
rm -f *.o
rm -rf *.dSYM
rm -f *.gcno *.gcda

View File

@ -6,6 +6,7 @@ BTSTACK_ROOT = ../..
CPPUTEST_HOME = ${BTSTACK_ROOT}/test/cpputest
CFLAGS = -g -Wall -I.. -I${BTSTACK_ROOT}/src
CFLAGS += -fprofile-arcs -ftest-coverage
LDFLAGS += -lCppUTest -lCppUTestExt
# -L$(CPPUTEST_HOME)
@ -46,4 +47,5 @@ test: all
clean:
rm -f sdp_rfcomm_query general_sdp_query service_attribute_search_query service_search_query *.o *.o
rm -rf *.dSYM
rm -f *.gcno *.gcda

View File

@ -10,6 +10,7 @@ CFLAGS += -I. -I.. -I${BTSTACK_ROOT}/src -I${BTSTACK_ROOT}/platform/posix
CFLAGS += -I${BTSTACK_ROOT}/3rd-party/mbedtls/include
CFLAGS += -I${BTSTACK_ROOT}/3rd-party/micro-ecc
CFLAGS += -I${BTSTACK_ROOT}/test/rijndael
CFLAGS += -fprofile-arcs -ftest-coverage
LDFLAGS += -lCppUTest -lCppUTestExt
VPATH += ${BTSTACK_ROOT}/src
@ -19,21 +20,21 @@ VPATH += ${BTSTACK_ROOT}/3rd-party/micro-ecc
VPATH += ${BTSTACK_ROOT}/test/rijndael
COMMON = \
btstack_crypto.c \
btstack_linked_list.c \
btstack_memory.c \
btstack_memory_pool.c \
btstack_run_loop.c \
btstack_run_loop_posix.c \
hci_cmd.c \
hci_dump.c \
le_device_db_memory.c \
mock.c \
rijndael.c \
sm.c \
btstack_util.c \
btstack_crypto.c \
btstack_linked_list.c \
btstack_memory.c \
btstack_memory_pool.c \
btstack_run_loop.c \
btstack_run_loop_posix.c \
hci_cmd.c \
hci_dump.c \
le_device_db_memory.c \
mock.c \
rijndael.c \
sm.c \
btstack_util.c \
btstack_tlv.c \
COMMON_OBJ = $(COMMON:.c=.o)
MBEDTLS = \
@ -56,4 +57,5 @@ clean:
rm -f security_manager
rm -f *.o
rm -rf *.dSYM
rm -f *.gcno *.gcda

View File

@ -25,6 +25,7 @@ CFLAGS = \
-I${BTSTACK_ROOT}/src \
-I${BTSTACK_ROOT}/platform/posix \
CFLAGS += -fprofile-arcs -ftest-coverage
LDFLAGS += -lCppUTest -lCppUTestExt
TESTS = tlv_test
@ -33,6 +34,7 @@ all: ${TESTS}
clean:
rm -rf *.o $(TESTS) *.dSYM *.pklg
rm -f *.gcno *.gcda
tlv_test: ${COMMON_OBJ} tlv_test.o
${CC} $^ ${CFLAGS} ${LDFLAGS} -o $@