mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-02-22 15:40:16 +00:00
test/coverage: create bat subset
This commit is contained in:
parent
d48fc4b93a
commit
ee858f057f
@ -59,7 +59,7 @@ test:
|
||||
$(MAKE) -C $$dir test; \
|
||||
done
|
||||
|
||||
coverage:
|
||||
test-coverage:
|
||||
# delete trace data
|
||||
rm -f coverage.info
|
||||
find . -name "*.gcda" -type f -delete
|
||||
@ -68,9 +68,23 @@ coverage:
|
||||
# run tests
|
||||
make test
|
||||
# collect traces
|
||||
lcov --capture --rc lcov_branch_coverage=1 --directory . --exclude "/Applications/*" --exclude "/Library/*" --exclude "/usr/*" --exclude "*/3rd-party/tinydir/*" --exclude "*/platform/posix/*" --exclude "*/test/*" --output-file coverage.info
|
||||
lcov --capture --rc lcov_branch_coverage=1 --directory . --exclude "/Applications/*" --exclude "/Library/*" --exclude "/usr/*" --exclude "*/test/*" --output-file coverage-unit.info
|
||||
|
||||
coverage: test-coverage
|
||||
|
||||
# TODO: download pts coverage
|
||||
# ...
|
||||
# combine unit and pts
|
||||
# lcov --rc lcov_branch_coverage=1 -a coverage-pts.info -a coverage-unit.info --output-file coverage.info
|
||||
cp coverage-unit.info coverage.info
|
||||
|
||||
# create bat subset
|
||||
./coverage_subset_bat.py coverage.info coverage-bat.info
|
||||
|
||||
# generate html output
|
||||
genhtml coverage.info --branch-coverage --output-directory coverage-html
|
||||
genhtml coverage-unit.info --branch-coverage --output-directory coverage-unit
|
||||
genhtml coverage-bat.info --branch-coverage --output-directory coverage-bat
|
||||
genhtml coverage.info --branch-coverage --output-directory coverage
|
||||
|
||||
coverage-freertos-ble:
|
||||
./coverage_filter.py src/mesh src/classic
|
||||
|
76
test/coverage_subset_bat.py
Executable file
76
test/coverage_subset_bat.py
Executable file
@ -0,0 +1,76 @@
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# Filter coverage reported by lcov
|
||||
#
|
||||
# Copyright 2020 BlueKitchen GmbH
|
||||
#
|
||||
|
||||
import sys
|
||||
|
||||
blacklist = [
|
||||
'/opt/local',
|
||||
'3rd-party/yxml',
|
||||
'3rd-party/tinydir',
|
||||
'platform/embedded/btstack_audio_embedded.c',
|
||||
'platform/embedded/btstack_em9304_spi_embedded.c',
|
||||
'platform/libusb',
|
||||
'platform/posix',
|
||||
'src/ble/ancs_client.c',
|
||||
'src/ble/le_device_db_memory.c',
|
||||
'src/ble/gatt-service/cycling_power_service_server.c',
|
||||
'src/ble/gatt-service/cycling_speed_and_cadence_service_server.c',
|
||||
'src/ble/gatt-service/heart_rate_service_server.c',
|
||||
'src/ble/gatt-service/hids_device.c',
|
||||
'src/ble/gatt-service/nordic_spp_service_server.c',
|
||||
'src/ble/gatt-service/ublox_spp_service_server.c',
|
||||
'src/btstack_audio.c',
|
||||
'src/btstack_base64_decoder.c',
|
||||
'src/btstack_event.h',
|
||||
'src/btstack_hid_parser.c',
|
||||
'src/btstack_resample.c',
|
||||
'src/btstack_slip.c',
|
||||
'src/hci_transport_em9304_spi.c',
|
||||
'src/hci_transport_h5.c',
|
||||
'src/mesh/',
|
||||
'src/classic',
|
||||
]
|
||||
|
||||
def include_file(filename):
|
||||
for pattern in blacklist:
|
||||
if pattern in filename:
|
||||
print("Skip " + filename)
|
||||
return False
|
||||
return True
|
||||
|
||||
if len(sys.argv) != 3:
|
||||
print ('lcov .info filter')
|
||||
print ('Usage: ', sys.argv[0], 'input.info output.info')
|
||||
exit(0)
|
||||
|
||||
infile = sys.argv[1]
|
||||
outfile = sys.argv[2]
|
||||
|
||||
with open(infile, 'rt') as fin:
|
||||
with open(outfile, 'wt') as fout:
|
||||
mirror = False
|
||||
read_tn = False
|
||||
for line in fin:
|
||||
line = line.strip()
|
||||
if line == 'TN:':
|
||||
read_tn = True
|
||||
continue
|
||||
if line == 'end_of_record':
|
||||
if mirror:
|
||||
fout.write(line+'\n')
|
||||
mirror = False
|
||||
continue
|
||||
parts = line.split(':')
|
||||
if len(parts) == 2 and parts[0] == 'SF':
|
||||
filename = parts[1]
|
||||
mirror = include_file(filename)
|
||||
if mirror and read_tn:
|
||||
fout.write("TN:\n")
|
||||
read_tn = False
|
||||
if not mirror:
|
||||
continue
|
||||
fout.write(line+"\n")
|
Loading…
x
Reference in New Issue
Block a user