mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-01-30 06:32:43 +00:00
test/auto-pts; runtime lookup for __gcov_dump resp. __gcov_flush
This commit is contained in:
parent
78c4542a56
commit
ebf3ce5c6f
@ -55,8 +55,7 @@
|
||||
#include "btp_socket.h"
|
||||
|
||||
#ifdef COVERAGE
|
||||
// guesswork:
|
||||
void __gcov_flush(void);
|
||||
#include <dlfcn.h>
|
||||
#endif
|
||||
|
||||
#define AUTOPTS_SOCKET_NAME "/tmp/bt-stack-tester"
|
||||
@ -126,6 +125,31 @@ static btstack_timer_source_t heartbeat;
|
||||
// static bd_addr_t pts_addr = { 0x00, 0x1b, 0xdc, 0x07, 0x32, 0xef};
|
||||
static bd_addr_t pts_addr = { 0x00, 0x1b, 0xdc, 0x08, 0xe2, 0x5c};
|
||||
|
||||
// GCOV Flush
|
||||
static void my_gcov_flush(void){
|
||||
#ifdef COVERAGE
|
||||
static void (*gcov_flush_fn)(void) = NULL;
|
||||
if (gcov_flush_fn == NULL){
|
||||
// look up __gov_flush
|
||||
gcov_flush_fn = dlsym(RTLD_DEFAULT, "__gcov_flush");
|
||||
if (gcov_flush_fn != NULL){
|
||||
printf("Using __gcov_flush %p\n", gcov_flush_fn);
|
||||
}
|
||||
}
|
||||
if (gcov_flush_fn == NULL){
|
||||
// lookup __gov_dump
|
||||
gcov_flush_fn = dlsym(RTLD_DEFAULT, "__gcov_dump");
|
||||
if (gcov_flush_fn != NULL){
|
||||
printf("Using __gcov_dump %p\n", gcov_flush_fn);
|
||||
}
|
||||
}
|
||||
if (gcov_flush_fn != NULL){
|
||||
// call either one
|
||||
(*gcov_flush_fn)();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
// log/debug output
|
||||
#define MESSAGE(format, ...) log_info(format, ## __VA_ARGS__); printf(format "\n", ## __VA_ARGS__)
|
||||
static void MESSAGE_HEXDUMP(const uint8_t * data, uint16_t len){
|
||||
@ -139,9 +163,7 @@ static void heartbeat_handler(btstack_timer_source_t *ts){
|
||||
btstack_run_loop_set_timer_handler(&heartbeat, &heartbeat_handler);
|
||||
btstack_run_loop_set_timer(&heartbeat, 5000);
|
||||
btstack_run_loop_add_timer(&heartbeat);
|
||||
#ifdef COVERAGE
|
||||
__gcov_flush();
|
||||
#endif
|
||||
my_gcov_flush();
|
||||
}
|
||||
|
||||
static void btp_send(uint8_t service_id, uint8_t opcode, uint8_t controller_index, uint16_t length, const uint8_t *data){
|
||||
@ -669,9 +691,7 @@ static void btp_core_handler(uint8_t opcode, uint8_t controller_index, uint16_t
|
||||
status = data[0];
|
||||
if (status == BTP_ERROR_NOT_READY){
|
||||
// connection stopped, abort
|
||||
#ifdef COVERAGE
|
||||
__gcov_flush();
|
||||
#endif
|
||||
my_gcov_flush();
|
||||
exit(10);
|
||||
}
|
||||
break;
|
||||
|
Loading…
x
Reference in New Issue
Block a user