From e6f15ed6c0b1da123dc941e1c5b8278c14fd3d6d Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 28 Jul 2021 10:43:43 +1000 Subject: [PATCH] autotest: cope with WriteStreaming() in doc tests --- Tools/autotest/common.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Tools/autotest/common.py b/Tools/autotest/common.py index 7c7c74c3c1..47737a3854 100644 --- a/Tools/autotest/common.py +++ b/Tools/autotest/common.py @@ -1946,7 +1946,7 @@ class AutoTest(ABC): for message_info in message_infos: for define in defines: message_info = re.sub(define, defines[define], message_info) - m = re.match(r'\s*LOG_\w+\s*,\s*sizeof\([^)]+\)\s*,\s*"(\w+)"\s*,\s*"(\w+)"\s*,\s*"([\w,]+)"\s*,\s*"([^"]+)"\s*,\s*"([^"]+)"\s*$', message_info) # noqa + m = re.match(r'\s*LOG_\w+\s*,\s*sizeof\([^)]+\)\s*,\s*"(\w+)"\s*,\s*"(\w+)"\s*,\s*"([\w,]+)"\s*,\s*"([^"]+)"\s*,\s*"([^"]+)"\s*(,\s*true)?\s*$', message_info) # noqa if m is None: continue (name, fmt, labels, units, multipliers) = (m.group(1), m.group(2), m.group(3), m.group(4), m.group(5)) @@ -1983,8 +1983,8 @@ class AutoTest(ABC): if type(line) == bytes: line = line.decode("utf-8") if state == state_outside: - if (re.match(r"\s*AP::logger\(\)[.]Write\(", line) or - re.match(r"\s*logger[.]Write\(", line)): + if (re.match(r"\s*AP::logger\(\)[.]Write(?:Streaming)?\(", line) or + re.match(r"\s*logger[.]Write(?:Streaming)?\(", line)): state = state_inside line = re.sub("//.*", "", line) # trim comments log_write_statement = line @@ -2008,10 +2008,10 @@ class AutoTest(ABC): log_write_statement = re.sub(define, defines[define], log_write_statement) # fair warning: order is important here because of the # NKT/XKT special case below.... - my_re = r' logger[.]Write\(\s*"(\w+)"\s*,\s*"([\w,]+)".*\);' + my_re = r' logger[.]Write(?:Streaming)?\(\s*"(\w+)"\s*,\s*"([\w,]+)".*\);' m = re.match(my_re, log_write_statement) if m is None: - my_re = r' AP::logger\(\)[.]Write\(\s*"(\w+)"\s*,\s*"([\w,]+)".*\);' + my_re = r' AP::logger\(\)[.]Write(?:Streaming)?\(\s*"(\w+)"\s*,\s*"([\w,]+)".*\);' m = re.match(my_re, log_write_statement) if m is None: raise NotAchievedException("Did not match (%s) with (%s)" % (log_write_statement, str(my_re)))