Changeset 179788 in webkit
- Timestamp:
- Feb 7, 2015 4:44:06 PM (9 years ago)
- Location:
- trunk/Tools
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r179778 r179788 1 2015-02-07 David Kilzer <ddkilzer@apple.com> 2 3 [iOS] Make Simulator class testable 4 <http://webkit.org/b/141358> 5 6 Rubber-stamped by Darin Adler. 7 8 * Scripts/webkitpy/common/system/platforminfo.py: 9 (PlatformInfo.xcode_simctl_list): Move `xcrun simctl list` 10 command to here from Simulator.refresh() in xcode/simulator.py 11 so that the output of the command can be mocked. 12 13 * Scripts/webkitpy/common/system/platforminfo_mock.py: 14 (MockPlatformInfo.__init__): Set self.expected_xcode_simctl_list 15 to None. 16 (MockPlatformInfo.xcode_simctl_list): Add method that returns 17 self.expected_xcode_simctl_list expectation. 18 19 * Scripts/webkitpy/xcode/simulator.py: Add missing copyright 20 and license header. 21 (Simulator.__init__): Add optional 'host' parameter to make it 22 possible to pass in a mock object for testing. Set self._host 23 to 'host' parameter or create Host() object. 24 (Simulator.refresh): Call new PlatformInfo.xcode_simctl_list() 25 method. 26 27 * Scripts/webkitpy/xcode/simulator_unittest.py: Add unit test 28 for current code. 29 (SimulatorTest): 30 (SimulatorTest.setUp): 31 (SimulatorTest._set_expected_xcrun_simctl_list): 32 (SimulatorTest.test_simulator_device_types): 33 (test_invalid_device_types_header): 34 (test_invalid_runtimes_header): 35 (test_invalid_devices_header): 36 1 37 2015-02-07 Csaba Osztrogonác <ossy@webkit.org> 2 38 -
trunk/Tools/Scripts/webkitpy/common/system/platforminfo.py
r179622 r179788 126 126 return '' 127 127 128 def xcode_simctl_list(self): 129 if not self.is_mac(): 130 return () 131 output = self._executive.run_command(['xcrun', 'simctl', 'list'], return_stderr=False) 132 return (line for line in output.splitlines()) 133 128 134 def _determine_os_name(self, sys_platform): 129 135 if sys_platform == 'darwin': -
trunk/Tools/Scripts/webkitpy/common/system/platforminfo_mock.py
r179622 r179788 32 32 self.os_name = os_name 33 33 self.os_version = os_version 34 self.expected_xcode_simctl_list = None 34 35 35 36 def is_mac(self): … … 59 60 def xcode_sdk_version(self, sdk_name): 60 61 return '8.1' 62 63 def xcode_simctl_list(self): 64 return self.expected_xcode_simctl_list -
trunk/Tools/Scripts/webkitpy/xcode/simulator.py
r179716 r179788 1 # Copyright (C) 2014, 2015 Apple Inc. All rights reserved. 2 # 3 # Redistribution and use in source and binary forms, with or without 4 # modification, are permitted provided that the following conditions 5 # are met: 6 # 1. Redistributions of source code must retain the above copyright 7 # notice, this list of conditions and the following disclaimer. 8 # 2. Redistributions in binary form must reproduce the above copyright 9 # notice, this list of conditions and the following disclaimer in the 10 # documentation and/or other materials provided with the distribution. 11 # 12 # THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY 13 # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 14 # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 15 # DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY 16 # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 17 # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 18 # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 19 # ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 20 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 21 # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 22 1 23 import itertools 2 24 import logging … … 6 28 import subprocess 7 29 import time 30 31 from webkitpy.common.host import Host 8 32 9 33 _log = logging.getLogger(__name__) … … 217 241 '\s*(?P<name>[^(]+ )\((?P<udid>[^)]+)\) \((?P<state>[^)]+)\)( \((?P<availability>[^)]+)\))?') 218 242 219 def __init__(self): 243 def __init__(self, host=None): 244 self._host = host or Host() 220 245 self.runtimes = [] 221 246 self.device_types = [] … … 252 277 Refresh runtime and device type information from ``simctl list``. 253 278 """ 254 command = ['xcrun', 'simctl', 'list'] 255 simctl_p = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE) 256 stdout, stderr = simctl_p.communicate() 257 if simctl_p.returncode != 0: 258 raise RuntimeError( 259 '{command} failed:\n{stdout}\n{stderr}'.format(command=' '.join(command), stdout=stdout, stderr=stderr)) 260 261 lines = (line for line in stdout.splitlines()) 279 lines = self._host.platform.xcode_simctl_list() 262 280 device_types_header = next(lines) 263 281 if device_types_header != '== Device Types ==':
Note: See TracChangeset
for help on using the changeset viewer.