xref: /btstack/test/Makefile (revision c0fa7c1debc54241a0deecdb6e66d6de04a942d3)
157fe2af8SMatthias Ringwald
257fe2af8SMatthias Ringwald# Makefile to build and run all tests
357fe2af8SMatthias Ringwald
457fe2af8SMatthias RingwaldSUBDIRS =  \
5d2011e9eSMilanka Ringwald	ad_parser \
641362367SMilanka Ringwald	att_db \
7f7cf8388SMatthias Ringwald	avdtp \
819650ae8SMilanka Ringwald	avdtp_util \
91c22f3beSMatthias Ringwald	base64 \
1057fe2af8SMatthias Ringwald	ble_client \
11f7cf8388SMatthias Ringwald	btstack_link_key_db \
129b8d06a5SMilanka Ringwald	btstack_memory \
13415a769fSMatthias Ringwald	classic-oob-pairing \
141c22f3beSMatthias Ringwald	crypto \
1557fe2af8SMatthias Ringwald	des_iterator \
160f7fd6c1SMilanka Ringwald	embedded \
17dd2dbe6aSMatthias Ringwald	flash_tlv \
181470db0cSMatthias Ringwald	gap \
190f7fd6c1SMilanka Ringwald	gatt-service-client \
20ae970bb9SMilanka Ringwald	gatt_client \
21ae970bb9SMilanka Ringwald	gatt_server \
2276181014SMilanka Ringwald	gatt_service_server \
2394818a3bSMatthias Ringwald	hfp \
241c22f3beSMatthias Ringwald	hid_parser \
25af7c3ae6SMatthias Ringwald	l2cap-cbm \
26af7c3ae6SMatthias Ringwald	l2cap-ecbm \
2721c2455cSMilanka Ringwald	le_device_db_tlv \
28ae970bb9SMilanka Ringwald	linked_list \
29d491c1eaSMatthias Ringwald	mesh \
301c22f3beSMatthias Ringwald	obex \
311c22f3beSMatthias Ringwald	ring_buffer \
329ccd94f8SMatthias Ringwald	sdp \
3357fe2af8SMatthias Ringwald	sdp_client \
34fe03d808SMatthias Ringwald	security_manager \
351c22f3beSMatthias Ringwald	tlv_posix \
362ce916b3SMatthias Ringwald
37464d3e43SMatthias Ringwald# not testing anything in source tree
38464d3e43SMatthias Ringwald#	maths \
3973e5d7d0SMatthias Ringwald# no unit tests
4073e5d7d0SMatthias Ringwald#	embedded \
4173e5d7d0SMatthias Ringwald#	gatt_server \
42b17ed348SMatthias Ringwald# mixes classic with ble
43b17ed348SMatthias Ringwald#    flash_tlv - contains btstack_linked_key_db tests
44b17ed348SMatthias Ringwald# hangs on buildbot (no output for 20 minutes -> abort)
45b17ed348SMatthias Ringwald#	security_manager_sc
46f400efd4SMatthias Ringwald
47f400efd4SMatthias RingwaldSUBDIRS_BLE = \
48d2011e9eSMilanka Ringwald	ad_parser \
49f400efd4SMatthias Ringwald	att_db \
50f400efd4SMatthias Ringwald	ble_client \
519b8d06a5SMilanka Ringwald	btstack_memory \
52f400efd4SMatthias Ringwald	crypto \
531ebfed24SMatthias Ringwald	embedded \
54f400efd4SMatthias Ringwald	gap \
550f7fd6c1SMilanka Ringwald	gatt-service-client \
56ae970bb9SMilanka Ringwald	gatt_client \
570ce29069SMatthias Ringwald	gatt_server \
5876181014SMilanka Ringwald	gatt_service_server \
59f400efd4SMatthias Ringwald	hid_parser \
60af7c3ae6SMatthias Ringwald	l2cap-cbm \
6121c2455cSMilanka Ringwald	le_device_db_tlv \
62f400efd4SMatthias Ringwald	linked_list \
63f400efd4SMatthias Ringwald	ring_buffer \
64f400efd4SMatthias Ringwald	security_manager \
651f56122cSMatthias Ringwald
661c22f3beSMatthias Ringwald# test fails
671c22f3beSMatthias Ringwald
681c22f3beSMatthias Ringwald# not unit-tests
69464d3e43SMatthias Ringwald# avrcp \
701c22f3beSMatthias Ringwald# map_client \
711c22f3beSMatthias Ringwald# sbc \
72c757f61eSMatthias Ringwald#	gatt_server \
73c757f61eSMatthias Ringwald
7477e8932bSMatthias Ringwald.PHONY: coverage coverage-sm-sc.info
75deb45786SMatthias Ringwald
7657fe2af8SMatthias Ringwaldsubdirs:
7757fe2af8SMatthias Ringwald	echo Building all tests
78bbf26c65SMatthias Ringwald	@set -e; \
7957fe2af8SMatthias Ringwald	for dir in $(SUBDIRS); do \
8057fe2af8SMatthias Ringwald	  $(MAKE) -C $$dir; \
8157fe2af8SMatthias Ringwald	done
8257fe2af8SMatthias Ringwald
8357fe2af8SMatthias Ringwaldclean:
8457fe2af8SMatthias Ringwald	echo Clean all test
85bbf26c65SMatthias Ringwald	@set -e; \
8657fe2af8SMatthias Ringwald	for dir in $(SUBDIRS); do \
8757fe2af8SMatthias Ringwald	  $(MAKE) -C $$dir clean; \
8857fe2af8SMatthias Ringwald	done
89*c0fa7c1dSMatthias Ringwald	rm -f *.info
90*c0fa7c1dSMatthias Ringwald	rm -rf coverage coverage-unit-ble
9157fe2af8SMatthias Ringwald
929dbbd7d0SMatthias Ringwaldsubdirs-coverage:
939dbbd7d0SMatthias Ringwald	echo Run all tests for coverage
949dbbd7d0SMatthias Ringwald	@set -e; \
959dbbd7d0SMatthias Ringwald	for dir in $(SUBDIRS); do \
969dbbd7d0SMatthias Ringwald	  $(MAKE) -C $$dir coverage; \
979dbbd7d0SMatthias Ringwald	done
989dbbd7d0SMatthias Ringwald
999dbbd7d0SMatthias Ringwaldsubdirs-coverage-ble:
1009dbbd7d0SMatthias Ringwald	echo Run all BLE tests for coverage
1019dbbd7d0SMatthias Ringwald	@set -e; \
1029dbbd7d0SMatthias Ringwald	for dir in $(SUBDIRS_BLE); do \
1039dbbd7d0SMatthias Ringwald	  $(MAKE) -C $$dir coverage; \
1049dbbd7d0SMatthias Ringwald	done
1059dbbd7d0SMatthias Ringwald
106f400efd4SMatthias Ringwald
107f4e14552SMatthias Ringwaldcoverage-unit.info: subdirs-coverage
108f400efd4SMatthias Ringwald	# delete trace data
109f400efd4SMatthias Ringwald	find . -name "*.gcda" -type f -delete
110f400efd4SMatthias Ringwald	# run tests
1119dbbd7d0SMatthias Ringwald	$(MAKE) subdirs-coverage
112464d3e43SMatthias Ringwald	# collect traces
113ee858f05SMatthias Ringwald	lcov --capture --rc lcov_branch_coverage=1 --directory . --exclude "/Applications/*" --exclude "/Library/*" --exclude "/usr/*" --exclude "*/test/*" --output-file coverage-unit.info
114ee858f05SMatthias Ringwald
115f4e14552SMatthias Ringwaldcoverage-unit-ble.info: subdirs-coverage-ble
116f8e02f4bSMatthias Ringwald	# delete trace data
117f8e02f4bSMatthias Ringwald	find . -name "*.gcda" -type f -delete
118f8e02f4bSMatthias Ringwald	# run tests
1199dbbd7d0SMatthias Ringwald	$(MAKE) subdirs-coverage-ble
120f8e02f4bSMatthias Ringwald	# collect traces
121f8e02f4bSMatthias Ringwald	lcov --capture --rc lcov_branch_coverage=1 --directory . --exclude "/Applications/*" --exclude "/Library/*" --exclude "/usr/*" --exclude "*/test/*" --output-file coverage-unit-ble.info
122ee858f05SMatthias Ringwald
123f8e02f4bSMatthias Ringwald
124273d17adSMatthias Ringwaldcoverage-all: coverage-unit.info
125464d3e43SMatthias Ringwald	# generate html output
126273d17adSMatthias Ringwald	genhtml coverage-unit.info --branch-coverage --demangle-cpp --config-file lcovrc --output-directory coverage
127f8e02f4bSMatthias Ringwald
12880dcb211SMatthias Ringwaldcoverage-unit-ble: coverage-unit-ble.info
12980dcb211SMatthias Ringwald	# generate html output
13080dcb211SMatthias Ringwald	genhtml coverage-unit-ble.info --branch-coverage --demangle-cpp --config-file lcovrc --output-directory coverage-unit-ble
131f8e02f4bSMatthias Ringwald
132b7eced11SMatthias Ringwald
133273d17adSMatthias Ringwaldcoverage: coverage-all coverage-unit-ble
134642d8b89SMatthias Ringwald
135642d8b89SMatthias Ringwaldtest:
136642d8b89SMatthias Ringwald	echo Run all tests with ASAN
137642d8b89SMatthias Ringwald	@set -e; \
138642d8b89SMatthias Ringwald	for dir in $(SUBDIRS); do \
139642d8b89SMatthias Ringwald	  $(MAKE) -C $$dir test; \
140642d8b89SMatthias Ringwald	done
141642d8b89SMatthias Ringwald
142642d8b89SMatthias Ringwaldtest-ble:
143642d8b89SMatthias Ringwald	echo Run all BLE tests with ASAN
144642d8b89SMatthias Ringwald	@set -e; \
145642d8b89SMatthias Ringwald	for dir in $(SUBDIRS_BLE); do \
146642d8b89SMatthias Ringwald	  $(MAKE) -C $$dir test; \
147642d8b89SMatthias Ringwald	done
148