mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-02-04 15:39:59 +00:00
test/security_manager_sc: flush coverage data before exit
This commit is contained in:
parent
35e92150ad
commit
b4394846ba
@ -79,7 +79,7 @@ VPATH += ${BTSTACK_ROOT}/chipset/zephyr
|
||||
CFLAGS += $(shell pkg-config libusb-1.0 --cflags)
|
||||
LDFLAGS += $(shell pkg-config libusb-1.0 --libs)
|
||||
|
||||
CFLAGS += -fprofile-arcs -ftest-coverage -fsanitize=address,undefined
|
||||
CFLAGS += -fprofile-arcs -ftest-coverage -fsanitize=address,undefined -DCOVERAGE
|
||||
|
||||
CORE_OBJ = $(CORE:.c=.o)
|
||||
COMMON_OBJ = $(COMMON:.c=.o)
|
||||
|
@ -63,6 +63,11 @@
|
||||
#include "l2cap.h"
|
||||
#include "btstack_stdin.h"
|
||||
|
||||
#ifdef COVERAGE
|
||||
// guesswork:
|
||||
void __gcov_flush(void);
|
||||
#endif
|
||||
|
||||
#define HEARTBEAT_PERIOD_MS 1000
|
||||
|
||||
const uint8_t adv_data[] = {
|
||||
@ -343,6 +348,7 @@ static void app_packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *
|
||||
}
|
||||
|
||||
static void stdin_process(char c){
|
||||
log_info("stdin: %c (%02x)", c, c);
|
||||
// passkey input
|
||||
if (ui_digits_for_passkey && c >= '0' && c <= '9'){
|
||||
printf("%c", c);
|
||||
@ -422,7 +428,11 @@ static void stdin_process(char c){
|
||||
sm_request_pairing(connection_handle);
|
||||
break;
|
||||
case 'x':
|
||||
printf("Exit\n");
|
||||
#ifdef COVERAGE
|
||||
log_info("Flush gcov");
|
||||
__gcov_flush();
|
||||
#endif
|
||||
printf("EXIT\n");
|
||||
exit(0);
|
||||
break;
|
||||
default:
|
||||
|
@ -49,7 +49,7 @@ failures = [
|
||||
debug = False
|
||||
regenerate = False
|
||||
# usb_paths = ['4', '6']
|
||||
usb_paths = ['3', '5']
|
||||
usb_paths = ['1', '2']
|
||||
|
||||
class Node:
|
||||
|
||||
@ -117,7 +117,7 @@ class Node:
|
||||
args.append('-o')
|
||||
args.append(self.oob_data)
|
||||
print('%s - "%s"' % (self.name, ' '.join(args)))
|
||||
self.p = subprocess.Popen(args, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||||
self.p = subprocess.Popen(args, bufsize=0, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||||
(self.stdin, self.stdout) = (self.p.stdin, self.p.stdout)
|
||||
self.linebuffer = ''
|
||||
|
||||
@ -137,10 +137,13 @@ class Node:
|
||||
self.peer_addr = addr
|
||||
|
||||
def write(self, string):
|
||||
self.stdin.write(string)
|
||||
self.stdin.write(string.encode('utf-8'))
|
||||
|
||||
def terminate(self):
|
||||
self.write('x')
|
||||
# wait for 'EXIT' message indicating coverage data was written
|
||||
while not self.got_line():
|
||||
self.read_stdout()
|
||||
self.p.terminate()
|
||||
|
||||
def run(test_descriptor, nodes):
|
||||
|
Loading…
x
Reference in New Issue
Block a user