Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Make it possible to run performance tests on Chromium Android

https://bugs.webkit.org/show_bug.cgi?id=103268

Reviewed by Ryosuke Niwa.

Based on a patch by Peter Beverloo.

This patch (almost) makes it possible to run WebKit performance tests
on the Chromium port for Android. There are a few things I had to do
in order to make this happen:

1) The worker number when creating a driver for a port is zero-based
   for layout tests and elsewhere. Android uses this to determine
   which device it has to run on, so make it zero based for performance
   tests as well.

2) Tests aren't available on the Android device, so we start an HTTP
   server that serves the tests to the device or emulator.

The one shortcoming of this patch is that chromium-android produces
some stderr output that confuses run-perf-tests. I'll address that
issue in a subsequent CL. This patch also depends on
https://codereview.chromium.org/11416182 in order to work.

* Scripts/webkitpy/layout_tests/port/chromium_android.py:
(ChromiumAndroidPort.start_http_server):
(ChromiumAndroidDriver._command_from_driver_input):
* Scripts/webkitpy/performance_tests/perftest.py:
(ReplayPerfTest.prepare):
* Scripts/webkitpy/performance_tests/perftestsrunner.py:
(PerfTestsRunner.__init__):
(PerfTestsRunner._parse_args):
(PerfTestsRunner._start_servers):
(PerfTestsRunner):
(PerfTestsRunner._stop_servers):
(PerfTestsRunner.run):
(PerfTestsRunner._run_tests_set):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@135930 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information...
commit 044126629b2e175119722f58a0098220e0aa0b33 1 parent 776956b
abarth@webkit.org authored
40 Tools/ChangeLog
View
@@ -1,3 +1,43 @@
+2012-11-27 Adam Barth <abarth@webkit.org>
+
+ Make it possible to run performance tests on Chromium Android
+ https://bugs.webkit.org/show_bug.cgi?id=103268
+
+ Reviewed by Ryosuke Niwa.
+
+ Based on a patch by Peter Beverloo.
+
+ This patch (almost) makes it possible to run WebKit performance tests
+ on the Chromium port for Android. There are a few things I had to do
+ in order to make this happen:
+
+ 1) The worker number when creating a driver for a port is zero-based
+ for layout tests and elsewhere. Android uses this to determine
+ which device it has to run on, so make it zero based for performance
+ tests as well.
+
+ 2) Tests aren't available on the Android device, so we start an HTTP
+ server that serves the tests to the device or emulator.
+
+ The one shortcoming of this patch is that chromium-android produces
+ some stderr output that confuses run-perf-tests. I'll address that
+ issue in a subsequent CL. This patch also depends on
+ https://codereview.chromium.org/11416182 in order to work.
+
+ * Scripts/webkitpy/layout_tests/port/chromium_android.py:
+ (ChromiumAndroidPort.start_http_server):
+ (ChromiumAndroidDriver._command_from_driver_input):
+ * Scripts/webkitpy/performance_tests/perftest.py:
+ (ReplayPerfTest.prepare):
+ * Scripts/webkitpy/performance_tests/perftestsrunner.py:
+ (PerfTestsRunner.__init__):
+ (PerfTestsRunner._parse_args):
+ (PerfTestsRunner._start_servers):
+ (PerfTestsRunner):
+ (PerfTestsRunner._stop_servers):
+ (PerfTestsRunner.run):
+ (PerfTestsRunner._run_tests_set):
+
2012-11-27 Zan Dobersek <zandobersek@gmail.com>
Remove use of deprecated logging from webkitpy.common and webkitpy.layout_tests
16 Tools/Scripts/webkitpy/layout_tests/port/chromium_android.py
View
@@ -68,7 +68,9 @@
# All the test cases are still served to DumpRenderTree through file protocol,
# but we use a file-to-http feature to bridge the file request to host's http
# server to get the real test files and corresponding resources.
-TEST_PATH_PREFIX = '/all-tests'
+# See webkit/support/platform_support_android.cc for the other side of this bridge.
+PERF_TEST_PATH_PREFIX = '/all-perf-tests'
+LAYOUT_TEST_PATH_PREFIX = '/all-tests'
# All ports the Android forwarder to forward.
# 8000, 8080 and 8443 are for http/https tests.
@@ -129,7 +131,8 @@
# 1. as a virtual path in file urls that will be bridged to HTTP.
# 2. pointing to some files that are pushed to the device for tests that
# don't work on file-over-http (e.g. blob protocol tests).
-DEVICE_LAYOUT_TESTS_DIR = DEVICE_SOURCE_ROOT_DIR + 'third_party/WebKit/LayoutTests/'
+DEVICE_WEBKIT_BASE_DIR = DEVICE_SOURCE_ROOT_DIR + 'third_party/WebKit/'
+DEVICE_LAYOUT_TESTS_DIR = DEVICE_WEBKIT_BASE_DIR + 'LayoutTests/'
# Test resources that need to be accessed as files directly.
# Each item can be the relative path of a directory or a file.
@@ -242,7 +245,8 @@ def requires_http_server(self):
def start_http_server(self, additional_dirs=None, number_of_servers=0):
if not additional_dirs:
additional_dirs = {}
- additional_dirs[TEST_PATH_PREFIX] = self.layout_tests_dir()
+ additional_dirs[PERF_TEST_PATH_PREFIX] = self.perf_tests_dir()
+ additional_dirs[LAYOUT_TEST_PATH_PREFIX] = self.layout_tests_dir()
super(ChromiumAndroidPort, self).start_http_server(additional_dirs, number_of_servers)
def create_driver(self, worker_number, no_timeout=False):
@@ -665,10 +669,10 @@ def stop(self):
def _command_from_driver_input(self, driver_input):
command = super(ChromiumAndroidDriver, self)._command_from_driver_input(driver_input)
if command.startswith('/'):
- # Convert the host file path to a device file path. See comment of
- # DEVICE_LAYOUT_TESTS_DIR for details.
+ fs = self._port._filesystem
# FIXME: what happens if command lies outside of the layout_tests_dir on the host?
- command = DEVICE_LAYOUT_TESTS_DIR + self._port.relative_test_filename(command)
+ relative_test_filename = fs.relpath(command, fs.dirname(self._port.layout_tests_dir()))
+ command = DEVICE_WEBKIT_BASE_DIR + relative_test_filename
return command
def _read_prompt(self, deadline):
2  Tools/Scripts/webkitpy/performance_tests/perftest.py
View
@@ -327,7 +327,7 @@ def prepare(self, time_out_ms):
_log.info("Preparing replay for %s" % self.test_name())
- driver = self._port.create_driver(worker_number=1, no_timeout=True)
+ driver = self._port.create_driver(worker_number=0, no_timeout=True)
try:
output = self.run_single(driver, self._archive_path, time_out_ms, record=True)
finally:
29 Tools/Scripts/webkitpy/performance_tests/perftestsrunner.py
View
@@ -68,6 +68,8 @@ def __init__(self, args=None, port=None):
self._base_path = self._port.perf_tests_dir()
self._results = {}
self._timestamp = time.time()
+ self._needs_http = None
+ self._has_http_lock = False
@staticmethod
def _parse_args(args=None):
@@ -83,6 +85,8 @@ def _expand_path(option, opt_str, value, parser):
help="Specify port/platform being tested (i.e. chromium-mac)"),
optparse.make_option("--chromium",
action="store_const", const='chromium', dest='platform', help='Alias for --platform=chromium'),
+ optparse.make_option("--chromium-android",
+ action="store_const", const='chromium-android', dest='platform', help='Alias for --platform=chromium-android'),
optparse.make_option("--builder-name",
help=("The name of the builder shown on the waterfall running this script e.g. google-mac-2.")),
optparse.make_option("--build-number",
@@ -151,8 +155,21 @@ def _is_test_file(filesystem, dirname, filename):
return tests
+ def _start_servers(self):
+ if self._needs_http:
+ self._port.acquire_http_lock()
+ self._port.start_http_server(number_of_servers=2)
+ self._has_http_lock = True
+
+ def _stop_servers(self):
+ if self._has_http_lock:
+ self._port.stop_http_server()
+ self._port.release_http_lock()
+
def run(self):
- if not self._port.check_build(needs_http=False):
+ self._needs_http = self._port.requires_http_server()
+
+ if not self._port.check_build(needs_http=self._needs_http):
_log.error("Build not up to date for %s" % self._port._path_to_driver())
return self.EXIT_CODE_BAD_BUILD
@@ -163,7 +180,13 @@ def run(self):
if not test.prepare(self._options.time_out_ms):
return self.EXIT_CODE_BAD_PREPARATION
- unexpected = self._run_tests_set(sorted(list(tests), key=lambda test: test.test_name()), self._port)
+ try:
+ self._start_servers()
+ unexpected = self._run_tests_set(sorted(list(tests), key=lambda test: test.test_name()), self._port)
+
+ finally:
+ self._stop_servers()
+
if self._options.generate_results:
exit_code = self._generate_and_show_results()
if exit_code:
@@ -290,7 +313,7 @@ def _run_tests_set(self, tests, port):
driver = None
for test in tests:
- driver = port.create_driver(worker_number=1, no_timeout=True)
+ driver = port.create_driver(worker_number=0, no_timeout=True)
if self._options.pause_before_testing:
driver.start()
Please sign in to comment.
Something went wrong with that request. Please try again.