Skip to content

Commit

Permalink
Merge pull request #103 from w3c/servo_debugger
Browse files Browse the repository at this point in the history
Fix servo support and improve running under debugger
  • Loading branch information
jgraham committed Apr 21, 2015
2 parents 0f6bcaa + a68b1a4 commit 036c993
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 17 deletions.
9 changes: 3 additions & 6 deletions wptrunner/browsers/servo.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ def check_args(**kwargs):

def browser_kwargs(**kwargs):
return {"binary": kwargs["binary"],
"debug_info": kwargs["debug_info"],
"interactive": kwargs["interactive"]}
"debug_info": kwargs["debug_info"]}


def executor_kwargs(test_type, server_config, cache_manager, **kwargs):
Expand All @@ -44,13 +43,11 @@ def env_options():


class ServoBrowser(NullBrowser):
def __init__(self, logger, binary, debug_info=None, interactive=False):
def __init__(self, logger, binary, debug_info=None):
NullBrowser.__init__(self, logger)
self.binary = binary
self.debug_info = debug_info
self.interactive = interactive

def executor_browser(self):
return ExecutorBrowser, {"binary": self.binary,
"debug_info": self.debug_info,
"interactive": self.interactive}
"debug_info": self.debug_info}
24 changes: 15 additions & 9 deletions wptrunner/executors/executorservo.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
testharness_result_converter,
reftest_result_converter)
from .process import ProcessTestExecutor
from ..executors.base import browser_command
from ..browsers.base import browser_command

hosts_text = """127.0.0.1 web-platform.test
127.0.0.1 www.web-platform.test
Expand Down Expand Up @@ -75,29 +75,35 @@ def do_test(self, test):
env = os.environ.copy()
env["HOST_FILE"] = self.hosts_path

self.proc = ProcessHandler(self.command,
processOutputLine=[self.on_output],
onFinish=self.on_finish,
env=env)

try:

if not self.interactive:
self.proc = ProcessHandler(self.command,
processOutputLine=[self.on_output],
onFinish=self.on_finish,
env=env,
storeOutput=False)
self.proc.run()
else:
self.proc = subprocess.Popen(self.command, env=env)

try:
timeout = test.timeout * self.timeout_multiplier

# Now wait to get the output we expect, or until we reach the timeout
if self.debug_info is None and not self.pause_after_test:
if not self.interactive and not self.pause_after_test:
wait_timeout = timeout + 5
self.result_flag.wait(wait_timeout)
else:
wait_timeout = None
self.result_flag.wait(wait_timeout)
self.proc.wait()

proc_is_running = True
if self.result_flag.is_set() and self.result_data is not None:
self.result_data["test"] = test.url
result = self.convert_result(test, self.result_data)
else:
if self.proc.proc.poll() is not None:
if self.proc.poll() is not None:
result = (test.result_cls("CRASH", None), [])
proc_is_running = False
else:
Expand Down
3 changes: 2 additions & 1 deletion wptrunner/executors/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ class ProcessTestExecutor(TestExecutor):
def __init__(self, *args, **kwargs):
TestExecutor.__init__(self, *args, **kwargs)
self.binary = self.browser.binary
self.interactive = self.browser.interactive
self.interactive = (False if self.debug_info is None
else self.debug_info.interactive)

def setup(self, runner):
self.runner = runner
Expand Down
3 changes: 2 additions & 1 deletion wptrunner/wptcommandline.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,8 @@ def check_args(kwargs):
debug_info = mozdebug.get_debugger_info(kwargs["debugger"],
kwargs["debugger_args"])
if debug_info.interactive:
require_arg(kwargs, "processes", lambda x: x == 1)
if kwargs["processes"] != 1:
kwargs["processes"] = 1
kwargs["no_capture_stdio"] = True
kwargs["debug_info"] = debug_info
else:
Expand Down

0 comments on commit 036c993

Please sign in to comment.