autotest: add support for multi-line log formats
This commit is contained in:
parent
13fa1e30ad
commit
7bb13e934d
@ -2100,6 +2100,7 @@ class AutoTest(ABC):
|
||||
return ret
|
||||
|
||||
def all_log_format_ids(self):
|
||||
'''parse C++ code to extract definitions of log messages'''
|
||||
structure_files = self.find_LogStructureFiles()
|
||||
structure_lines = []
|
||||
for f in structure_files:
|
||||
@ -2155,7 +2156,16 @@ class AutoTest(ABC):
|
||||
if linestate == linestate_within:
|
||||
m = re.match("(.*)}", line)
|
||||
if m is None:
|
||||
raise NotAchievedException("Bad closing line (%s)" % line)
|
||||
line = line.rstrip()
|
||||
newline = re.sub(r"\\$", "", line)
|
||||
if newline == line:
|
||||
raise NotAchievedException("Expected backslash at end of line")
|
||||
line = newline
|
||||
line = line.rstrip()
|
||||
# cpp-style string concatenation:
|
||||
line = re.sub(r'"\s*"', '', line)
|
||||
partial_line += line
|
||||
continue
|
||||
message_infos.append(partial_line + m.group(1))
|
||||
linestate = linestate_none
|
||||
continue
|
||||
@ -2214,7 +2224,16 @@ class AutoTest(ABC):
|
||||
if linestate == linestate_within:
|
||||
m = re.match("(.*)}", line)
|
||||
if m is None:
|
||||
raise NotAchievedException("Bad closing line (%s)" % line)
|
||||
line = line.rstrip()
|
||||
newline = re.sub(r"\\$", "", line)
|
||||
if newline == line:
|
||||
raise NotAchievedException("Expected backslash at end of line")
|
||||
line = newline
|
||||
line = line.rstrip()
|
||||
# cpp-style string concatenation:
|
||||
line = re.sub(r'"\s*"', '', line)
|
||||
partial_line += line
|
||||
continue
|
||||
message_infos.append(partial_line + m.group(1))
|
||||
linestate = linestate_none
|
||||
continue
|
||||
|
Loading…
Reference in New Issue
Block a user