Bug 136895

Summary: [iOS] run-webkit-tests should support minor versions under devices and create a testing device under the right runtime
Product: WebKit Reporter: David Farler <dfarler>
Component: Tools / TestsAssignee: David Farler <dfarler>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, dbates, ddkilzer, glenn, simon.fraser
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: iPhone / iPad   
OS: All   
Attachments:
Description Flags
Patch
none
Patch ddkilzer: review+

Description David Farler 2014-09-17 13:56:21 PDT
When trying to match up with the desired testing device, there can be more than one match by name under the == Devices == if more than one simulator SDK is installed inside an Xcode.app bundle, which is more common for external developers.

Use the simctl wrappers to match up device type, runtime (SDK version), and a created device’s UDID (UUID).
Comment 1 David Farler 2014-09-23 13:00:10 PDT
*** Bug 136896 has been marked as a duplicate of this bug. ***
Comment 2 David Farler 2014-09-23 13:02:04 PDT
Created attachment 238561 [details]
Patch
Comment 3 David Farler 2014-09-23 13:16:06 PDT
Created attachment 238565 [details]
Patch
Comment 4 David Farler 2014-09-23 13:17:03 PDT
Fixed up some unnecessary magic in DeviceType's constructor since I added convenience methods and filled in some :types: for some apidocs.
Comment 5 David Kilzer (:ddkilzer) 2014-09-24 15:28:38 PDT
Comment on attachment 238565 [details]
Patch

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

r=me

> Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py:403
> +            options.device_type = iphone5 if options.architecture == 'x86' else iphone5s

Is it 'x86' or 'i386' for the 32-bit arch?  Do we need to support both?  (We should support both if x86 is also used.)

> Tools/Scripts/webkitpy/xcode/simulator.py:6
> +import logging
> +import os
>  import subprocess
>  import re
> +import itertools
> +import time

Nit: Alphabetize.

> Tools/Scripts/webkitpy/xcode/simulator.py:99
> +        self.available = availability != 'unavailable'

Should the sense of this be reversed so that garbage values default to unavailable?

    self.available = availability == 'available'
Comment 6 David Farler 2014-09-24 16:09:58 PDT
(In reply to comment #5)
> (From update of attachment 238565 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=238565&action=review
> 
> r=me
> 
> > Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py:403
> > +            options.device_type = iphone5 if options.architecture == 'x86' else iphone5s
> 
> Is it 'x86' or 'i386' for the 32-bit arch?  Do we need to support both?  (We should support both if x86 is also used.)

It looks like x86 and x86_64 are the literals of choice in webkitpy. i386 only occurs a couple of times, when building with Xcode.

> 
> > Tools/Scripts/webkitpy/xcode/simulator.py:6
> > +import logging
> > +import os
> >  import subprocess
> >  import re
> > +import itertools
> > +import time
> 
> Nit: Alphabetize.

👍

> 
> > Tools/Scripts/webkitpy/xcode/simulator.py:99
> > +        self.available = availability != 'unavailable'
> 
> Should the sense of this be reversed so that garbage values default to unavailable?
> 
>     self.available = availability == 'available'

It could in theory get garbage values, although simctl only ever shows the status if it's unavailable (not a fan of that). I'll reflect on it before committing.
Comment 7 David Farler 2014-09-24 16:21:10 PDT
(In reply to comment #6)
> (In reply to comment #5)
> > (From update of attachment 238565 [details] [details])
> > View in context: https://bugs.webkit.org/attachment.cgi?id=238565&action=review
> > 
> > r=me
> > 
> > > Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py:403
> > > +            options.device_type = iphone5 if options.architecture == 'x86' else iphone5s
> > 
> > Is it 'x86' or 'i386' for the 32-bit arch?  Do we need to support both?  (We should support both if x86 is also used.)
> 
> It looks like x86 and x86_64 are the literals of choice in webkitpy. i386 only occurs a couple of times, when building with Xcode.
> 
> > 
> > > Tools/Scripts/webkitpy/xcode/simulator.py:6
> > > +import logging
> > > +import os
> > >  import subprocess
> > >  import re
> > > +import itertools
> > > +import time
> > 
> > Nit: Alphabetize.
> 
> 👍
> 
> > 
> > > Tools/Scripts/webkitpy/xcode/simulator.py:99
> > > +        self.available = availability != 'unavailable'
> > 
> > Should the sense of this be reversed so that garbage values default to unavailable?
> > 
> >     self.available = availability == 'available'
> 
> It could in theory get garbage values, although simctl only ever shows the status if it's unavailable (not a fan of that). I'll reflect on it before committing.

I changed the Device and Runtime constructors to take available :: bool and handle the simctl output outside of that at the point of scraping the output. That's cleaner anyway.

The current assumption is now that the availability regex match should be None (available) or not None (something other than available, probably not available) which reflects the current output. If we hit something where the availability has more than two states, then we can break it out into an enum, although that would surprise me (or would it).
Comment 8 David Farler 2014-09-24 16:28:18 PDT
Committed r173937: <http://trac.webkit.org/changeset/173937>