提交 243ddd45 编写于 作者: R Rudá Moura

avocado.core.remote.runner: When setup/teardown fails, exit gently.

When setup() or tear_down() fails, Avocado
will provide a gentle error message and a proper exit code and
put the traceback in the test log.

  ./scripts/avocado run --remote-host nowhereland passtest
  LOGIN      : rmoura@nowhereland:22
  Avocado job failed: JobError: Name lookup failed for nowhereland

Prior to this commit, when setup or tear_down failed,
Avocado dumps the traceback and prints that it crashed, which
can potentially confuses the user.
Signed-off-by: NRudá Moura <rmoura@redhat.com>
上级 40b58b4c
......@@ -13,6 +13,7 @@
# Author: Ruda Moura <rmoura@redhat.com>
"""Remote test runner."""
import sys
import json
import os
import re
......@@ -22,6 +23,7 @@ from avocado.core import status
from avocado.core.runner import TestRunner
from avocado.core.remote.test import RemoteTest
from avocado.utils import archive
from avocado.utils import stacktrace
from fabric.exceptions import CommandTimeout
......@@ -126,7 +128,11 @@ class RemoteTestRunner(TestRunner):
if not timeout: # avoid timeout = 0
timeout = None
failures = []
self.result.setup()
try:
self.result.setup()
except Exception, details:
stacktrace.log_exc_info(sys.exc_info(), logger='avocado.test')
raise exceptions.JobError(details)
results = self.run_test(self.result.urls, timeout)
remote_log_dir = os.path.dirname(results['debuglog'])
self.result.start_tests()
......@@ -152,5 +158,9 @@ class RemoteTestRunner(TestRunner):
archive.uncompress(zip_path_filename, local_log_dir)
os.remove(zip_path_filename)
self.result.end_tests()
self.result.tear_down()
try:
self.result.tear_down()
except Exception, details:
stacktrace.log_exc_info(sys.exc_info(), logger='avocado.test')
raise exceptions.JobError(details)
return failures
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册