servo: Merge #9607 - Add a "mach test-wpt --chaos" mode for reproducing intermittent failures using rr (from mbrubeck:chaos); r=jgraham

This adds a new `--chaos` flag to the `test-wpt` and `test-css` commands.  This will run a test repeatedly until it fails, recording it with the rr debugger in chaos mode. Requires a recent master build of rr.

```
./mach test-wpt --chaos test.html
```
is shorthand for:
```
./mach test-wpt --repeat-until-unexpected \
                --debugger rr \
                --debugger-args "record --chaos" \
                --include test.html
```
This PR currently includes changes to wptrunner which were also submitted upstream as w3c/wptrunner#170.  We should not merge this until that upstream PR is merged. CC @jgraham

Source-Repo: https://github.com/servo/servo
Source-Revision: faa349fb876c4b163ba14623899c9f4e6ab3d0eb
This commit is contained in:
Matt Brubeck 2016-02-12 03:05:47 +05:01
Родитель e0ee460aad
Коммит 65c73bf899
1 изменённых файлов: 16 добавлений и 12 удалений

Просмотреть файл

@ -41,6 +41,8 @@ def create_parser_wpt():
parser = wptcommandline.create_parser()
parser.add_argument('--release', default=False, action="store_true",
help="Run with a release build of servo")
parser.add_argument('--chaos', default=False, action="store_true",
help="Run under chaos mode in rr until a failure is captured")
return parser
@ -332,19 +334,24 @@ class MachCommands(CommandBase):
@Command('test-wpt',
description='Run the web platform tests',
category='testing',
parser=wptcommandline.create_parser)
@CommandArgument('--release', default=False, action="store_true",
help="Run with a release build of servo")
parser=create_parser_wpt)
def test_wpt(self, **kwargs):
self.ensure_bootstrapped()
hosts_file_path = path.join(self.context.topdir, 'tests', 'wpt', 'hosts')
os.environ["hosts_file_path"] = hosts_file_path
os.environ["RUST_BACKTRACE"] = "1"
kwargs["debug"] = not kwargs["release"]
run_file = path.abspath(path.join(self.context.topdir, "tests", "wpt", "run_wpt.py"))
return self.wptrunner(run_file, **kwargs)
# Helper for test_css and test_wpt:
def wptrunner(self, run_file, **kwargs):
os.environ["RUST_BACKTRACE"] = "1"
kwargs["debug"] = not kwargs["release"]
if kwargs.pop("chaos"):
kwargs["debugger"] = "rr"
kwargs["debugger_args"] = "record --chaos"
kwargs["repeat_until_unexpected"] = True
# TODO: Delete rr traces from green test runs?
run_globals = {"__file__": run_file}
execfile(run_file, run_globals)
return run_globals["run_tests"](**kwargs)
@ -398,11 +405,8 @@ class MachCommands(CommandBase):
parser=create_parser_wpt)
def test_css(self, **kwargs):
self.ensure_bootstrapped()
run_file = path.abspath(path.join("tests", "wpt", "run_css.py"))
run_globals = {"__file__": run_file}
execfile(run_file, run_globals)
return run_globals["run_tests"](**kwargs)
return self.wptrunner(run_file, **kwargs)
@Command('update-css',
description='Update the web platform tests',