Skip to content

Commit

Permalink
Auto merge of #21229 - ergunsh:merge-run-wpt, r=jdm
Browse files Browse the repository at this point in the history
Merge run_wpt.py into run.py

<!-- Please describe your changes on the following line: -->
To ensure everything is still works, one can run `./mach test-wpt tests/wpt/mozilla/DOMParser.html`

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #21201 (github issue number if applicable).

<!-- Either: -->
- [ ] There are tests for these changes OR
- [X] These changes do not require tests

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/21229)
<!-- Reviewable:end -->
  • Loading branch information
bors-servo committed Jul 22, 2018
2 parents 4997ec2 + ae20469 commit 9a21acb
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 31 deletions.
2 changes: 1 addition & 1 deletion python/servo/testing_commands.py
Expand Up @@ -385,7 +385,7 @@ def test_wpt_android(self, release=False, dev=False, binary_args=None, **kwargs)
def _test_wpt(self, **kwargs):
hosts_file_path = path.join(self.context.topdir, 'tests', 'wpt', 'hosts')
os.environ["hosts_file_path"] = hosts_file_path
run_file = path.abspath(path.join(self.context.topdir, "tests", "wpt", "run_wpt.py"))
run_file = path.abspath(path.join(self.context.topdir, "tests", "wpt", "run.py"))
return self.wptrunner(run_file, **kwargs)

# Helper to ensure all specified paths are handled, otherwise dispatch to appropriate test suite.
Expand Down
5 changes: 2 additions & 3 deletions tests/wpt/README.md
Expand Up @@ -9,8 +9,7 @@ In particular, this folder contains:

* `config.ini`: some configuration for the web-platform-tests.
* `include.ini`: the subset of web-platform-tests we currently run.
* `run_wpt.py`: glue code to run the web-platform-tests in Servo.
* `run.py`: common code used by `run_wpt.py`.
* `run.py`: run the web-platform-tests in Servo.
* `web-platform-tests`: copy of the web-platform-tests.
* `metadata`: expected failures for the web-platform-tests we run.
* `mozilla`: web-platform-tests that cannot be upstreamed.
Expand Down Expand Up @@ -49,7 +48,7 @@ test with `mach test-wpt --release`
Running the tests without mach
------------------------------

When avoiding `mach` for some reason, one can run `run_wpt.py`
When avoiding `mach` for some reason, one can run `run.py`
directly. However, this requires that all the dependencies for
`wptrunner` are avaliable in the current python environment.

Expand Down
17 changes: 10 additions & 7 deletions tests/wpt/run.py
Expand Up @@ -19,15 +19,15 @@ def wpt_path(*args):
def servo_path(*args):
return os.path.join(servo_root, *args)

paths = {"include_manifest": wpt_path("include.ini"),
"config": wpt_path("config.ini")}
# Imports
sys.path.append(wpt_path("web-platform-tests", "tools", "wptrunner"))
from wptrunner import wptrunner, wptcommandline


def run_tests(paths=None, **kwargs):
if paths is None:
paths = {}
set_defaults(paths, kwargs)
def run_tests(**kwargs):
set_defaults(kwargs)

mozlog.commandline.log_formatters["servo"] = \
(grouping_formatter.GroupingFormatter, "A grouping output formatter")
Expand All @@ -47,7 +47,7 @@ def run_tests(paths=None, **kwargs):
return 0 if success else 1


def set_defaults(paths, kwargs):
def set_defaults(kwargs):
if kwargs["product"] is None:
kwargs["product"] = "servo"

Expand Down Expand Up @@ -75,7 +75,10 @@ def set_defaults(paths, kwargs):
wptcommandline.check_args(kwargs)


def main(paths=None):
def main():
parser = wptcommandline.create_parser()
kwargs = vars(parser.parse_args())
return run_tests(paths, **kwargs)
return run_tests(**kwargs)

if __name__ == "__main__":
sys.exit(0 if main() else 1)
20 changes: 0 additions & 20 deletions tests/wpt/run_wpt.py

This file was deleted.

0 comments on commit 9a21acb

Please sign in to comment.