提交 27fde9ce 编写于 作者: L Lukáš Doktor

test: Correct skip_location for SimpleTests

The skip_location is suppose to use "skip_location" and not
"warn_location".
Signed-off-by: NLukáš Doktor <ldoktor@redhat.com>
上级 7582d26b
......@@ -1186,7 +1186,7 @@ class SimpleTest(Test):
if re_skip.search(result.stdout_text):
raise exceptions.TestSkipError(skip_msg % 'stdout')
if warn_location in ['all', 'stderr']:
if skip_location in ['all', 'stderr']:
if re_skip.search(result.stderr_text):
raise exceptions.TestSkipError(skip_msg % 'stderr')
......
......@@ -855,14 +855,16 @@ class RunnerSimpleTestStatus(unittest.TestCase):
self.config_file = script.TemporaryScript('avocado.conf',
"[simpletests.status]\n"
"warn_regex = ^WARN$\n"
"skip_regex = ^SKIP$\n")
"skip_regex = ^SKIP$\n"
"skip_location = stdout\n")
self.config_file.save()
os.chdir(basedir)
def test_simpletest_status(self):
# Multi-line warning in STDERR should by default be handled
warn_script = script.TemporaryScript('avocado_warn.sh',
'#!/bin/sh\n'
'echo -e "\\n\\nWARN\\n"',
'>&2 echo -e "\\n\\nWARN\\n"',
'avocado_simpletest_'
'functional')
warn_script.save()
......@@ -873,7 +875,7 @@ class RunnerSimpleTestStatus(unittest.TestCase):
json_results = json.loads(result.stdout_text)
self.assertEquals(json_results['tests'][0]['status'], 'WARN')
warn_script.remove()
# Skip in STDOUT should be handled because of config
skip_script = script.TemporaryScript('avocado_skip.sh',
"#!/bin/sh\necho SKIP",
'avocado_simpletest_'
......@@ -886,6 +888,19 @@ class RunnerSimpleTestStatus(unittest.TestCase):
json_results = json.loads(result.stdout_text)
self.assertEquals(json_results['tests'][0]['status'], 'SKIP')
skip_script.remove()
# STDERR skip should not be handled
skip2_script = script.TemporaryScript('avocado_skip.sh',
"#!/bin/sh\n>&2 echo SKIP",
'avocado_simpletest_'
'functional')
skip2_script.save()
cmd_line = ('%s --config %s run --job-results-dir %s --sysinfo=off'
' %s --json -' % (AVOCADO, self.config_file.path,
self.tmpdir, skip2_script.path))
result = process.run(cmd_line, ignore_status=True)
json_results = json.loads(result.stdout_text)
self.assertEquals(json_results['tests'][0]['status'], 'PASS')
skip2_script.remove()
def tearDown(self):
self.config_file.remove()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册