mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-03-12 10:13:43 +00:00
test/fuzz: test hci
This commit is contained in:
parent
1f805efefd
commit
eddac6153d
12
src/hci.c
12
src/hci.c
@ -5312,3 +5312,15 @@ void hci_halting_defer(void){
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
|
||||
void hci_free_connections_fuzz(void){
|
||||
btstack_linked_list_iterator_t it;
|
||||
btstack_linked_list_iterator_init(&it, &hci_stack->connections);
|
||||
while (btstack_linked_list_iterator_has_next(&it)){
|
||||
hci_connection_t * con = (hci_connection_t*) btstack_linked_list_iterator_next(&it);
|
||||
btstack_linked_list_iterator_remove(&it);
|
||||
btstack_memory_hci_connection_free(con);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
11
src/hci.h
11
src/hci.h
@ -1229,6 +1229,11 @@ void hci_le_set_own_address_type(uint8_t own_address_type);
|
||||
*/
|
||||
uint16_t hci_get_manufacturer(void);
|
||||
|
||||
/**
|
||||
* Defer halt. Used by btstack_crypto to allow current HCI operation to complete
|
||||
*/
|
||||
void hci_halting_defer(void);
|
||||
|
||||
// Only for PTS testing
|
||||
|
||||
/**
|
||||
@ -1241,10 +1246,8 @@ void hci_disable_l2cap_timeout_check(void);
|
||||
*/
|
||||
HCI_STATE hci_get_state(void);
|
||||
|
||||
/**
|
||||
* Defer halt. Used by btstack_crypto to allow current HCI operation to complete
|
||||
*/
|
||||
void hci_halting_defer(void);
|
||||
// free all connections, used for fuzzing
|
||||
void hci_free_connections_fuzz(void);
|
||||
|
||||
#if defined __cplusplus
|
||||
}
|
||||
|
@ -101,15 +101,15 @@ set(SOURCES
|
||||
)
|
||||
list(SORT SOURCES)
|
||||
|
||||
add_compile_options( -fsanitize=fuzzer,address -fprofile-instr-generate -fcoverage-mapping)
|
||||
add_link_options( -fsanitize=fuzzer,address)
|
||||
|
||||
# create static lib
|
||||
add_library(btstack STATIC ${SOURCES})
|
||||
|
||||
# create fuzz targets
|
||||
file(GLOB TARGETS_C "fuzz_*.c")
|
||||
|
||||
add_compile_options( -fsanitize=fuzzer,address)
|
||||
add_link_options( -fsanitize=fuzzer,address)
|
||||
|
||||
# create targets
|
||||
foreach(TARGET_FILE ${TARGETS_C})
|
||||
get_filename_component(EXAMPLE ${TARGET_FILE} NAME_WE)
|
||||
|
@ -5,11 +5,14 @@
|
||||
#ifndef __BTSTACK_CONFIG
|
||||
#define __BTSTACK_CONFIG
|
||||
|
||||
#define FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
|
||||
|
||||
// Port related features
|
||||
#define HAVE_MALLOC
|
||||
#define HAVE_POSIX_FILE_IO
|
||||
#define HAVE_BTSTACK_STDIN
|
||||
#define HAVE_POSIX_TIME
|
||||
#define HAVE_ASSERT
|
||||
|
||||
// BTstack features that can be enabled
|
||||
#define ENABLE_BLE
|
||||
|
Loading…
x
Reference in New Issue
Block a user