From cbd1d5099537b4110c2f5e88bd30d8ec62f59e4a Mon Sep 17 00:00:00 2001 From: Simon Lin Date: Tue, 12 Apr 2022 05:08:39 +0800 Subject: [PATCH] [otci] support filter new log formats (#7586) --- tools/otci/otci/command_handlers.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tools/otci/otci/command_handlers.py b/tools/otci/otci/command_handlers.py index c8982f36f..0055b1a46 100644 --- a/tools/otci/otci/command_handlers.py +++ b/tools/otci/otci/command_handlers.py @@ -86,9 +86,18 @@ class OtCliCommandRunner(OTCommandHandler): __PATTERN_LOG_LINE = re.compile(r'((\[(NONE|CRIT|WARN|NOTE|INFO|DEBG)\])' r'|(-.*-+: )' # e.g. -CLI-----: + r'|(\[[DINWC\-]\] (?=[\w\-]{14}:)\w+-*:)' # e.g. [I] Mac-----------: r')') """regex used to filter logs""" + assert __PATTERN_LOG_LINE.match('[I] ChannelMonitor: debug log') + assert __PATTERN_LOG_LINE.match('[I] Mac-----------: info log') + assert __PATTERN_LOG_LINE.match('[N] MeshForwarder-: note log') + assert __PATTERN_LOG_LINE.match('[W] Notifier------: warn log') + assert __PATTERN_LOG_LINE.match('[C] Mle-----------: critical log') + assert __PATTERN_LOG_LINE.match('[-] Settings------: none log') + assert not __PATTERN_LOG_LINE.match('[-] Settings-----: none log') # not enough `-` after module name + __ASYNC_COMMANDS = {'scan', 'ping', 'discover'} def __init__(self, otcli: OtCliHandler, is_spinel_cli=False):