Title: [136510] trunk/Tools
Revision
136510
Author
pe...@chromium.org
Date
2012-12-04 08:25:22 -0800 (Tue, 04 Dec 2012)

Log Message

[Chromium] The ChromiumAndroidDriver constructor should not rely on adb being available
https://bugs.webkit.org/show_bug.cgi?id=103758

Reviewed by Eric Seidel.

Lazily initialize the adb command parameters rather than initializing it in the
constructor now that there is an assert if adb is not available on the system and
we're not in a Chromium Android checkout.

* Scripts/webkitpy/layout_tests/port/chromium_android.py:
(ChromiumAndroidDriver.__init__):
(ChromiumAndroidDriver._push_file_if_needed):
(ChromiumAndroidDriver._run_adb_command):
(ChromiumAndroidDriver.cmd_line):
(ChromiumAndroidDriver._start_once):
(ChromiumAndroidDriver._read_prompt):
(ChromiumAndroidDriver):
(ChromiumAndroidDriver._adb_command):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (136509 => 136510)


--- trunk/Tools/ChangeLog	2012-12-04 15:41:44 UTC (rev 136509)
+++ trunk/Tools/ChangeLog	2012-12-04 16:25:22 UTC (rev 136510)
@@ -1,3 +1,24 @@
+2012-12-04  Peter Beverloo  <pe...@chromium.org>
+
+        [Chromium] The ChromiumAndroidDriver constructor should not rely on adb being available
+        https://bugs.webkit.org/show_bug.cgi?id=103758
+
+        Reviewed by Eric Seidel.
+
+        Lazily initialize the adb command parameters rather than initializing it in the
+        constructor now that there is an assert if adb is not available on the system and
+        we're not in a Chromium Android checkout.
+
+        * Scripts/webkitpy/layout_tests/port/chromium_android.py:
+        (ChromiumAndroidDriver.__init__):
+        (ChromiumAndroidDriver._push_file_if_needed):
+        (ChromiumAndroidDriver._run_adb_command):
+        (ChromiumAndroidDriver.cmd_line):
+        (ChromiumAndroidDriver._start_once):
+        (ChromiumAndroidDriver._read_prompt):
+        (ChromiumAndroidDriver):
+        (ChromiumAndroidDriver._adb_command):
+
 2012-12-03  Ryosuke Niwa  <rn...@webkit.org>
 
         Dromaeo should report individual test result

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium_android.py (136509 => 136510)


--- trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium_android.py	2012-12-04 15:41:44 UTC (rev 136509)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium_android.py	2012-12-04 16:25:22 UTC (rev 136510)
@@ -371,7 +371,7 @@
         self._has_setup = False
         self._original_governors = {}
         self._device_serial = port._get_device_serial(worker_number)
-        self._adb_command = [port.path_to_adb(), '-s', self._device_serial]
+        self._adb_command_base = None
 
     def __del__(self):
         self._teardown_performance()
@@ -426,7 +426,7 @@
     def _push_file_if_needed(self, host_file, device_file):
         assert os.path.exists(host_file)
         device_hashes = self._extract_hashes_from_md5sum_output(
-                self._port.host.executive.popen(self._adb_command + ['shell', MD5SUM_DEVICE_PATH, device_file],
+                self._port.host.executive.popen(self._adb_command() + ['shell', MD5SUM_DEVICE_PATH, device_file],
                                                 stdout=subprocess.PIPE).stdout)
         host_hashes = self._extract_hashes_from_md5sum_output(
                 self._port.host.executive.popen(args=['%s_host' % self._md5sum_path, host_file],
@@ -478,7 +478,7 @@
             error_handler = self._port._executive.ignore_error
         else:
             error_handler = None
-        result = self._port._executive.run_command(self._adb_command + cmd, error_handler=error_handler)
+        result = self._port._executive.run_command(self._adb_command() + cmd, error_handler=error_handler)
         # Limit the length to avoid too verbose output of commands like 'adb logcat' and 'cat /data/tombstones/tombstone01'
         # whose outputs are normally printed in later logs.
         self._log_debug('Run adb result: ' + result[:80])
@@ -548,7 +548,7 @@
     def cmd_line(self, pixel_tests, per_test_args):
         # The returned command line is used to start _server_process. In our case, it's an interactive 'adb shell'.
         # The command line passed to the DRT process is returned by _drt_cmd_line() instead.
-        return self._adb_command + ['shell']
+        return self._adb_command() + ['shell']
 
     def _file_exists_on_device(self, full_file_path):
         assert full_file_path.startswith('/')
@@ -611,7 +611,7 @@
 
         self._log_debug('Starting forwarder')
         self._forwarder_process = self._port._server_process_constructor(
-            self._port, 'Forwarder', self._adb_command + ['shell', '%s -D %s' % (DEVICE_FORWARDER_PATH, FORWARD_PORTS)])
+            self._port, 'Forwarder', self._adb_command() + ['shell', '%s -D %s' % (DEVICE_FORWARDER_PATH, FORWARD_PORTS)])
         self._forwarder_process.start()
 
         self._run_adb_command(['logcat', '-c'])
@@ -633,13 +633,13 @@
         # Start a process to read from the stdout fifo of the DumpRenderTree app and print to stdout.
         self._log_debug('Redirecting stdout to ' + self._out_fifo_path)
         self._read_stdout_process = self._port._server_process_constructor(
-            self._port, 'ReadStdout', self._adb_command + ['shell', 'cat', self._out_fifo_path])
+            self._port, 'ReadStdout', self._adb_command() + ['shell', 'cat', self._out_fifo_path])
         self._read_stdout_process.start()
 
         # Start a process to read from the stderr fifo of the DumpRenderTree app and print to stdout.
         self._log_debug('Redirecting stderr to ' + self._err_fifo_path)
         self._read_stderr_process = self._port._server_process_constructor(
-            self._port, 'ReadStderr', self._adb_command + ['shell', 'cat', self._err_fifo_path])
+            self._port, 'ReadStderr', self._adb_command() + ['shell', 'cat', self._err_fifo_path])
         self._read_stderr_process.start()
 
         self._log_debug('Redirecting stdin to ' + self._in_fifo_path)
@@ -717,3 +717,8 @@
                 if last_char in ('#', '$'):
                     return
             last_char = current_char
+
+    def _adb_command(self):
+        if not self._adb_command_base:
+            self._adb_command_base = [self._port.path_to_adb(), '-s', self._device_serial]
+        return self._adb_command_base
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to