test/gatt_service_server: unify test file names

This commit is contained in:
Milanka Ringwald 2022-06-07 15:54:41 +02:00
parent ad9151969e
commit 761810140b
14 changed files with 142 additions and 143 deletions

View File

@ -19,7 +19,7 @@ SUBDIRS = \
gatt-service-client \
gatt_client \
gatt_server \
gatt_service \
gatt_service_server \
hfp \
hid_parser \
l2cap-cbm \
@ -57,8 +57,7 @@ SUBDIRS_BLE = \
gatt-service-client \
gatt_client \
gatt_server \
gatt_server \
gatt_service \
gatt_service_server \
hid_parser \
l2cap-cbm \
le_device_db_tlv \

View File

@ -1,135 +0,0 @@
# Requirements: cpputest.github.io
BTSTACK_ROOT = ../..
CFLAGS = -DUNIT_TEST -x c++ -g -Wall -Wnarrowing -Wconversion-null
CFLAGS += -I../
CFLAGS += -I${BTSTACK_ROOT}/src
CFLAGS += -I${BTSTACK_ROOT}/test/mock
CFLAGS += -I${BTSTACK_ROOT}/3rd-party/rijndael
VPATH += ${BTSTACK_ROOT}/src
VPATH += ${BTSTACK_ROOT}/src/ble
VPATH += ${BTSTACK_ROOT}/src/ble/gatt-service
VPATH += ${BTSTACK_ROOT}/platform/posix
VPATH += ${BTSTACK_ROOT}/3rd-party/rijndael
VPATH += ${BTSTACK_ROOT}/test/mock
COMMON = \
ad_parser.c \
att_db.c \
battery_service_server.c \
btstack_linked_list.c \
btstack_memory.c \
btstack_memory_pool.c \
btstack_util.c \
cycling_power_service_server.c \
cycling_speed_and_cadence_service_server.c \
audio_input_control_service_server.c \
device_information_service_server.c \
hci_dump.c \
heart_rate_service_server.c \
hids_device.c \
microphone_control_service_server.c \
mock_att_server.c \
nordic_spp_service_server.c \
tx_power_service_server.c \
ublox_spp_service_server.c \
CFLAGS_COVERAGE = ${CFLAGS} -Ibuild-coverage -fprofile-arcs -ftest-coverage
CFLAGS_ASAN = ${CFLAGS} -Ibuild-asan -fsanitize=address -DHAVE_ASSERT
LDFLAGS += -lCppUTest -lCppUTestExt
LDFLAGS_COVERAGE = ${LDFLAGS} -fprofile-arcs -ftest-coverage
LDFLAGS_ASAN = ${LDFLAGS} -fsanitize=address
COMMON_OBJ_COVERAGE = $(addprefix build-coverage/,$(COMMON:.c=.o))
COMMON_OBJ_ASAN = $(addprefix build-asan/, $(COMMON:.c=.o))
all: build-coverage/battery_service_test build-asan/battery_service_test \
build-coverage/device_information_service_test build-asan/device_information_service_test \
build-coverage/tx_power_service_test build-asan/tx_power_service_test \
build-coverage/bond_management_service_test build-asan/bond_management_service_test \
build-coverage/microphone_control_service_test build-asan/microphone_control_service_test \
build-%:
mkdir -p $@
build-%/battery_service_profile.h: battery_service_profile.gatt | build-%
python3 ${BTSTACK_ROOT}/tool/compile_gatt.py $< $@
build-%/device_information_service_profile.h: device_information_service.gatt| build-%
python3 ${BTSTACK_ROOT}/tool/compile_gatt.py $< $@
build-%/tx_power_service_profile.h: tx_power_service.gatt| build-%
python3 ${BTSTACK_ROOT}/tool/compile_gatt.py $< $@
build-%/bond_management_service_profile.h: bond_management_service.gatt| build-%
python3 ${BTSTACK_ROOT}/tool/compile_gatt.py $< $@
build-%/microphone_control_service_profile.h: microphone_control_service.gatt| build-%
python3 ${BTSTACK_ROOT}/tool/compile_gatt.py $< $@
build-coverage/%.o: %.c | build-coverage
${CC} -c $(CFLAGS_COVERAGE) $< -o $@
build-coverage/%.o: %.cpp | build-coverage
${CXX} -c $(CFLAGS_COVERAGE) $< -o $@
build-asan/%.o: %.c | build-asan
${CC} -c $(CFLAGS_ASAN) $< -o $@
build-asan/%.o: %.cpp | build-asan
${CXX} -c $(CFLAGS_ASAN) $< -o $@
build-coverage/battery_service_test: build-coverage/battery_service_profile.h ${COMMON_OBJ_COVERAGE} build-coverage/battery_service_test.o | build-coverage
${CXX} $(filter-out build-coverage/battery_service_profile.h,$^) ${LDFLAGS_COVERAGE} -o $@
build-asan/battery_service_test: build-asan/battery_service_profile.h ${COMMON_OBJ_ASAN} build-asan/battery_service_test.o | build-asan
${CXX} $(filter-out build-asan/battery_service_profile.h,$^) ${LDFLAGS_ASAN} -o $@
build-coverage/device_information_service_test: build-coverage/device_information_service_profile.h ${COMMON_OBJ_COVERAGE} build-coverage/device_information_service_test.o | build-coverage
${CXX} $(filter-out build-coverage/device_information_service_profile.h,$^) ${LDFLAGS_COVERAGE} -o $@
build-asan/device_information_service_test: build-asan/device_information_service_profile.h ${COMMON_OBJ_ASAN} build-asan/device_information_service_test.o | build-asan
${CXX} $(filter-out build-asan/device_information_service_profile.h,$^) ${LDFLAGS_ASAN} -o $@
build-coverage/tx_power_service_test: build-coverage/tx_power_service_profile.h ${COMMON_OBJ_COVERAGE} build-coverage/tx_power_service_test.o | build-coverage
${CXX} $(filter-out build-coverage/tx_power_service_profile.h,$^) ${LDFLAGS_COVERAGE} -o $@
build-asan/tx_power_service_test: build-asan/tx_power_service_profile.h ${COMMON_OBJ_ASAN} build-asan/tx_power_service_test.o | build-asan
${CXX} $(filter-out build-asan/tx_power_service_profile.h,$^) ${LDFLAGS_ASAN} -o $@
build-coverage/bond_management_service_test: build-coverage/bond_management_service_profile.h ${COMMON_OBJ_COVERAGE} build-coverage/bond_management_service_server.o build-coverage/bond_management_service_test.o | build-coverage
${CXX} $(filter-out build-coverage/bond_management_service_profile.h,$^) ${LDFLAGS_COVERAGE} -o $@
build-asan/bond_management_service_test: build-asan/bond_management_service_profile.h ${COMMON_OBJ_ASAN} build-asan/bond_management_service_server.o build-asan/bond_management_service_test.o | build-asan
${CXX} $(filter-out build-asan/bond_management_service_profile.h,$^) ${LDFLAGS_ASAN} -o $@
build-coverage/microphone_control_service_test: build-coverage/microphone_control_service_profile.h ${COMMON_OBJ_COVERAGE} build-coverage/microphone_control_service_server.o build-coverage/microphone_control_service_test.o | build-coverage
${CXX} $(filter-out build-coverage/microphone_control_service_profile.h,$^) ${LDFLAGS_COVERAGE} -o $@
build-asan/microphone_control_service_test: build-asan/microphone_control_service_profile.h ${COMMON_OBJ_ASAN} build-asan/microphone_control_service_server.o build-asan/microphone_control_service_test.o | build-asan
${CXX} $(filter-out build-asan/microphone_control_service_profile.h,$^) ${LDFLAGS_ASAN} -o $@
test: all
build-asan/battery_service_test
build-asan/device_information_service_test
build-asan/tx_power_service_test
build-asan/bond_management_service_test
build-asan/microphone_control_service_test
coverage: all
rm -f build-coverage/*.gcda
build-coverage/battery_service_test
build-coverage/device_information_service_test
build-asan/tx_power_service_test
build-asan/bond_management_service_test
build-asan/microphone_control_service_test
clean:
rm -rf build-coverage build-asan

View File

@ -0,0 +1,135 @@
# Requirements: cpputest.github.io
BTSTACK_ROOT = ../..
CFLAGS = -DUNIT_TEST -x c++ -g -Wall -Wnarrowing -Wconversion-null
CFLAGS += -I../
CFLAGS += -I${BTSTACK_ROOT}/src
CFLAGS += -I${BTSTACK_ROOT}/test/mock
CFLAGS += -I${BTSTACK_ROOT}/3rd-party/rijndael
VPATH += ${BTSTACK_ROOT}/src
VPATH += ${BTSTACK_ROOT}/src/ble
VPATH += ${BTSTACK_ROOT}/src/ble/gatt-service
VPATH += ${BTSTACK_ROOT}/platform/posix
VPATH += ${BTSTACK_ROOT}/3rd-party/rijndael
VPATH += ${BTSTACK_ROOT}/test/mock
COMMON = \
ad_parser.c \
att_db.c \
audio_input_control_service_server.c \
battery_service_server.c \
btstack_linked_list.c \
btstack_memory.c \
btstack_memory_pool.c \
btstack_util.c \
cycling_power_service_server.c \
cycling_speed_and_cadence_service_server.c \
device_information_service_server.c \
hci_dump.c \
heart_rate_service_server.c \
hids_device.c \
microphone_control_service_server.c \
mock_att_server.c \
nordic_spp_service_server.c \
tx_power_service_server.c \
ublox_spp_service_server.c \
CFLAGS_COVERAGE = ${CFLAGS} -Ibuild-coverage -fprofile-arcs -ftest-coverage
CFLAGS_ASAN = ${CFLAGS} -Ibuild-asan -fsanitize=address -DHAVE_ASSERT
LDFLAGS += -lCppUTest -lCppUTestExt
LDFLAGS_COVERAGE = ${LDFLAGS} -fprofile-arcs -ftest-coverage
LDFLAGS_ASAN = ${LDFLAGS} -fsanitize=address
COMMON_OBJ_COVERAGE = $(addprefix build-coverage/,$(COMMON:.c=.o))
COMMON_OBJ_ASAN = $(addprefix build-asan/, $(COMMON:.c=.o))
all: build-coverage/battery_service_server_test build-asan/battery_service_server_test \
build-coverage/device_information_service_server_test build-asan/device_information_service_server_test \
build-coverage/tx_power_service_server_test build-asan/tx_power_service_server_test \
build-coverage/bond_management_service_server_test build-asan/bond_management_service_server_test \
build-coverage/microphone_control_service_server_test build-asan/microphone_control_service_server_test \
build-%:
mkdir -p $@
build-%/battery_service_server_test.h: battery_service_server_test.gatt | build-%
python3 ${BTSTACK_ROOT}/tool/compile_gatt.py $< $@
build-%/device_information_service_server_test.h: device_information_service_server_test.gatt| build-%
python3 ${BTSTACK_ROOT}/tool/compile_gatt.py $< $@
build-%/tx_power_service_server_test.h: tx_power_service_server_test.gatt| build-%
python3 ${BTSTACK_ROOT}/tool/compile_gatt.py $< $@
build-%/bond_management_service_server_test.h: bond_management_service_server_test.gatt| build-%
python3 ${BTSTACK_ROOT}/tool/compile_gatt.py $< $@
build-%/microphone_control_service_server_test.h: microphone_control_service_server_test.gatt| build-%
python3 ${BTSTACK_ROOT}/tool/compile_gatt.py $< $@
build-coverage/%.o: %.c | build-coverage
${CC} -c $(CFLAGS_COVERAGE) $< -o $@
build-coverage/%.o: %.cpp | build-coverage
${CXX} -c $(CFLAGS_COVERAGE) $< -o $@
build-asan/%.o: %.c | build-asan
${CC} -c $(CFLAGS_ASAN) $< -o $@
build-asan/%.o: %.cpp | build-asan
${CXX} -c $(CFLAGS_ASAN) $< -o $@
build-coverage/battery_service_server_test: build-coverage/battery_service_server_test.h ${COMMON_OBJ_COVERAGE} build-coverage/battery_service_server_test.o | build-coverage
${CXX} $(filter-out build-coverage/battery_service_server_test.h,$^) ${LDFLAGS_COVERAGE} -o $@
build-asan/battery_service_server_test: build-asan/battery_service_server_test.h ${COMMON_OBJ_ASAN} build-asan/battery_service_server_test.o | build-asan
${CXX} $(filter-out build-asan/battery_service_server_test.h,$^) ${LDFLAGS_ASAN} -o $@
build-coverage/device_information_service_server_test: build-coverage/device_information_service_server_test.h ${COMMON_OBJ_COVERAGE} build-coverage/device_information_service_server_test.o | build-coverage
${CXX} $(filter-out build-coverage/device_information_service_server_test.h,$^) ${LDFLAGS_COVERAGE} -o $@
build-asan/device_information_service_server_test: build-asan/device_information_service_server_test.h ${COMMON_OBJ_ASAN} build-asan/device_information_service_server_test.o | build-asan
${CXX} $(filter-out build-asan/device_information_service_server_test.h,$^) ${LDFLAGS_ASAN} -o $@
build-coverage/tx_power_service_server_test: build-coverage/tx_power_service_server_test.h ${COMMON_OBJ_COVERAGE} build-coverage/tx_power_service_server_test.o | build-coverage
${CXX} $(filter-out build-coverage/tx_power_service_server_test.h,$^) ${LDFLAGS_COVERAGE} -o $@
build-asan/tx_power_service_server_test: build-asan/tx_power_service_server_test.h ${COMMON_OBJ_ASAN} build-asan/tx_power_service_server_test.o | build-asan
${CXX} $(filter-out build-asan/tx_power_service_server_test.h,$^) ${LDFLAGS_ASAN} -o $@
build-coverage/bond_management_service_server_test: build-coverage/bond_management_service_server_test.h ${COMMON_OBJ_COVERAGE} build-coverage/bond_management_service_server.o build-coverage/bond_management_service_server_test.o | build-coverage
${CXX} $(filter-out build-coverage/bond_management_service_server_test.h,$^) ${LDFLAGS_COVERAGE} -o $@
build-asan/bond_management_service_server_test: build-asan/bond_management_service_server_test.h ${COMMON_OBJ_ASAN} build-asan/bond_management_service_server.o build-asan/bond_management_service_server_test.o | build-asan
${CXX} $(filter-out build-asan/bond_management_service_server_test.h,$^) ${LDFLAGS_ASAN} -o $@
build-coverage/microphone_control_service_server_test: build-coverage/microphone_control_service_server_test.h ${COMMON_OBJ_COVERAGE} build-coverage/microphone_control_service_server.o build-coverage/microphone_control_service_server_test.o | build-coverage
${CXX} $(filter-out build-coverage/microphone_control_service_server_test.h,$^) ${LDFLAGS_COVERAGE} -o $@
build-asan/microphone_control_service_server_test: build-asan/microphone_control_service_server_test.h ${COMMON_OBJ_ASAN} build-asan/microphone_control_service_server.o build-asan/microphone_control_service_server_test.o | build-asan
${CXX} $(filter-out build-asan/microphone_control_service_server_test.h,$^) ${LDFLAGS_ASAN} -o $@
test: all
build-asan/battery_service_server_test
build-asan/device_information_service_server_test
build-asan/tx_power_service_server_test
build-asan/bond_management_service_server_test
build-asan/microphone_control_service_server_test
coverage: all
rm -f build-coverage/*.gcda
build-coverage/battery_service_server_test
build-coverage/device_information_service_server_test
build-coverage/tx_power_service_server_test
build-coverage/bond_management_service_server_test
build-coverage/microphone_control_service_server_test
clean:
rm -rf build-coverage build-asan

View File

@ -21,7 +21,7 @@
#include "bluetooth_gatt.h"
#include "ble/gatt-service/battery_service_server.h"
#include "battery_service_profile.h"
#include "battery_service_server_test.h"
#include "mock_att_server.h"
static uint8_t battery_level = 100;

View File

@ -22,7 +22,7 @@
#include "bluetooth_gatt.h"
#include "ble/le_device_db.h"
#include "ble/gatt-service/bond_management_service_server.h"
#include "bond_management_service_profile.h"
#include "bond_management_service_server_test.h"
#include "mock_att_server.h"
static uint32_t bond_management_features = 0xFFFFFF;

View File

@ -21,7 +21,7 @@
#include "bluetooth_gatt.h"
#include "ble/gatt-service/device_information_service_server.h"
#include "device_information_service_profile.h"
#include "device_information_service_server_test.h"
#include "mock_att_server.h"
typedef struct {

View File

@ -21,7 +21,7 @@
#include "bluetooth_gatt.h"
#include "ble/gatt-service/microphone_control_service_server.h"
#include "microphone_control_service_profile.h"
#include "microphone_control_service_server_test.h"
#include "mock_att_server.h"
static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size);

View File

@ -21,7 +21,7 @@
#include "bluetooth_gatt.h"
#include "ble/gatt-service/tx_power_service_server.h"
#include "tx_power_service_profile.h"
#include "tx_power_service_server_test.h"
#include "mock_att_server.h"
static int8_t tx_power_level = 100;