Browse Source

autotest: cope with WriteStreaming() in doc tests

gps-1.3.1
Andrew Tridgell 4 years ago
parent
commit
e6f15ed6c0
  1. 10
      Tools/autotest/common.py

10
Tools/autotest/common.py

@ -1946,7 +1946,7 @@ class AutoTest(ABC):
for message_info in message_infos: for message_info in message_infos:
for define in defines: for define in defines:
message_info = re.sub(define, defines[define], message_info) 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: if m is None:
continue continue
(name, fmt, labels, units, multipliers) = (m.group(1), m.group(2), m.group(3), m.group(4), m.group(5)) (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: if type(line) == bytes:
line = line.decode("utf-8") line = line.decode("utf-8")
if state == state_outside: if state == state_outside:
if (re.match(r"\s*AP::logger\(\)[.]Write\(", line) or if (re.match(r"\s*AP::logger\(\)[.]Write(?:Streaming)?\(", line) or
re.match(r"\s*logger[.]Write\(", line)): re.match(r"\s*logger[.]Write(?:Streaming)?\(", line)):
state = state_inside state = state_inside
line = re.sub("//.*", "", line) # trim comments line = re.sub("//.*", "", line) # trim comments
log_write_statement = line log_write_statement = line
@ -2008,10 +2008,10 @@ class AutoTest(ABC):
log_write_statement = re.sub(define, defines[define], log_write_statement) log_write_statement = re.sub(define, defines[define], log_write_statement)
# fair warning: order is important here because of the # fair warning: order is important here because of the
# NKT/XKT special case below.... # 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) m = re.match(my_re, log_write_statement)
if m is None: 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) m = re.match(my_re, log_write_statement)
if m is None: if m is None:
raise NotAchievedException("Did not match (%s) with (%s)" % (log_write_statement, str(my_re))) raise NotAchievedException("Did not match (%s) with (%s)" % (log_write_statement, str(my_re)))

Loading…
Cancel
Save