Bug 141365

Summary: [iOS] run-webkit-tests fails due to simulator devices from previous SDK installs being marked as unavailable
Product: WebKit Reporter: David Kilzer (:ddkilzer) <ddkilzer>
Component: Tools / TestsAssignee: David Kilzer (:ddkilzer) <ddkilzer>
Status: RESOLVED FIXED    
Severity: Normal CC: ap, commit-queue, darin, dbates, ddkilzer, glenn, jake.nielsen.webkit
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on: 141358    
Bug Blocks:    
Attachments:
Description Flags
Patch v1 none

Description David Kilzer (:ddkilzer) 2015-02-07 16:22:31 PST
run-webkit-tests fails due to simulator devices from previous SDK installs being marked as unavailable:

RuntimeError raised: Expected an iOS Simulator device line, got "-- Unavailable: com.apple.CoreSimulator.SimRuntime.iOS-8-0 --"
Traceback (most recent call last):
  File "/Volumes/Data/WebKit.git/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py", line 80, in main
    run_details = run(port, options, args, stderr)
  File "/Volumes/Data/WebKit.git/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py", line 417, in run
    _set_up_derived_options(port, options)
  File "/Volumes/Data/WebKit.git/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py", line 397, in _set_up_derived_options
    options.runtime = xcode.simulator.Simulator().latest_available_runtime
  File "/Volumes/Data/WebKit.git/Tools/Scripts/webkitpy/xcode/simulator.py", line 229, in __init__
    self.refresh()
  File "/Volumes/Data/WebKit.git/Tools/Scripts/webkitpy/xcode/simulator.py", line 246, in refresh
    self._parse_device_types(lines)
  File "/Volumes/Data/WebKit.git/Tools/Scripts/webkitpy/xcode/simulator.py", line 265, in _parse_device_types
    self._parse_runtimes(lines)
  File "/Volumes/Data/WebKit.git/Tools/Scripts/webkitpy/xcode/simulator.py", line 286, in _parse_runtimes
    self._parse_devices(lines)
  File "/Volumes/Data/WebKit.git/Tools/Scripts/webkitpy/xcode/simulator.py", line 305, in _parse_devices
    raise RuntimeError('Expected an iOS Simulator device line, got "{}"'.format(line))
RuntimeError: Expected an iOS Simulator device line, got "-- Unavailable: com.apple.CoreSimulator.SimRuntime.iOS-8-0 --"
Comment 1 David Kilzer (:ddkilzer) 2015-02-07 16:22:53 PST
<rdar://problem/19636406>
Comment 2 David Kilzer (:ddkilzer) 2015-02-07 16:53:36 PST
Created attachment 246227 [details]
Patch v1
Comment 3 Daniel Bates 2015-02-07 17:13:17 PST
Comment on attachment 246227 [details]
Patch v1

This patch is OK as-is. As remarked in a comment above class Simulator in this file, we may want consider parsing the device.plist files instead of parsing the simctl output, which seems more likely to change.
Comment 4 Daniel Bates 2015-02-07 17:16:29 PST
Comment on attachment 246227 [details]
Patch v1

View in context: https://bugs.webkit.org/attachment.cgi?id=246227&action=review

> Tools/Scripts/webkitpy/xcode/simulator_unittest.py:230
> +        self.assertEqual('com.apple.CoreSimulator.SimRuntime.iOS-8-0', runtime_ios_8.identifier)
> +        self.assertEqual(True, runtime_ios_8.available)
> +        self.assertEqual(False, runtime_ios_8.is_internal_runtime)
> +        self.assertEqual(tuple([8, 0]), runtime_ios_8.version)
> +        self.assertEqual(1, len(runtime_ios_8.devices))

I wish there was a better way to write this. One idea is to take advantage of Runtime's equality operator __eq__, construct a expected Runtime object and then perform self.assertEqual(expected_runtime, runtime_ios_8). We may want to add logic to Runtime.__eq__ to support checking the Runtime.is_internal_runtime, or even Runtime.available.
Comment 5 WebKit Commit Bot 2015-02-07 19:26:57 PST
Comment on attachment 246227 [details]
Patch v1

Clearing flags on attachment: 246227

Committed r179793: <http://trac.webkit.org/changeset/179793>
Comment 6 WebKit Commit Bot 2015-02-07 19:27:01 PST
All reviewed patches have been landed.  Closing bug.