default to number of available cpu for wpt-tests

This commit is contained in:
Robo 2015-02-24 22:38:36 +05:30
parent bf60477e95
commit 7b9241bddb

View file

@ -16,6 +16,7 @@ from mach.decorators import (
from servo.command_base import CommandBase from servo.command_base import CommandBase
import tidy import tidy
import multiprocessing
@CommandProvider @CommandProvider
@ -217,9 +218,12 @@ class MachCommands(CommandBase):
description='Run the web platform tests', description='Run the web platform tests',
category='testing') category='testing')
@CommandArgument( @CommandArgument(
'params', default=None, nargs='...', '--processes', default=None,
help="Command-line arguments to be passed through to wpt/run.sh") help="Number of servo processes to spawn")
def test_wpt(self, params=None): @CommandArgument(
"params", default=None, nargs='...',
help="command-line arguments to be passed through to wpt/run.sh")
def test_wpt(self, processes=None, params=None):
if params is None: if params is None:
params = [] params = []
else: else:
@ -230,7 +234,10 @@ class MachCommands(CommandBase):
if path.exists(maybe_path) and wpt_path in maybe_path: if path.exists(maybe_path) and wpt_path in maybe_path:
params = ["--include", params = ["--include",
path.relpath(maybe_path, wpt_path)] + params[1:] path.relpath(maybe_path, wpt_path)]
processes = str(multiprocessing.cpu_count()) if processes is None else processes
params = params + ["--processes", processes]
return subprocess.call( return subprocess.call(
["bash", path.join("tests", "wpt", "run.sh")] + params, ["bash", path.join("tests", "wpt", "run.sh")] + params,