test: fix build

This commit is contained in:
Matthias Ringwald 2023-12-05 17:47:34 +01:00
parent e4d1c5dca6
commit ec4690afd1
8 changed files with 33 additions and 37 deletions

View File

@ -8,6 +8,8 @@ LDFLAGS += ${shell pkg-config --libs CppuTest}
CFLAGS += -DUNIT_TEST -g -Wall -Wnarrowing -Wconversion-null
CFLAGS += -I${BTSTACK_ROOT}/src
CFLAGS += -I${BTSTACK_ROOT}/3rd-party/bluedroid/decoder/include
CFLAGS += -I${BTSTACK_ROOT}/3rd-party/bluedroid/encoder/include
CFLAGS += -I..
VPATH += ${BTSTACK_ROOT}/src

View File

@ -1,11 +1,14 @@
cmake_minimum_required (VERSION 3.5)
project(gatt-client-test)
# add CppUTest
include_directories("/usr/local/include")
link_directories("/usr/local/lib")
link_libraries( CppUTest )
link_libraries( CppUTestExt )
# pkgconfig
find_package(PkgConfig REQUIRED)
# CppuTest
pkg_check_modules(CPPUTEST REQUIRED CppuTest)
include_directories(${CPPUTEST_INCLUDE_DIRS})
link_directories(${CPPUTEST_LIBRARY_DIRS})
link_libraries(${CPPUTEST_LIBRARIES})
# set include paths
include_directories(..)

View File

@ -1,14 +1,14 @@
cmake_minimum_required (VERSION 3.5)
project(gatt-client-test)
# fink pkgconfig
# pkgconfig
find_package(PkgConfig REQUIRED)
# add CppUTest
include_directories("/usr/local/include")
link_directories("/usr/local/lib")
link_libraries( CppUTest )
link_libraries( CppUTestExt )
# CppuTest
pkg_check_modules(CPPUTEST REQUIRED CppuTest)
include_directories(${CPPUTEST_INCLUDE_DIRS})
link_directories(${CPPUTEST_LIBRARY_DIRS})
link_libraries(${CPPUTEST_LIBRARIES})
include_directories(.)
include_directories(../../src)
@ -27,7 +27,6 @@ set(SOURCES
../../src/btstack_util.c
../../src/hci_cmd.c
../../src/hci_dump.c
../../src/le-audio/gatt-service/coordinated_set_identification_service_client.c
../../src/btstack_crypto.c
../../3rd-party/rijndael/rijndael.c
)

View File

@ -74,6 +74,7 @@ void mock_simulate_scan_response(void){
uint8_t packet[] = {GAP_EVENT_ADVERTISING_REPORT, 0x13, 0xE2, 0x01, 0x34, 0xB1, 0xF7, 0xD1, 0x77, 0x9B, 0xCC, 0x09, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08};
registered_hci_event_handler(HCI_EVENT_PACKET, 0, (uint8_t *)&packet, sizeof(packet));
}
bool gap_authenticated(hci_con_handle_t con_handle){
UNUSED(con_handle);
return false;
@ -266,22 +267,10 @@ void hci_setup_le_connection(uint16_t con_handle){
hci_setup_connection(con_handle, BD_ADDR_TYPE_LE_PUBLIC);
}
// int hci_send_cmd(const hci_cmd_t *cmd, ...){
// // printf("hci_send_cmd opcode 0x%02x\n", cmd->opcode);
// return 0;
// }
// int hci_can_send_packet_now_using_packet_buffer(uint8_t packet_type){
// return 1;
// }
// void hci_disconnect_security_block(hci_con_handle_t con_handle){
// printf("hci_disconnect_security_block \n");
// }
// void hci_dump_log(const char * format, ...){
// printf("hci_disconnect_security_block \n");
// }
void l2cap_run(void){
}
#include "btstack_run_loop.h"
void btstack_run_loop_execute_on_main_thread(btstack_context_callback_registration_t * callback_registration){
callback_registration->callback(callback_registration->context);
}

View File

@ -1,14 +1,14 @@
cmake_minimum_required (VERSION 3.5)
project(gatt_server)
# fink pkgconfig
# pkgconfig
find_package(PkgConfig REQUIRED)
# add CppUTest
include_directories("/usr/local/include")
link_directories("/usr/local/lib")
link_libraries( CppUTest )
link_libraries( CppUTestExt )
# CppuTest
pkg_check_modules(CPPUTEST REQUIRED CppuTest)
include_directories(${CPPUTEST_INCLUDE_DIRS})
link_directories(${CPPUTEST_LIBRARY_DIRS})
link_libraries(${CPPUTEST_LIBRARIES})
include_directories(.)
include_directories(../mock/)

View File

@ -28,7 +28,8 @@ COMMON = \
att_db.c \
att_db_util.c \
att_server.c \
battery_service_server.c \
btstack_hid_parser.c \
battery_service_server.c \
btstack_crypto.c \
btstack_linked_list.c \
btstack_memory.c \

View File

@ -359,6 +359,7 @@ TEST(ATT_SERVER, att_packet_handler_ATT_WRITE_COMMAND_signed_write_confirmation)
buffer[0] = SM_EVENT_IDENTITY_RESOLVING_SUCCEEDED;
buffer[1] = 18; // H1B1B2
little_endian_store_16(buffer, 18, 0);
mock_call_att_packet_handler(HCI_EVENT_PACKET, 0, &buffer[0], 11);
}
@ -542,7 +543,7 @@ TEST(ATT_SERVER, sm_event_identity_resolving_succeeded_event) {
uint8_t buffer[20];
buffer[0] = SM_EVENT_IDENTITY_RESOLVING_SUCCEEDED;
buffer[1] = 18; // H1B1B2
little_endian_store_16(buffer, 18, 0);
test_hci_event_encryption_events(att_con_handle, 2, buffer, sizeof(buffer));
}

View File

@ -24,6 +24,7 @@ VPATH += ${BTSTACK_ROOT}/test/mock
COMMON = \
ad_parser.c \
att_db.c \
btstack_hid_parser.c \
battery_service_server.c \
btstack_linked_list.c \
btstack_memory.c \