mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-02-09 12:39:56 +00:00
get all tests to comile and use VPATH, common Makefile for all
This commit is contained in:
parent
cf642f951b
commit
57fe2af8bc
33
test/Makefile
Normal file
33
test/Makefile
Normal file
@ -0,0 +1,33 @@
|
||||
|
||||
# Makefile to build and run all tests
|
||||
|
||||
SUBDIRS = \
|
||||
ble_client \
|
||||
des_iterator \
|
||||
gatt_client \
|
||||
linked_list \
|
||||
remote_device_db \
|
||||
sdp_client \
|
||||
security_manager \
|
||||
|
||||
EXCLUDED = ios
|
||||
|
||||
subdirs:
|
||||
echo Building all tests
|
||||
for dir in $(SUBDIRS); do \
|
||||
$(MAKE) -C $$dir; \
|
||||
done
|
||||
|
||||
clean:
|
||||
echo Clean all test
|
||||
for dir in $(SUBDIRS); do \
|
||||
$(MAKE) -C $$dir clean; \
|
||||
done
|
||||
|
||||
test:
|
||||
echo Run all test
|
||||
for dir in $(SUBDIRS); do \
|
||||
$(MAKE) -C $$dir test; \
|
||||
done
|
||||
|
||||
|
@ -33,6 +33,9 @@ all: ad_parser
|
||||
ad_parser: ${CORE_OBJ} ${COMMON_OBJ} advertising_data_parser.c
|
||||
${CC} ${CORE_OBJ} ${COMMON_OBJ} advertising_data_parser.c ${CFLAGS} ${LDFLAGS} -o $@
|
||||
|
||||
test:
|
||||
./ad_parser
|
||||
|
||||
clean:
|
||||
rm -f ad_parser le_central
|
||||
rm -f *.o
|
||||
|
@ -6,11 +6,16 @@ BTSTACK_ROOT = ../..
|
||||
CPPUTEST_HOME = ${BTSTACK_ROOT}/test/cpputest
|
||||
|
||||
CFLAGS = -g -Wall -I. -I${BTSTACK_ROOT}/src -I${BTSTACK_ROOT}/include -I$(CPPUTEST_HOME)/include
|
||||
LDFLAGS += -L$(CPPUTEST_HOME) -lCppUTest -lCppUTestExt
|
||||
LDFLAGS += -lCppUTest -lCppUTestExt
|
||||
# -L$(CPPUTEST_HOME)
|
||||
|
||||
VPATH += ${BTSTACK_ROOT}/ble
|
||||
VPATH += ${BTSTACK_ROOT}/src
|
||||
VPATH += ${BTSTACK_ROOT}/platforms/posix/src
|
||||
|
||||
COMMON = \
|
||||
${BTSTACK_ROOT}/src/sdp_util.c \
|
||||
${BTSTACK_ROOT}/src/utils.c
|
||||
sdp_util.c \
|
||||
utils.c
|
||||
|
||||
COMMON_OBJ = $(COMMON:.c=.o)
|
||||
|
||||
@ -19,8 +24,10 @@ all: des_iterator_test
|
||||
des_iterator_test: ${COMMON_OBJ} des_iterator_test.c
|
||||
${CC} $^ ${CFLAGS} ${LDFLAGS} -o $@
|
||||
|
||||
test:
|
||||
./des_iterator_test
|
||||
|
||||
clean:
|
||||
rm -f des_iterator_test *.o ${BTSTACK_ROOT}/src/*.o
|
||||
rm -f des_iterator_test *.o
|
||||
rm -rf *.dSYM
|
||||
|
@ -6,7 +6,8 @@ BTSTACK_ROOT = ../..
|
||||
CPPUTEST_HOME = ${BTSTACK_ROOT}/test/cpputest
|
||||
|
||||
CFLAGS = -DUNIT_TEST -x c++ -g -Wall -I. -I../ -I${BTSTACK_ROOT}/src -I${BTSTACK_ROOT}/ble -I${BTSTACK_ROOT}/include -I$(CPPUTEST_HOME)/include
|
||||
LDFLAGS += -L$(CPPUTEST_HOME) -lCppUTest -lCppUTestExt
|
||||
LDFLAGS += -lCppUTest -lCppUTestExt
|
||||
# -L$(CPPUTEST_HOME)
|
||||
|
||||
VPATH += ${BTSTACK_ROOT}/ble
|
||||
VPATH += ${BTSTACK_ROOT}/src
|
||||
@ -26,26 +27,30 @@ COMMON = \
|
||||
att.c \
|
||||
ad_parser.c \
|
||||
gatt_client.c \
|
||||
gatt_client_test.c \
|
||||
le_device_db_memory.c \
|
||||
mock.c
|
||||
|
||||
|
||||
COMMON_OBJ = $(COMMON:.c=.o)
|
||||
|
||||
all: gatt_client le_central
|
||||
all: gatt_client_test le_central
|
||||
|
||||
# compile .ble description
|
||||
profile.h: profile.gatt
|
||||
python ${BTSTACK_ROOT}/ble/compile-gatt.py $< $@
|
||||
|
||||
gatt_client: ${CORE_OBJ} ${COMMON_OBJ} gatt_client.o profile.h expected_results.h
|
||||
${CC} ${CORE_OBJ} ${COMMON_OBJ} gatt_client.o ${CFLAGS} ${LDFLAGS} -o $@
|
||||
gatt_client_test: profile.h ${CORE_OBJ} ${COMMON_OBJ} gatt_client_test.o expected_results.h
|
||||
${CC} ${CORE_OBJ} ${COMMON_OBJ} gatt_client_test.o ${CFLAGS} ${LDFLAGS} -o $@
|
||||
|
||||
le_central: ${CORE_OBJ} ${COMMON_OBJ} le_central.o
|
||||
${CC} ${CORE_OBJ} ${COMMON_OBJ} le_central.o ${CFLAGS} ${LDFLAGS} -o $@
|
||||
|
||||
test:
|
||||
./gatt_client_test
|
||||
./le_central
|
||||
|
||||
clean:
|
||||
rm -f gatt_client le_central
|
||||
rm -f *.o *.o ${BTSTACK_ROOT}/ble/*.o
|
||||
rm -f gatt_client_test le_central
|
||||
rm -f *.o
|
||||
rm -rf *.dSYM
|
||||
|
@ -101,9 +101,12 @@ int l2cap_send_prepared_connectionless(uint16_t handle, uint16_t cid, uint16_t l
|
||||
int sm_cmac_ready(void){
|
||||
return 1;
|
||||
}
|
||||
void sm_cmac_start(sm_key_t k, uint16_t message_len, uint8_t * message, void (*done_handler)(uint8_t hash[8])){
|
||||
void sm_cmac_start(sm_key_t k, uint16_t message_len, uint8_t * message, uint32_t sign_counter, void (*done_handler)(uint8_t hash[8])){
|
||||
//sm_notify_client(SM_IDENTITY_RESOLVING_SUCCEEDED, sm_central_device_addr_type, sm_central_device_address, 0, sm_central_device_matched);
|
||||
}
|
||||
int sm_le_device_index(uint16_t handle ){
|
||||
return -1;
|
||||
}
|
||||
|
||||
void run_loop_set_timer(timer_source_t *a, uint32_t timeout_in_ms){
|
||||
}
|
||||
|
@ -6,11 +6,15 @@ BTSTACK_ROOT = ../..
|
||||
CPPUTEST_HOME = ${BTSTACK_ROOT}/test/cpputest
|
||||
|
||||
CFLAGS = -g -Wall -I. -I../ -I${BTSTACK_ROOT}/src -I${BTSTACK_ROOT}/include -I$(CPPUTEST_HOME)/include
|
||||
LDFLAGS += -L$(CPPUTEST_HOME)/lib -lCppUTest -lCppUTestExt
|
||||
LDFLAGS += -lCppUTest -lCppUTestExt
|
||||
# -L$(CPPUTEST_HOME)/lib
|
||||
|
||||
VPATH += ${BTSTACK_ROOT}/ble
|
||||
VPATH += ${BTSTACK_ROOT}/src
|
||||
VPATH += ${BTSTACK_ROOT}/platforms/posix/src
|
||||
|
||||
COMMON = \
|
||||
${BTSTACK_ROOT}/src/linked_list.c \
|
||||
|
||||
linked_list.c \
|
||||
|
||||
COMMON_OBJ = $(COMMON:.c=.o)
|
||||
|
||||
@ -19,6 +23,9 @@ all: linked_list_test
|
||||
linked_list_test: ${COMMON_OBJ} linked_list_test.c
|
||||
${CC} $^ ${CFLAGS} ${LDFLAGS} -o $@
|
||||
|
||||
test:
|
||||
./linked_list_test
|
||||
|
||||
clean:
|
||||
rm -fr linked_list_test *.dSYM *.o ../src/*.o
|
||||
|
||||
|
@ -6,19 +6,24 @@ BTSTACK_ROOT = ../..
|
||||
CPPUTEST_HOME = ${BTSTACK_ROOT}/test/cpputest
|
||||
|
||||
CFLAGS = -g -Wall -I. -I../ -I${BTSTACK_ROOT}/src -I${BTSTACK_ROOT}/include -I${BTSTACK_ROOT}/ble -I$(CPPUTEST_HOME)/include
|
||||
LDFLAGS += -L$(CPPUTEST_HOME) -lCppUTest -lCppUTestExt
|
||||
LDFLAGS += -lCppUTest -lCppUTestExt
|
||||
# -L$(CPPUTEST_HOME)
|
||||
|
||||
VPATH += ${BTSTACK_ROOT}/ble
|
||||
VPATH += ${BTSTACK_ROOT}/src
|
||||
VPATH += ${BTSTACK_ROOT}/platforms/posix/src
|
||||
|
||||
FS = \
|
||||
${BTSTACK_ROOT}/src/utils.c \
|
||||
${BTSTACK_ROOT}/platforms/posix/src/remote_device_db_fs.c
|
||||
utils.c \
|
||||
remote_device_db_fs.c
|
||||
|
||||
|
||||
MEMORY = \
|
||||
${BTSTACK_ROOT}/src/utils.c \
|
||||
${BTSTACK_ROOT}/src/memory_pool.c \
|
||||
${BTSTACK_ROOT}/src/btstack_memory.c \
|
||||
${BTSTACK_ROOT}/src/remote_device_db_memory.c \
|
||||
${BTSTACK_ROOT}/src/linked_list.c
|
||||
utils.c \
|
||||
memory_pool.c \
|
||||
btstack_memory.c \
|
||||
remote_device_db_memory.c \
|
||||
linked_list.c
|
||||
|
||||
FS_OBJ = $(FS:.c=.o)
|
||||
MEMORY_OBJ = $(MEMORY:.c=.o)
|
||||
@ -31,6 +36,10 @@ remote_device_db_memory_test: ${MEMORY_OBJ} remote_device_db_memory_test.c
|
||||
remote_device_db_fs_test: ${FS_OBJ} remote_device_db_fs_test.c
|
||||
${CC} $^ ${CFLAGS} ${LDFLAGS} -o $@
|
||||
|
||||
test:
|
||||
./remote_device_db_memory_test
|
||||
./remote_device_db_fs_test
|
||||
|
||||
clean:
|
||||
rm -f remote_device_db_memory_test remote_device_db_fs_test *.o ../src/*.o
|
||||
rm -rf *.dSYM
|
||||
|
@ -6,18 +6,23 @@ BTSTACK_ROOT = ../..
|
||||
CPPUTEST_HOME = ${BTSTACK_ROOT}/test/cpputest
|
||||
|
||||
CFLAGS = -g -Wall -I. -I${BTSTACK_ROOT}/src -I${BTSTACK_ROOT}/include -I$(CPPUTEST_HOME)/include
|
||||
LDFLAGS += -L$(CPPUTEST_HOME) -lCppUTest -lCppUTestExt
|
||||
LDFLAGS += -lCppUTest -lCppUTestExt
|
||||
# -L$(CPPUTEST_HOME)
|
||||
|
||||
VPATH += ${BTSTACK_ROOT}/ble
|
||||
VPATH += ${BTSTACK_ROOT}/src
|
||||
VPATH += ${BTSTACK_ROOT}/platforms/posix/src
|
||||
|
||||
COMMON = \
|
||||
${BTSTACK_ROOT}/src/sdp_util.c \
|
||||
${BTSTACK_ROOT}/src/sdp_parser.c \
|
||||
${BTSTACK_ROOT}/src/utils.c \
|
||||
sdp_util.c \
|
||||
sdp_parser.c \
|
||||
utils.c \
|
||||
|
||||
COMMON_OBJ = $(COMMON:.c=.o)
|
||||
|
||||
all: sdp_rfcomm_query general_sdp_query service_attribute_search_query service_search_query
|
||||
|
||||
sdp_rfcomm_query: ${COMMON_OBJ} ${BTSTACK_ROOT}/src/sdp_query_rfcomm.c sdp_rfcomm_query.c
|
||||
sdp_rfcomm_query: ${COMMON_OBJ} sdp_query_rfcomm.c sdp_rfcomm_query.c
|
||||
${CC} $^ ${CFLAGS} ${LDFLAGS} -o $@
|
||||
|
||||
general_sdp_query: ${COMMON_OBJ} general_sdp_query.c
|
||||
@ -29,7 +34,13 @@ service_attribute_search_query: ${COMMON_OBJ} service_attribute_search_query.c
|
||||
service_search_query: ${COMMON_OBJ} service_search_query.c
|
||||
${CC} $^ ${CFLAGS} ${LDFLAGS} -o $@
|
||||
|
||||
test:
|
||||
./sdp_rfcomm_query
|
||||
./general_sdp_query
|
||||
./service_attribute_search_query
|
||||
./service_search_query
|
||||
|
||||
clean:
|
||||
rm -f sdp_rfcomm_query general_sdp_query service_attribute_search_query service_search_query *.o ${BTSTACK_ROOT}/src/*.o
|
||||
rm -f sdp_rfcomm_query general_sdp_query service_attribute_search_query service_search_query *.o *.o
|
||||
rm -rf *.dSYM
|
||||
|
@ -6,21 +6,26 @@ BTSTACK_ROOT = ../..
|
||||
CPPUTEST_HOME = ${BTSTACK_ROOT}/test/cpputest
|
||||
|
||||
CFLAGS = -DUNIT_TEST -x c++ -g -Wall -Wno-unused -I. -I${BTSTACK_ROOT}/src -I${BTSTACK_ROOT}/ble -I${BTSTACK_ROOT}/include -I$(CPPUTEST_HOME)/include
|
||||
LDFLAGS += -L$(CPPUTEST_HOME)/lib -lCppUTest -lCppUTestExt
|
||||
LDFLAGS += -lCppUTest -lCppUTestExt
|
||||
# -L$(CPPUTEST_HOME)/lib
|
||||
|
||||
VPATH += ${BTSTACK_ROOT}/ble
|
||||
VPATH += ${BTSTACK_ROOT}/src
|
||||
VPATH += ${BTSTACK_ROOT}/platforms/posix/src
|
||||
|
||||
COMMON = \
|
||||
${BTSTACK_ROOT}/src/utils.c \
|
||||
${BTSTACK_ROOT}/src/btstack_memory.c \
|
||||
${BTSTACK_ROOT}/src/memory_pool.c \
|
||||
${BTSTACK_ROOT}/src/linked_list.c \
|
||||
${BTSTACK_ROOT}/src/sdp_util.c \
|
||||
${BTSTACK_ROOT}/src/remote_device_db_memory.c \
|
||||
${BTSTACK_ROOT}/src/run_loop.c \
|
||||
${BTSTACK_ROOT}/platforms/posix/src/run_loop_posix.c \
|
||||
${BTSTACK_ROOT}/src/hci_cmds.c \
|
||||
${BTSTACK_ROOT}/src/hci_dump.c \
|
||||
${BTSTACK_ROOT}/ble/sm.c \
|
||||
${BTSTACK_ROOT}/ble/le_device_db_memory.c \
|
||||
utils.c \
|
||||
btstack_memory.c \
|
||||
memory_pool.c \
|
||||
linked_list.c \
|
||||
sdp_util.c \
|
||||
remote_device_db_memory.c \
|
||||
run_loop.c \
|
||||
run_loop_posix.c \
|
||||
hci_cmds.c \
|
||||
hci_dump.c \
|
||||
sm.c \
|
||||
le_device_db_memory.c \
|
||||
rijndael.c \
|
||||
mock.c
|
||||
|
||||
@ -34,6 +39,10 @@ security_manager: ${CORE_OBJ} ${COMMON_OBJ} security_manager.c
|
||||
aestest: aestest.c rijndael.c
|
||||
${CC} ${CFLAGS} -m32 rijndael.c aestest.c -o $@
|
||||
|
||||
test:
|
||||
./security_manager
|
||||
./aestest
|
||||
|
||||
clean:
|
||||
rm -f security_manager
|
||||
rm -f *.o
|
||||
|
@ -111,10 +111,26 @@ void att_init_connection(att_connection_t * att_connection){
|
||||
att_connection->authorized = 0;
|
||||
}
|
||||
|
||||
int hci_can_send_command_packet_now(void){
|
||||
return 1;
|
||||
}
|
||||
int hci_can_send_packet_now_using_packet_buffer(uint8_t packet_type){
|
||||
return 1;
|
||||
}
|
||||
|
||||
// todo:
|
||||
hci_connection_t * hci_connection_for_bd_addr_and_type(bd_addr_t addr, bd_addr_type_t addr_type){
|
||||
printf("hci_connection_for_bd_addr_and_type not implemented in mock backend\n");
|
||||
return NULL;
|
||||
}
|
||||
hci_connection_t * hci_connection_for_handle(hci_con_handle_t con_handle){
|
||||
printf("hci_connection_for_handle not implemented in mock backend\n");
|
||||
return NULL;
|
||||
}
|
||||
void hci_connections_get_iterator(linked_list_iterator_t *it){
|
||||
printf("hci_connections_get_iterator not implemented in mock backend\n");
|
||||
}
|
||||
|
||||
// get addr type and address used in advertisement packets
|
||||
void hci_le_advertisement_address(uint8_t * addr_type, bd_addr_t addr){
|
||||
*addr_type = 0;
|
||||
@ -126,6 +142,10 @@ int l2cap_can_send_connectionless_packet_now(void){
|
||||
return packet_buffer_len == 0;
|
||||
}
|
||||
|
||||
int l2cap_can_send_fixed_channel_packet_now(uint16_t handle){
|
||||
return packet_buffer_len == 0;
|
||||
}
|
||||
|
||||
int hci_send_cmd(const hci_cmd_t *cmd, ...){
|
||||
va_list argptr;
|
||||
va_start(argptr, cmd);
|
||||
|
Loading…
x
Reference in New Issue
Block a user