提交 f468f04e 编写于 作者: C Cleber Rosa

Functional test for running non-absolute SIMPLE tests

There is an issue when running SIMPLE tests with non absolute
paths, example:

 $ echo "#!/bin/bash" > /tmp/test.sh
 $ echo "exit 0" >> /tmp/test.sh
 $ chmod +x /tmp/test.sh
 $ cd /tmp
 $ avocado run test.sh

The previous work on the simple test runner, adding the filename
property, actually fixes that bug, so let's add a functional test to
avoid an regression.

Reference: https://trello.com/c/nbhyILO0Signed-off-by: NCleber Rosa <crosa@redhat.com>
上级 0b0bc333
......@@ -462,6 +462,19 @@ class RunnerSimpleTest(unittest.TestCase):
self.assertIn('ERROR| Error message (ordinary message not changing '
'the results)', result.stdout, result)
def test_non_absolute_path(self):
avocado_path = os.path.join(basedir, 'scripts', 'avocado')
test_base_dir = os.path.dirname(self.pass_script.path)
test_file_name = os.path.basename(self.pass_script.path)
os.chdir(test_base_dir)
cmd_line = ('%s run --job-results-dir %s --sysinfo=off'
' %s' % (avocado_path, self.tmpdir, test_file_name))
result = process.run(cmd_line, ignore_status=True)
expected_rc = exit_codes.AVOCADO_ALL_OK
self.assertEqual(result.exit_status, expected_rc,
"Avocado did not return rc %d:\n%s" %
(expected_rc, result))
def tearDown(self):
self.pass_script.remove()
self.fail_script.remove()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册