sanitycheck: use re.search to match output

Account for cases where there is a prefix to the output where exact
matching does not work.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit is contained in:
Anas Nashif 2018-01-24 09:54:08 +05:30 committed by Anas Nashif
commit 39caff5ca1

View file

@ -23,12 +23,12 @@ class Console(Harness):
def handle(self, line): def handle(self, line):
if self.type == "one_line": if self.type == "one_line":
pattern = re.compile(self.regex[0]) pattern = re.compile(self.regex[0])
if pattern.match(line): if pattern.search(line):
self.state = "passed" self.state = "passed"
elif self.type == "multi_line": elif self.type == "multi_line":
for r in self.regex: for r in self.regex:
pattern = re.compile(r) pattern = re.compile(r)
if pattern.match(line) and not r in self.matches: if pattern.search(line) and not r in self.matches:
self.matches[r] = line self.matches[r] = line
if len(self.matches) == len(self.regex): if len(self.matches) == len(self.regex):