mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
Make the test-wpt mach command support all the command line arguments of wptrunner.
Also remove the shell script and ensure that default options are set in a single location
This commit is contained in:
parent
0a7429f147
commit
2bde318d24
7 changed files with 162 additions and 77 deletions
|
@ -2,34 +2,54 @@
|
|||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
import sys, os, argparse
|
||||
import argparse
|
||||
import multiprocessing
|
||||
import os
|
||||
import sys
|
||||
|
||||
here = os.path.split(__file__)[0]
|
||||
servo_root = os.path.abspath(os.path.join(here, "..", ".."))
|
||||
|
||||
def wptsubdir(*args):
|
||||
def wpt_path(*args):
|
||||
return os.path.join(here, *args)
|
||||
|
||||
def servo_path(*args):
|
||||
return os.path.join(servo_root, *args)
|
||||
|
||||
# Imports
|
||||
sys.path.append(wptsubdir("web-platform-tests"))
|
||||
sys.path.append(wpt_path("harness"))
|
||||
from wptrunner import wptrunner, wptcommandline
|
||||
|
||||
def run_tests(**kwargs):
|
||||
wptrunner.setup_logging(kwargs, {"raw": sys.stdout})
|
||||
def run_tests(paths=None, **kwargs):
|
||||
if paths is None:
|
||||
paths = {}
|
||||
set_defaults(paths, kwargs)
|
||||
wptrunner.setup_logging(kwargs, {"mach": sys.stdout})
|
||||
return wptrunner.run_tests(**kwargs)
|
||||
|
||||
def set_defaults(args):
|
||||
args.include_manifest = args.include_manifest if args.include_manifest else wptsubdir("include.ini")
|
||||
args.product = "servo"
|
||||
rv = vars(args)
|
||||
wptcommandline.check_args(rv)
|
||||
return rv
|
||||
def set_defaults(paths, kwargs):
|
||||
if kwargs["product"] is None:
|
||||
kwargs["product"] = "servo"
|
||||
|
||||
def main():
|
||||
if kwargs["config"] is None and "config" in paths:
|
||||
kwargs["config"] = paths["config"]
|
||||
|
||||
if kwargs["include_manifest"] is None and "include_manifest" in paths:
|
||||
kwargs["include_manifest"] = paths["include_manifest"]
|
||||
|
||||
if kwargs["binary"] is None:
|
||||
bin_dir = "release" if kwargs["release"] else "debug"
|
||||
bin_path = servo_path("components", "servo", "target", bin_dir, "servo")
|
||||
|
||||
kwargs["binary"] = bin_path
|
||||
|
||||
if kwargs["processes"] is None:
|
||||
kwargs["processes"] = multiprocessing.cpu_count()
|
||||
|
||||
wptcommandline.check_args(kwargs)
|
||||
|
||||
def main(paths=None):
|
||||
parser = wptcommandline.create_parser()
|
||||
args = parser.parse_args()
|
||||
kwargs = set_defaults(args)
|
||||
return run_tests(**kwargs)
|
||||
kwargs = vars(parser.parse_args())
|
||||
return run_tests(paths, **kwargs)
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(0 if main() else 1)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue