[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:
Simon Lin
2021-01-21 08:14:10 -08:00
committed by GitHub
parent 1c0d295a04
commit 42633b19a8
+5 -2
View File
@@ -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.
"""