2015-05-17 18:07:24 +02:00
|
|
|
|
|
|
|
# Makefile to build and run all tests
|
|
|
|
|
|
|
|
SUBDIRS = \
|
2015-07-02 10:46:45 +02:00
|
|
|
att_db \
|
2017-02-27 20:31:30 +01:00
|
|
|
avdtp \
|
2019-09-20 13:16:20 +02:00
|
|
|
avdtp_util \
|
2019-09-14 22:36:27 +02:00
|
|
|
base64 \
|
2015-05-17 18:07:24 +02:00
|
|
|
ble_client \
|
2017-02-27 20:31:30 +01:00
|
|
|
btstack_link_key_db \
|
2019-09-14 22:36:27 +02:00
|
|
|
crypto \
|
2015-05-17 18:07:24 +02:00
|
|
|
des_iterator \
|
2019-09-18 13:13:05 +02:00
|
|
|
flash_tlv \
|
2015-05-17 18:07:24 +02:00
|
|
|
gatt_client \
|
2020-04-02 16:22:07 +02:00
|
|
|
gap \
|
2015-08-20 17:06:54 +02:00
|
|
|
hfp \
|
2019-09-14 22:36:27 +02:00
|
|
|
hid_parser \
|
2015-05-17 18:07:24 +02:00
|
|
|
linked_list \
|
2019-10-22 16:42:03 +02:00
|
|
|
map_test \
|
2019-09-18 17:29:48 +02:00
|
|
|
mesh \
|
2019-09-14 22:36:27 +02:00
|
|
|
obex \
|
|
|
|
ring_buffer \
|
2019-09-18 17:42:10 +02:00
|
|
|
sdp \
|
2015-05-17 18:07:24 +02:00
|
|
|
sdp_client \
|
2015-07-16 23:28:09 +02:00
|
|
|
security_manager \
|
2019-09-14 22:36:27 +02:00
|
|
|
tlv_posix \
|
2019-09-23 14:01:17 +02:00
|
|
|
# not testing anything in source tree
|
|
|
|
# maths \
|
2020-09-18 17:53:30 +02:00
|
|
|
# no unit tests
|
|
|
|
# embedded \
|
|
|
|
# gatt_server \
|
2019-09-14 22:36:27 +02:00
|
|
|
|
2020-08-31 13:56:51 +02:00
|
|
|
# flash_tlv also contains btstack_linked_key_db tests
|
|
|
|
|
|
|
|
SUBDIRS_BLE = \
|
|
|
|
att_db \
|
|
|
|
ble_client \
|
|
|
|
crypto \
|
|
|
|
gatt_client \
|
|
|
|
gap \
|
|
|
|
hid_parser \
|
|
|
|
linked_list \
|
|
|
|
ring_buffer \
|
|
|
|
security_manager \
|
|
|
|
# tlv_posix \
|
|
|
|
|
2019-09-14 22:36:27 +02:00
|
|
|
# test fails
|
|
|
|
|
|
|
|
# not unit-tests
|
2019-09-23 14:01:17 +02:00
|
|
|
# avrcp \
|
2019-09-14 22:36:27 +02:00
|
|
|
# map_client \
|
|
|
|
# sbc \
|
2020-09-18 17:58:27 +02:00
|
|
|
# gatt_server \
|
|
|
|
|
2019-09-23 14:01:17 +02:00
|
|
|
.PHONY: coverage
|
2015-07-03 11:01:27 +02:00
|
|
|
|
2015-05-17 18:07:24 +02:00
|
|
|
subdirs:
|
|
|
|
echo Building all tests
|
2015-10-12 10:59:06 +02:00
|
|
|
@set -e; \
|
2015-05-17 18:07:24 +02:00
|
|
|
for dir in $(SUBDIRS); do \
|
|
|
|
$(MAKE) -C $$dir; \
|
|
|
|
done
|
|
|
|
|
|
|
|
clean:
|
|
|
|
echo Clean all test
|
2015-10-12 10:59:06 +02:00
|
|
|
@set -e; \
|
2015-05-17 18:07:24 +02:00
|
|
|
for dir in $(SUBDIRS); do \
|
|
|
|
$(MAKE) -C $$dir clean; \
|
|
|
|
done
|
|
|
|
|
|
|
|
test:
|
|
|
|
echo Run all test
|
2015-10-12 10:59:06 +02:00
|
|
|
@set -e; \
|
2015-05-17 18:07:24 +02:00
|
|
|
for dir in $(SUBDIRS); do \
|
|
|
|
$(MAKE) -C $$dir test; \
|
|
|
|
done
|
|
|
|
|
2020-08-31 13:56:51 +02:00
|
|
|
test-ble:
|
|
|
|
echo Run all BLE tests
|
|
|
|
@set -e; \
|
|
|
|
for dir in $(SUBDIRS_BLE); do \
|
|
|
|
$(MAKE) -C $$dir test; \
|
|
|
|
done
|
|
|
|
|
|
|
|
test-coverage-ble: subdirs
|
2019-09-23 14:01:17 +02:00
|
|
|
# delete trace data
|
|
|
|
find . -name "*.gcda" -type f -delete
|
|
|
|
# run tests
|
2020-08-31 13:56:51 +02:00
|
|
|
$(MAKE) test-ble
|
|
|
|
# collect traces
|
|
|
|
lcov --capture --rc lcov_branch_coverage=1 --directory . --exclude "/Applications/*" --exclude "/Library/*" --exclude "/usr/*" --exclude "*/test/*" --output-file coverage-unit-ble.info
|
2020-09-21 12:04:18 +02:00
|
|
|
# demangle
|
|
|
|
python3 coverage_demangle.py coverage-unit-ble.info
|
2020-08-31 13:56:51 +02:00
|
|
|
|
|
|
|
test-coverage: subdirs
|
|
|
|
# delete trace data
|
|
|
|
find . -name "*.gcda" -type f -delete
|
|
|
|
# run tests
|
|
|
|
$(MAKE) test
|
2019-09-23 14:01:17 +02:00
|
|
|
# collect traces
|
2020-08-28 23:38:06 +02:00
|
|
|
lcov --capture --rc lcov_branch_coverage=1 --directory . --exclude "/Applications/*" --exclude "/Library/*" --exclude "/usr/*" --exclude "*/test/*" --output-file coverage-unit.info
|
2020-09-21 12:04:18 +02:00
|
|
|
# demangle
|
|
|
|
python3 coverage_demangle.py coverage-unit.info
|
2020-08-28 23:38:06 +02:00
|
|
|
|
2020-08-31 13:56:51 +02:00
|
|
|
coverage: test-coverage test-coverage-ble
|
2020-08-29 23:13:14 +02:00
|
|
|
# download pts coverage and fix paths
|
2020-09-21 12:06:46 +02:00
|
|
|
curl https://bluekitchen-gmbh.com/btstack/develop/coverage-pts.info | sed 's|buildbot-worker/auto-pts/btstack|buildbot-worker/test-develop/build|' > coverage-pts.info
|
2020-08-28 23:38:06 +02:00
|
|
|
|
2020-08-31 13:56:51 +02:00
|
|
|
# combine unit[-ble] and pts
|
|
|
|
lcov --rc lcov_branch_coverage=1 -a coverage-pts.info -a coverage-unit.info --output-file coverage.info
|
|
|
|
lcov --rc lcov_branch_coverage=1 -a coverage-pts.info -a coverage-unit-ble.info --output-file coverage-ble.info
|
2020-08-28 23:38:06 +02:00
|
|
|
|
2020-08-31 13:56:51 +02:00
|
|
|
# create bat subset from ble subset
|
|
|
|
./coverage_subset_bat.py coverage-ble.info coverage-bat.info
|
|
|
|
./coverage_subset_bat.py coverage-unit-ble.info coverage-unit-bat.info
|
2020-08-28 23:38:06 +02:00
|
|
|
|
2020-09-21 12:04:18 +02:00
|
|
|
./coverage_subset_bat.py coverage-pts.info coverage-pts-bat.info
|
|
|
|
|
2019-09-23 14:01:17 +02:00
|
|
|
# generate html output
|
2020-09-21 12:04:18 +02:00
|
|
|
genhtml coverage-unit.info --branch-coverage --demangle-cpp --output-directory coverage-unit
|
|
|
|
genhtml coverage-unit-bat.info --branch-coverage --demangle-cpp --output-directory coverage-unit-bat
|
|
|
|
genhtml coverage-bat.info --branch-coverage --demangle-cpp --output-directory coverage-bat
|
|
|
|
genhtml coverage.info --branch-coverage --demangle-cpp --output-directory coverage
|
|
|
|
genhtml coverage-pts-bat.info --branch-coverage --demangle-cpp --output-directory coverage-pts-bat
|