Skip to content

Commit

Permalink
De-associate the headful mode with debugging
Browse files Browse the repository at this point in the history
As we are planning to run the headful mode on CI to get performance
data, running in headful mode does not necessary mean debugging.

Add '--no-xvfb' to control if we do not want to start xvfb.

Bug: 1517496
Change-Id: Ia00b2ee0de380c2c8a835d9bce5c9eb71993f57b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5252105
Reviewed-by: Jonathan Lee <jonathanjlee@google.com>
Commit-Queue: Weizhong Xia <weizhong@google.com>
Cr-Commit-Position: refs/heads/main@{#1257627}
  • Loading branch information
WeizhongX authored and Chromium LUCI CQ committed Feb 7, 2024
1 parent 13e869e commit a53c19f
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 38 deletions.
Binary file removed docs/testing/images/web-tests/wptrunner-paused.jpg
Binary file not shown.
10 changes: 0 additions & 10 deletions docs/testing/run_web_platform_tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,16 +88,6 @@ To be updated.

## Debugging Support

### Headful Mode

Passing the `--no-headless` flag to `run_wpt_tests.py` will pause execution
after running each test headfully.
You can interact with the paused test page afterwards, including with DevTools:

![Testharness paused](images/web-tests/wptrunner-paused.jpg)

Closing the tab or window will unpause the testharness and run the next test.

### Text-Based Debuggers

To interactively debug WPTs, prefix the `run_wpt_tests.py` command with
Expand Down
21 changes: 9 additions & 12 deletions third_party/blink/tools/blinkpy/web_tests/port/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,26 +223,23 @@ def add_configuration_options_group(parser: argparse.ArgumentParser,
group.add_argument('--chrome-branded',
action='store_true',
help='Set the configuration as chrome_branded.')
group.add_argument('--no-xvfb',
action='store_false',
dest='use_xvfb',
help='Do not run tests with Xvfb')
add_common_wpt_options(group)
if rwt:
group.add_argument('--no-xvfb',
action='store_false',
dest='use_xvfb',
help='Do not run tests with Xvfb')
else:
if not rwt:
group.add_argument(
'-p',
'--product',
default='chrome',
choices=(product_choices or []),
metavar='PRODUCT',
help='Product (browser or browser component) to test.')
group.add_argument(
'--no-headless',
action='store_false',
dest='headless',
help=('Do not run the browser headlessly; pause after each test '
'until the window is closed. On Linux, do not start Xvfb.'))
group.add_argument('--no-headless',
action='store_false',
dest='headless',
help=('Do not run browser in headless mode.'))
group.add_argument('--webdriver-binary',
metavar='PATH',
type=str,
Expand Down
4 changes: 2 additions & 2 deletions third_party/blink/tools/blinkpy/wpt_tests/product.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ def product_specific_options(self):
"""Product-specific wptrunner parameters needed to run tests."""
processes = self._options.child_processes
if not processes:
if self._options.wrapper or not self._options.headless:
if self._options.wrapper:
_log.info('Defaulting to 1 worker because of debugging '
'options (`--wrapper` or `--no-headless`)')
'option `--wrapper`')
processes = 1
else:
processes = self._port.default_child_processes()
Expand Down
16 changes: 2 additions & 14 deletions third_party/blink/tools/blinkpy/wpt_tests/wpt_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,8 @@ def _set_up_runner_options(self, tmp_dir):
runner_options.no_capture_stdio = True
runner_options.manifest_download = False
runner_options.manifest_update = False
runner_options.headless = True
runner_options.pause_after_test = False
runner_options.headless = self.options.headless

# Set up logging as early as possible.
self._set_up_runner_output_options(runner_options)
Expand Down Expand Up @@ -376,15 +377,6 @@ def _set_up_runner_ssl_options(self, runner_options):
'127.0.0.1.pem')

def _set_up_runner_debugging_options(self, runner_options):
self.port.set_option_default('use_xvfb',
self.port.get_option('headless'))
if not self.options.headless:
logger.info('Not headless; default to 1 worker to avoid '
'opening too many windows')
runner_options.headless = False
# Force `--pause-after-test`, since it doesn't make sense to run
# tests headfully without giving a chance for interaction.
runner_options.pause_after_test = True
if self.options.wrapper:
runner_options.debugger = self.options.wrapper[0]
# `wpt run` expects a plain `str`, not a `List[str]`:
Expand Down Expand Up @@ -703,10 +695,6 @@ def parse_arguments(argv):
# `--no-expectations` to `run_wpt_tests.py`, and skip reporting results when
# the flag is passed.
options.no_expectations = False
# Directly tie Xvfb usage to headless mode. Xvfb can supercede a real X
# server and therefore should never be started in `--no-headless` mode.
# Conversely, the default headless mode should always start Xvfb.
options.use_xvfb = options.headless
return options, args


Expand Down

0 comments on commit a53c19f

Please sign in to comment.