提交 7582d26b 编写于 作者: L Lukáš Doktor

test: Allow MULTILINE in SKIP/WARN SimpleTests detection

The built-in regexp requires re.MULTILINE to work the same way as before
(allowing the match to be everywhere and not just in the first line).

As for the existing ones I believe users would benefit from allowing
MULTILINE as well, but there might be slight change in behavior.
Signed-off-by: NLukáš Doktor <ldoktor@redhat.com>
上级 01f400c5
......@@ -1168,7 +1168,7 @@ class SimpleTest(Test):
warn_msg = ("Test passed but there were warnings on %s during "
"execution. Check the log for details.")
if regex is not None:
re_warn = re.compile(regex)
re_warn = re.compile(regex, re.MULTILINE)
if warn_location in ['all', 'stdout']:
if re_warn.search(result.stdout_text):
raise exceptions.TestWarn(warn_msg % 'stdout')
......@@ -1178,7 +1178,7 @@ class SimpleTest(Test):
raise exceptions.TestWarn(warn_msg % 'stderr')
if skip_regex is not None:
re_skip = re.compile(skip_regex)
re_skip = re.compile(skip_regex, re.MULTILINE)
skip_msg = ("Test passed but %s indicates test was skipped. "
"Check the log for details.")
......
......@@ -742,6 +742,8 @@ class RunnerSimpleTest(unittest.TestCase):
b'finish with warning)', result.stdout, result)
self.assertIn(b'ERROR| Error message (ordinary message not changing '
b'the results)', result.stdout, result)
self.assertIn(b'Test passed but there were warnings', result.stdout,
result)
@unittest.skipIf(not GNU_ECHO_BINARY, "Uses echo as test")
def test_fs_unfriendly_run(self):
......@@ -859,7 +861,8 @@ class RunnerSimpleTestStatus(unittest.TestCase):
def test_simpletest_status(self):
warn_script = script.TemporaryScript('avocado_warn.sh',
"#!/bin/sh\necho WARN",
'#!/bin/sh\n'
'echo -e "\\n\\nWARN\\n"',
'avocado_simpletest_'
'functional')
warn_script.save()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册