Bug 176962 - webkitpy: Provide accessor for device type
Summary: webkitpy: Provide accessor for device type
Status: RESOLVED CONFIGURATION CHANGED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Jonathan Bedard
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2017-09-14 15:35 PDT by Jonathan Bedard
Modified: 2018-03-27 16:40 PDT (History)
5 users (show)

See Also:


Attachments
Patch (7.31 KB, patch)
2017-09-14 15:37 PDT, Jonathan Bedard
no flags Details | Formatted Diff | Diff
Patch (2.76 KB, patch)
2017-09-18 11:00 PDT, Jonathan Bedard
no flags Details | Formatted Diff | Diff
Patch (2.76 KB, patch)
2017-09-18 11:07 PDT, Jonathan Bedard
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Bedard 2017-09-14 15:35:01 PDT
Provide a function to ask a device what type it is.  The device type will be of the form 'iPhone 5s' or 'iPad Air.'  For simulator, this device type will be derivative of the device name.  For example, 'iPhone 5s WebKit Tester 1' has a device type of 'iPhone 5s'.
Comment 1 Radar WebKit Bug Importer 2017-09-14 15:35:43 PDT
<rdar://problem/34444987>
Comment 2 Jonathan Bedard 2017-09-14 15:37:52 PDT
Created attachment 320836 [details]
Patch
Comment 3 Daniel Bates 2017-09-18 09:57:56 PDT
Comment on attachment 320836 [details]
Patch

This patch assumes the convention that the name of the simulator will contain the name of the device. This is a convention. The name of a simulator device is arbitrary; => we should not parse the device name to determine the device type it corresponds to. Moreover, we do not have to resort to such manipulation. The command "simctl list" prints the list of device types under the "== Device Types ==" section and the parsing code in simulator.py knows how to parse this section. We need to teach the parsing code to pass the human readable name corresponding to the device type when instantiating a SimulatedDevice object.
Comment 4 Jonathan Bedard 2017-09-18 10:22:23 PDT
(In reply to Daniel Bates from comment #3)
> Comment on attachment 320836 [details]
> Patch
> 
> This patch assumes the convention that the name of the simulator will
> contain the name of the device. This is a convention. The name of a
> simulator device is arbitrary; => we should not parse the device name to
> determine the device type it corresponds to. Moreover, we do not have to
> resort to such manipulation. The command "simctl list" prints the list of
> device types under the "== Device Types ==" section and the parsing code in
> simulator.py knows how to parse this section. We need to teach the parsing
> code to pass the human readable name corresponding to the device type when
> instantiating a SimulatedDevice object.

We need a map of device UDIDs to device types.  The 'device types' section only provides a mapping of device type to simulator runtime type.

I discovered this morning that this information is stored in the device.plist, which seems like the best place to retrieve this information from, I will update this patch.
Comment 5 Jonathan Bedard 2017-09-18 11:00:58 PDT
Created attachment 321110 [details]
Patch
Comment 6 Jonathan Bedard 2017-09-18 11:07:32 PDT
Created attachment 321111 [details]
Patch
Comment 7 Jonathan Bedard 2017-09-18 11:07:56 PDT
(In reply to Jonathan Bedard from comment #6)
> Created attachment 321111 [details]
> Patch

Looking for deviceType, not runtime.
Comment 8 Daniel Bates 2017-09-18 12:33:49 PDT
Would it be sufficient to be able to track the device type of devices we (webkitpy/webkitperl) created? Or do we need to be able to compute the device type for an arbitrary simulator device?
Comment 9 Jonathan Bedard 2017-09-18 12:45:04 PDT
(In reply to Daniel Bates from comment #8)
> Would it be sufficient to be able to track the device type of devices we
> (webkitpy/webkitperl) created? Or do we need to be able to compute the
> device type for an arbitrary simulator device?

We support running on the currently running simulator (meaning webkitpy isn't managing the device), so we do need to be able to compute the device type for an arbitrary simulator.

I memoized the function so that we only do the computation once.
Comment 10 Jonathan Bedard 2018-03-27 16:40:57 PDT
This was addressed when we shifted to the new simulator manager class <https://bugs.webkit.org/show_bug.cgi?id=180555>.