btstack/test/Makefile

125 lines
3.1 KiB
Makefile
Raw Normal View History

# Makefile to build and run all tests
SUBDIRS = \
2015-07-02 10:46:45 +02:00
att_db \
avdtp \
2019-09-20 13:16:20 +02:00
avdtp_util \
2019-09-14 22:36:27 +02:00
base64 \
ble_client \
btstack_link_key_db \
2019-09-14 22:36:27 +02:00
crypto \
des_iterator \
flash_tlv \
gatt_client \
gap \
2015-08-20 17:06:54 +02:00
hfp \
2019-09-14 22:36:27 +02:00
hid_parser \
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 \
sdp \
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
# 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
subdirs:
echo Building all tests
@set -e; \
for dir in $(SUBDIRS); do \
$(MAKE) -C $$dir; \
done
clean:
echo Clean all test
@set -e; \
for dir in $(SUBDIRS); do \
$(MAKE) -C $$dir clean; \
done
test:
echo Run all test
@set -e; \
for dir in $(SUBDIRS); do \
$(MAKE) -C $$dir test; \
done
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
$(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
# demangle
python3 coverage_demangle.py coverage-unit-ble.info
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
# demangle
python3 coverage_demangle.py coverage-unit.info
2020-08-28 23:38:06 +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
# 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
# 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
./coverage_subset_bat.py coverage-pts.info coverage-pts-bat.info
2019-09-23 14:01:17 +02:00
# generate html output
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