mirror of
https://github.com/espressif/esp-idf.git
synced 2026-04-27 19:13:21 +00:00
feat(conftest): add gcov_dump helper to openocd fixture
This commit is contained in:
+13
-2
@@ -222,13 +222,13 @@ class OpenOCD:
|
||||
else:
|
||||
raise ConnectionRefusedError
|
||||
|
||||
def write(self, s: str) -> t.Any:
|
||||
def write(self, s: str, timeout: int = 30) -> t.Any:
|
||||
if self.telnet is None:
|
||||
logging.error('Telnet connection is not established.')
|
||||
return ''
|
||||
resp = self.telnet.read_very_eager()
|
||||
self.telnet.write(to_bytes(s, '\n'))
|
||||
resp += self.telnet.read_until(b'>')
|
||||
resp += self.telnet.read_until(b'>', timeout=timeout)
|
||||
return to_str(resp)
|
||||
|
||||
def apptrace_wait_stop(self, timeout: int = 30) -> None:
|
||||
@@ -244,6 +244,17 @@ class OpenOCD:
|
||||
raise pexpect.TIMEOUT('Failed to wait for apptrace stop!')
|
||||
time.sleep(1)
|
||||
|
||||
def gcov_dump(self, on_the_fly: bool = True) -> t.Any:
|
||||
cmd = 'esp gcov'
|
||||
if not on_the_fly:
|
||||
cmd += ' dump'
|
||||
cmd_out = self.write(cmd)
|
||||
if 'Targets connected.' not in cmd_out:
|
||||
raise pexpect.TIMEOUT('Failed to start gcov dump!')
|
||||
if 'Targets disconnected.' not in cmd_out:
|
||||
raise pexpect.TIMEOUT('Failed to stop gcov dump!')
|
||||
return cmd_out
|
||||
|
||||
def kill(self) -> None:
|
||||
# Check if the process is still running
|
||||
if self.proc and self.proc.isalive():
|
||||
|
||||
Reference in New Issue
Block a user