提交 b441c7b0 编写于 作者: L Lucas Meneghel Rodrigues

Merge pull request #562 from ldoktor/remotefix

avocado.remote: Accept "timeout" arg
......@@ -61,10 +61,6 @@ class RunRemote(plugin.Plugin):
action='store_true',
help="Don't copy tests and use the "
"exact uri on guest machine.")
self.remote_parser.add_argument('--remote-timeout', type=float,
help="Host timeout before the "
"connection is cut off and test "
"set as failed.")
self.configured = True
@staticmethod
......
......@@ -67,10 +67,6 @@ class RunVM(plugin.Plugin):
action='store_true',
help="Don't copy tests and use the "
"exact uri on VM machine.")
self.vm_parser.add_argument('--vm-timeout', type=float,
help="Host timeout before the "
"connection is cut off and test "
"set as failed.")
self.configured = True
@staticmethod
......
......@@ -43,7 +43,6 @@ class RemoteTestResult(HumanTestResult):
self.remote = None # Remote runner initialized during setup
self.output = '-'
self.command_line_arg_name = '--remote-hostname'
self.timeout = getattr(args, 'remote_timeout', None)
def _copy_tests(self):
"""
......@@ -99,7 +98,6 @@ class VMTestResult(RemoteTestResult):
"""
def __init__(self, stream, args):
args.remote_timeout = getattr(args, 'vm_timeout', None)
super(VMTestResult, self).__init__(stream, args)
self.vm = None
self.command_line_arg_name = '--vm-domain'
......
......@@ -56,7 +56,7 @@ class RemoteTestRunner(TestRunner):
return (True, tuple(map(int, match.groups())))
def run_test(self, urls):
def run_test(self, urls, timeout):
"""
Run tests.
......@@ -84,11 +84,11 @@ class RemoteTestRunner(TestRunner):
urls_str))
try:
result = self.result.remote.run(avocado_cmd, ignore_status=True,
timeout=self.result.timeout)
timeout=timeout)
except CommandTimeout:
raise exceptions.JobError("Remote execution took longer than "
"specified timeout (%s). Interrupting."
% (self.result.timeout))
% (timeout))
json_result = None
for json_output in result.stdout.splitlines():
# We expect dictionary:
......@@ -112,7 +112,7 @@ class RemoteTestRunner(TestRunner):
return json_result
def run_suite(self, test_suite, mux):
def run_suite(self, test_suite, mux, timeout):
"""
Run one or more tests and report with test result.
......@@ -123,9 +123,11 @@ class RemoteTestRunner(TestRunner):
"""
del test_suite # using self.result.urls instead
del mux # we're not using multiplexation here
if not timeout: # avoid timeout = 0
timeout = None
failures = []
self.result.setup()
results = self.run_test(self.result.urls)
results = self.run_test(self.result.urls, timeout)
remote_log_dir = os.path.dirname(results['debuglog'])
self.result.start_tests()
for tst in results['tests']:
......
......@@ -50,7 +50,7 @@ class RemoteTestRunnerTest(unittest.TestCase):
args = ("cd ~/avocado/tests; avocado run --force-job-id sleeptest.1 "
"--json - --archive sleeptest")
(Remote.should_receive('run')
.with_args(args, timeout=None, ignore_status=True)
.with_args(args, timeout=61, ignore_status=True)
.once().and_return(test_results))
Results = flexmock(remote=Remote, urls=['sleeptest'],
stream=stream, timeout=None)
......@@ -85,7 +85,7 @@ class RemoteTestRunnerTest(unittest.TestCase):
def test_run_suite(self):
""" Test RemoteTestRunner.run_suite() """
self.remote.run_suite(None, None)
self.remote.run_suite(None, None, 61)
flexmock_teardown() # Checks the expectations
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册