mirror of
https://github.com/espressif/openthread.git
synced 2026-08-17 07:59:51 +00:00
[thread-cert] ignore CLI log lines (#6102)
This commit allows node.py to ignore log lines from node CLI output. Only if _expect_command_output is used.
This commit is contained in:
@@ -497,7 +497,7 @@ class NodeImpl:
|
||||
|
||||
return results
|
||||
|
||||
def _expect_command_output(self, cmd: str):
|
||||
def _expect_command_output(self, cmd: str, ignore_logs=True):
|
||||
lines = []
|
||||
cmd_output_started = False
|
||||
|
||||
@@ -515,7 +515,7 @@ class NodeImpl:
|
||||
cmd_output_started = True
|
||||
continue
|
||||
|
||||
if not cmd_output_started:
|
||||
if not cmd_output_started or (ignore_logs and self.__is_logging_line(line)):
|
||||
continue
|
||||
|
||||
if line == 'Done':
|
||||
@@ -528,6 +528,9 @@ class NodeImpl:
|
||||
print(f'_expect_command_output({cmd!r}) returns {lines!r}')
|
||||
return lines
|
||||
|
||||
def __is_logging_line(self, line: str) -> bool:
|
||||
return len(line) >= 6 and line[:6] in {'[DEBG]', '[INFO]', '[NOTE]', '[WARN]', '[CRIT]', '[NONE]'}
|
||||
|
||||
def read_cert_messages_in_commissioning_log(self, timeout=-1):
|
||||
"""Get the log of the traffic after DTLS handshake.
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user