mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-03-24 22:43:35 +00:00
test/coverage: avoid compiling classic parts for LE-only coverage
This commit is contained in:
parent
72a82af448
commit
f400efd4c3
test
@ -26,10 +26,24 @@ SUBDIRS = \
|
||||
sdp_client \
|
||||
security_manager \
|
||||
tlv_posix \
|
||||
|
||||
# not testing anything in source tree
|
||||
# maths \
|
||||
|
||||
# flash_tlv also contains btstack_linked_key_db tests
|
||||
|
||||
SUBDIRS_BLE = \
|
||||
att_db \
|
||||
ble_client \
|
||||
crypto \
|
||||
gatt_client \
|
||||
gatt_server \
|
||||
gap \
|
||||
hid_parser \
|
||||
linked_list \
|
||||
ring_buffer \
|
||||
security_manager \
|
||||
# tlv_posix \
|
||||
|
||||
# test fails
|
||||
|
||||
# not unit-tests
|
||||
@ -59,31 +73,43 @@ test:
|
||||
$(MAKE) -C $$dir test; \
|
||||
done
|
||||
|
||||
test-coverage:
|
||||
test-ble:
|
||||
echo Run all BLE tests
|
||||
@set -e; \
|
||||
for dir in $(SUBDIRS_BLE); do \
|
||||
$(MAKE) -C $$dir test; \
|
||||
done
|
||||
|
||||
test-coverage-ble: subdirs
|
||||
# delete trace data
|
||||
rm -f coverage.info
|
||||
find . -name "*.gcda" -type f -delete
|
||||
# collect all files
|
||||
# lcov --capture --initial --directory . --output-file coverage.info
|
||||
# run tests
|
||||
make test
|
||||
$(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
|
||||
|
||||
test-coverage: subdirs
|
||||
# delete trace data
|
||||
find . -name "*.gcda" -type f -delete
|
||||
# run tests
|
||||
$(MAKE) test
|
||||
# collect traces
|
||||
lcov --capture --rc lcov_branch_coverage=1 --directory . --exclude "/Applications/*" --exclude "/Library/*" --exclude "/usr/*" --exclude "*/test/*" --output-file coverage-unit.info
|
||||
|
||||
coverage: test-coverage
|
||||
coverage: test-coverage test-coverage-ble
|
||||
# download pts coverage and fix paths
|
||||
curl https://bluekitchen-gmbh.com/btstack/develop/coverage-pts.info | sed -e 's|/Users/mringwal/buildbot-worker/auto-pts/btstack|/root/buildbot-worker/test-develop/build|' > coverage-pts.info
|
||||
curl https://bluekitchen-gmbh.com/btstack/develop/coverage-pts.info | sed -e 's|/Users/mringwal/buildbot-worker/auto-pts/btstack|/root/buildbot-worker/test-develop/build|' > coverage-pts.info
|
||||
|
||||
# combine unit and pts
|
||||
lcov --rc lcov_branch_coverage=1 -a coverage-pts.info -a coverage-unit.info --output-file coverage.info
|
||||
# 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
|
||||
|
||||
# create bat subset
|
||||
./coverage_subset_bat.py coverage.info coverage-bat.info
|
||||
# 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
|
||||
|
||||
# generate html output
|
||||
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
|
||||
genhtml coverage-unit.info --branch-coverage --output-directory coverage-unit
|
||||
genhtml coverage-unit-bat.info --branch-coverage --output-directory coverage-unit-bat
|
||||
genhtml coverage-bat.info --branch-coverage --output-directory coverage-bat
|
||||
genhtml coverage.info --branch-coverage --output-directory coverage
|
||||
|
@ -14,18 +14,11 @@
|
||||
|
||||
// BTstack features that can be enabled
|
||||
#define ENABLE_BLE
|
||||
#define ENABLE_CLASSIC
|
||||
// #define ENABLE_LOG_DEBUG
|
||||
#define ENABLE_LOG_ERROR
|
||||
#define ENABLE_LOG_INFO
|
||||
#define ENABLE_SDP_DES_DUMP
|
||||
#define ENABLE_SDP_EXTRA_QUERIES
|
||||
// #define ENABLE_LE_SECURE_CONNECTIONS
|
||||
#define ENABLE_LE_SIGNED_WRITE
|
||||
#define ENABLE_LE_PERIPHERAL
|
||||
#define ENABLE_LE_CENTRAL
|
||||
#define ENABLE_SDP_EXTRA_QUERIES
|
||||
#define ENABLE_L2CAP_ENHANCED_RETRANSMISSION_MODE
|
||||
#define ENABLE_SOFTWARE_AES128
|
||||
|
||||
// BTstack configuration. buffers, sizes, ...
|
||||
|
@ -4,7 +4,7 @@ CC = g++
|
||||
|
||||
BTSTACK_ROOT = ../..
|
||||
|
||||
CFLAGS = -g -Wall -I.. -I${BTSTACK_ROOT}/src -I${BTSTACK_ROOT}/include
|
||||
CFLAGS = -g -Wall -I. -I${BTSTACK_ROOT}/src -I${BTSTACK_ROOT}/include
|
||||
CFLAGS += -fprofile-arcs -ftest-coverage
|
||||
LDFLAGS += -L$(CPPUTEST_HOME)/lib -lCppUTest -lCppUTestExt
|
||||
|
||||
|
30
test/ble_client/btstack_config.h
Normal file
30
test/ble_client/btstack_config.h
Normal file
@ -0,0 +1,30 @@
|
||||
//
|
||||
// btstack_config.h for most tests
|
||||
//
|
||||
|
||||
#ifndef __BTSTACK_CONFIG
|
||||
#define __BTSTACK_CONFIG
|
||||
|
||||
// Port related features
|
||||
#define HAVE_MALLOC
|
||||
#define HAVE_ASSERT
|
||||
#define HAVE_POSIX_TIME
|
||||
#define HAVE_POSIX_FILE_IO
|
||||
#define HAVE_BTSTACK_STDIN
|
||||
|
||||
// BTstack features that can be enabled
|
||||
#define ENABLE_BLE
|
||||
#define ENABLE_LOG_ERROR
|
||||
#define ENABLE_LOG_INFO
|
||||
#define ENABLE_LE_SIGNED_WRITE
|
||||
#define ENABLE_LE_PERIPHERAL
|
||||
#define ENABLE_LE_CENTRAL
|
||||
#define ENABLE_SOFTWARE_AES128
|
||||
|
||||
// BTstack configuration. buffers, sizes, ...
|
||||
#define HCI_ACL_PAYLOAD_SIZE 1024
|
||||
#define HCI_INCOMING_PRE_BUFFER_SIZE 6
|
||||
#define NVM_NUM_LINK_KEYS 2
|
||||
#define NVM_NUM_DEVICE_DB_ENTRIES 4
|
||||
|
||||
#endif
|
@ -15,6 +15,7 @@ blacklist = [
|
||||
'platform/embedded/btstack_em9304_spi_embedded.c',
|
||||
'platform/libusb',
|
||||
'platform/posix',
|
||||
'port/libusb',
|
||||
'src/ble/ancs_client.c',
|
||||
'src/ble/le_device_db_memory.c',
|
||||
'src/ble/gatt-service/cycling_power_service_server.c',
|
||||
|
@ -6,7 +6,7 @@ BTSTACK_ROOT = ../..
|
||||
|
||||
CFLAGS = -DUNIT_TEST -g
|
||||
CPPFLAGS = -x c++ -Wall -Wno-unused -fno-exceptions
|
||||
CFLAGS += -I. -I.. -I${BTSTACK_ROOT}/src -I${BTSTACK_ROOT}/platform/posix
|
||||
CFLAGS += -I. -I${BTSTACK_ROOT}/src -I${BTSTACK_ROOT}/platform/posix
|
||||
CFLAGS += -I${BTSTACK_ROOT}/3rd-party/mbedtls/include
|
||||
CFLAGS += -I${BTSTACK_ROOT}/3rd-party/micro-ecc
|
||||
CFLAGS += -I${BTSTACK_ROOT}/3rd-party/rijndael
|
||||
|
30
test/crypto/btstack_config.h
Normal file
30
test/crypto/btstack_config.h
Normal file
@ -0,0 +1,30 @@
|
||||
//
|
||||
// btstack_config.h for most tests
|
||||
//
|
||||
|
||||
#ifndef __BTSTACK_CONFIG
|
||||
#define __BTSTACK_CONFIG
|
||||
|
||||
// Port related features
|
||||
#define HAVE_MALLOC
|
||||
#define HAVE_ASSERT
|
||||
#define HAVE_POSIX_TIME
|
||||
#define HAVE_POSIX_FILE_IO
|
||||
#define HAVE_BTSTACK_STDIN
|
||||
|
||||
// BTstack features that can be enabled
|
||||
#define ENABLE_BLE
|
||||
#define ENABLE_LOG_ERROR
|
||||
#define ENABLE_LOG_INFO
|
||||
#define ENABLE_LE_SIGNED_WRITE
|
||||
#define ENABLE_LE_PERIPHERAL
|
||||
#define ENABLE_LE_CENTRAL
|
||||
#define ENABLE_SOFTWARE_AES128
|
||||
|
||||
// BTstack configuration. buffers, sizes, ...
|
||||
#define HCI_ACL_PAYLOAD_SIZE 1024
|
||||
#define HCI_INCOMING_PRE_BUFFER_SIZE 6
|
||||
#define NVM_NUM_LINK_KEYS 2
|
||||
#define NVM_NUM_DEVICE_DB_ENTRIES 4
|
||||
|
||||
#endif
|
@ -4,7 +4,7 @@ CC = g++
|
||||
|
||||
BTSTACK_ROOT = ../..
|
||||
|
||||
CFLAGS = -DUNIT_TEST -x c++ -g -Wall -Wnarrowing -Wconversion-null -I. -I../ -I${BTSTACK_ROOT}/src
|
||||
CFLAGS = -DUNIT_TEST -x c++ -g -Wall -Wnarrowing -Wconversion-null -I. -I${BTSTACK_ROOT}/src
|
||||
CFLAGS += -fsanitize=address
|
||||
CFLAGS += -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
|
||||
CFLAGS += -fprofile-arcs -ftest-coverage
|
||||
|
30
test/gap/btstack_config.h
Normal file
30
test/gap/btstack_config.h
Normal file
@ -0,0 +1,30 @@
|
||||
//
|
||||
// btstack_config.h for most tests
|
||||
//
|
||||
|
||||
#ifndef __BTSTACK_CONFIG
|
||||
#define __BTSTACK_CONFIG
|
||||
|
||||
// Port related features
|
||||
#define HAVE_MALLOC
|
||||
#define HAVE_ASSERT
|
||||
#define HAVE_POSIX_TIME
|
||||
#define HAVE_POSIX_FILE_IO
|
||||
#define HAVE_BTSTACK_STDIN
|
||||
|
||||
// BTstack features that can be enabled
|
||||
#define ENABLE_BLE
|
||||
#define ENABLE_LOG_ERROR
|
||||
#define ENABLE_LOG_INFO
|
||||
#define ENABLE_LE_SIGNED_WRITE
|
||||
#define ENABLE_LE_PERIPHERAL
|
||||
#define ENABLE_LE_CENTRAL
|
||||
#define ENABLE_SOFTWARE_AES128
|
||||
|
||||
// BTstack configuration. buffers, sizes, ...
|
||||
#define HCI_ACL_PAYLOAD_SIZE 1024
|
||||
#define HCI_INCOMING_PRE_BUFFER_SIZE 6
|
||||
#define NVM_NUM_LINK_KEYS 2
|
||||
#define NVM_NUM_DEVICE_DB_ENTRIES 4
|
||||
|
||||
#endif
|
@ -7,7 +7,7 @@ BTSTACK_ROOT = ../..
|
||||
CPPFLAGS = -x c++ -Wall -Wno-unused
|
||||
|
||||
CFLAGS = -DUNIT_TEST -g
|
||||
CFLAGS += -I. -I.. -I${BTSTACK_ROOT}/src
|
||||
CFLAGS += -I. -I${BTSTACK_ROOT}/src
|
||||
CFLAGS += -fprofile-arcs -ftest-coverage -fsanitize=address,undefined
|
||||
LDFLAGS += -lCppUTest -lCppUTestExt
|
||||
VPATH += ${BTSTACK_ROOT}/src
|
||||
|
30
test/hid_parser/btstack_config.h
Normal file
30
test/hid_parser/btstack_config.h
Normal file
@ -0,0 +1,30 @@
|
||||
//
|
||||
// btstack_config.h for most tests
|
||||
//
|
||||
|
||||
#ifndef __BTSTACK_CONFIG
|
||||
#define __BTSTACK_CONFIG
|
||||
|
||||
// Port related features
|
||||
#define HAVE_MALLOC
|
||||
#define HAVE_ASSERT
|
||||
#define HAVE_POSIX_TIME
|
||||
#define HAVE_POSIX_FILE_IO
|
||||
#define HAVE_BTSTACK_STDIN
|
||||
|
||||
// BTstack features that can be enabled
|
||||
#define ENABLE_BLE
|
||||
#define ENABLE_LOG_ERROR
|
||||
#define ENABLE_LOG_INFO
|
||||
#define ENABLE_LE_SIGNED_WRITE
|
||||
#define ENABLE_LE_PERIPHERAL
|
||||
#define ENABLE_LE_CENTRAL
|
||||
#define ENABLE_SOFTWARE_AES128
|
||||
|
||||
// BTstack configuration. buffers, sizes, ...
|
||||
#define HCI_ACL_PAYLOAD_SIZE 1024
|
||||
#define HCI_INCOMING_PRE_BUFFER_SIZE 6
|
||||
#define NVM_NUM_LINK_KEYS 2
|
||||
#define NVM_NUM_DEVICE_DB_ENTRIES 4
|
||||
|
||||
#endif
|
Loading…
x
Reference in New Issue
Block a user