xref: /btstack/test/Makefile (revision 8cfd11c34873f0dac439a9799ae71c96d32dd71f)
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 \
12*8cfd11c3SMatthias Ringwald	btstack_util \
139b8d06a5SMilanka Ringwald	btstack_memory \
14415a769fSMatthias Ringwald	classic-oob-pairing \
151c22f3beSMatthias Ringwald	crypto \
1657fe2af8SMatthias Ringwald	des_iterator \
170f7fd6c1SMilanka Ringwald	embedded \
18dd2dbe6aSMatthias Ringwald	flash_tlv \
191470db0cSMatthias Ringwald	gap \
200f7fd6c1SMilanka Ringwald	gatt-service-client \
21ae970bb9SMilanka Ringwald	gatt_client \
22ae970bb9SMilanka Ringwald	gatt_server \
2376181014SMilanka Ringwald	gatt_service_server \
2494818a3bSMatthias Ringwald	hfp \
251c22f3beSMatthias Ringwald	hid_parser \
26af7c3ae6SMatthias Ringwald	l2cap-cbm \
27af7c3ae6SMatthias Ringwald	l2cap-ecbm \
2821c2455cSMilanka Ringwald	le_device_db_tlv \
29ae970bb9SMilanka Ringwald	linked_list \
30d491c1eaSMatthias Ringwald	mesh \
311c22f3beSMatthias Ringwald	obex \
321c22f3beSMatthias Ringwald	ring_buffer \
339ccd94f8SMatthias Ringwald	sdp \
3457fe2af8SMatthias Ringwald	sdp_client \
35fe03d808SMatthias Ringwald	security_manager \
361c22f3beSMatthias Ringwald	tlv_posix \
372ce916b3SMatthias Ringwald
38464d3e43SMatthias Ringwald# not testing anything in source tree
39464d3e43SMatthias Ringwald#	maths \
4073e5d7d0SMatthias Ringwald# no unit tests
4173e5d7d0SMatthias Ringwald#	embedded \
4273e5d7d0SMatthias Ringwald#	gatt_server \
43b17ed348SMatthias Ringwald# mixes classic with ble
44b17ed348SMatthias Ringwald#    flash_tlv - contains btstack_linked_key_db tests
45b17ed348SMatthias Ringwald# hangs on buildbot (no output for 20 minutes -> abort)
46b17ed348SMatthias Ringwald#	security_manager_sc
47f400efd4SMatthias Ringwald
48f400efd4SMatthias RingwaldSUBDIRS_BLE = \
49d2011e9eSMilanka Ringwald	ad_parser \
50f400efd4SMatthias Ringwald	att_db \
51f400efd4SMatthias Ringwald	ble_client \
529b8d06a5SMilanka Ringwald	btstack_memory \
53*8cfd11c3SMatthias Ringwald	btstack_util \
54f400efd4SMatthias Ringwald	crypto \
551ebfed24SMatthias Ringwald	embedded \
56f400efd4SMatthias Ringwald	gap \
570f7fd6c1SMilanka Ringwald	gatt-service-client \
58ae970bb9SMilanka Ringwald	gatt_client \
590ce29069SMatthias Ringwald	gatt_server \
6076181014SMilanka Ringwald	gatt_service_server \
61f400efd4SMatthias Ringwald	hid_parser \
62af7c3ae6SMatthias Ringwald	l2cap-cbm \
6321c2455cSMilanka Ringwald	le_device_db_tlv \
64f400efd4SMatthias Ringwald	linked_list \
65f400efd4SMatthias Ringwald	ring_buffer \
66f400efd4SMatthias Ringwald	security_manager \
671f56122cSMatthias Ringwald
681c22f3beSMatthias Ringwald# test fails
691c22f3beSMatthias Ringwald
701c22f3beSMatthias Ringwald# not unit-tests
71464d3e43SMatthias Ringwald# avrcp \
721c22f3beSMatthias Ringwald# map_client \
731c22f3beSMatthias Ringwald# sbc \
74c757f61eSMatthias Ringwald#	gatt_server \
75c757f61eSMatthias Ringwald
7677e8932bSMatthias Ringwald.PHONY: coverage coverage-sm-sc.info
77deb45786SMatthias Ringwald
7857fe2af8SMatthias Ringwaldsubdirs:
7957fe2af8SMatthias Ringwald	echo Building all tests
80bbf26c65SMatthias Ringwald	@set -e; \
8157fe2af8SMatthias Ringwald	for dir in $(SUBDIRS); do \
8257fe2af8SMatthias Ringwald	  $(MAKE) -C $$dir; \
8357fe2af8SMatthias Ringwald	done
8457fe2af8SMatthias Ringwald
8557fe2af8SMatthias Ringwaldclean:
8657fe2af8SMatthias Ringwald	echo Clean all test
87bbf26c65SMatthias Ringwald	@set -e; \
8857fe2af8SMatthias Ringwald	for dir in $(SUBDIRS); do \
8957fe2af8SMatthias Ringwald	  $(MAKE) -C $$dir clean; \
9057fe2af8SMatthias Ringwald	done
91c0fa7c1dSMatthias Ringwald	rm -f *.info
92c0fa7c1dSMatthias Ringwald	rm -rf coverage coverage-unit-ble
9357fe2af8SMatthias Ringwald
949dbbd7d0SMatthias Ringwaldsubdirs-coverage:
959dbbd7d0SMatthias Ringwald	echo Run all tests for coverage
969dbbd7d0SMatthias Ringwald	@set -e; \
979dbbd7d0SMatthias Ringwald	for dir in $(SUBDIRS); do \
989dbbd7d0SMatthias Ringwald	  $(MAKE) -C $$dir coverage; \
999dbbd7d0SMatthias Ringwald	done
1009dbbd7d0SMatthias Ringwald
1019dbbd7d0SMatthias Ringwaldsubdirs-coverage-ble:
1029dbbd7d0SMatthias Ringwald	echo Run all BLE tests for coverage
1039dbbd7d0SMatthias Ringwald	@set -e; \
1049dbbd7d0SMatthias Ringwald	for dir in $(SUBDIRS_BLE); do \
1059dbbd7d0SMatthias Ringwald	  $(MAKE) -C $$dir coverage; \
1069dbbd7d0SMatthias Ringwald	done
1079dbbd7d0SMatthias Ringwald
108f400efd4SMatthias Ringwald
109f4e14552SMatthias Ringwaldcoverage-unit.info: subdirs-coverage
110f400efd4SMatthias Ringwald	# delete trace data
111f400efd4SMatthias Ringwald	find . -name "*.gcda" -type f -delete
112f400efd4SMatthias Ringwald	# run tests
1139dbbd7d0SMatthias Ringwald	$(MAKE) subdirs-coverage
114464d3e43SMatthias Ringwald	# collect traces
11592e3c2d3SMatthias Ringwald	lcov --capture --ignore-errors inconsistent --ignore-errors unused --rc lcov_branch_coverage=1 --directory . --exclude "/Applications/*" --exclude "/Library/*" --exclude "/usr/*" --exclude "*/test/*" --output-file coverage-unit.info
116ee858f05SMatthias Ringwald
117f4e14552SMatthias Ringwaldcoverage-unit-ble.info: subdirs-coverage-ble
118f8e02f4bSMatthias Ringwald	# delete trace data
119f8e02f4bSMatthias Ringwald	find . -name "*.gcda" -type f -delete
120f8e02f4bSMatthias Ringwald	# run tests
1219dbbd7d0SMatthias Ringwald	$(MAKE) subdirs-coverage-ble
122f8e02f4bSMatthias Ringwald	# collect traces
12392e3c2d3SMatthias Ringwald	lcov --capture --ignore-errors inconsistent --ignore-errors unused --rc lcov_branch_coverage=1 --directory . --exclude "/Applications/*" --exclude "/Library/*" --exclude "/usr/*" --exclude "*/test/*" --output-file coverage-unit-ble.info
124ee858f05SMatthias Ringwald
125f8e02f4bSMatthias Ringwald
126273d17adSMatthias Ringwaldcoverage-all: coverage-unit.info
127464d3e43SMatthias Ringwald	# generate html output
128273d17adSMatthias Ringwald	genhtml coverage-unit.info --branch-coverage --demangle-cpp --config-file lcovrc --output-directory coverage
129f8e02f4bSMatthias Ringwald
13080dcb211SMatthias Ringwaldcoverage-unit-ble: coverage-unit-ble.info
13180dcb211SMatthias Ringwald	# generate html output
13280dcb211SMatthias Ringwald	genhtml coverage-unit-ble.info --branch-coverage --demangle-cpp --config-file lcovrc --output-directory coverage-unit-ble
133f8e02f4bSMatthias Ringwald
134b7eced11SMatthias Ringwald
135273d17adSMatthias Ringwaldcoverage: coverage-all coverage-unit-ble
136642d8b89SMatthias Ringwald
137642d8b89SMatthias Ringwaldtest:
138642d8b89SMatthias Ringwald	echo Run all tests with ASAN
139642d8b89SMatthias Ringwald	@set -e; \
140642d8b89SMatthias Ringwald	for dir in $(SUBDIRS); do \
141642d8b89SMatthias Ringwald	  $(MAKE) -C $$dir test; \
142642d8b89SMatthias Ringwald	done
143642d8b89SMatthias Ringwald
144642d8b89SMatthias Ringwaldtest-ble:
145642d8b89SMatthias Ringwald	echo Run all BLE tests with ASAN
146642d8b89SMatthias Ringwald	@set -e; \
147642d8b89SMatthias Ringwald	for dir in $(SUBDIRS_BLE); do \
148642d8b89SMatthias Ringwald	  $(MAKE) -C $$dir test; \
149642d8b89SMatthias Ringwald	done
150