Summary: | old-run-webkit-tests: Create CoreSimulator device on demand and find it by name | ||||||||
---|---|---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | David Farler <dfarler> | ||||||
Component: | Tools / Tests | Assignee: | David Farler <dfarler> | ||||||
Status: | RESOLVED FIXED | ||||||||
Severity: | Normal | CC: | commit-queue, dbates, ddkilzer | ||||||
Priority: | P2 | ||||||||
Version: | 528+ (Nightly build) | ||||||||
Hardware: | iPhone / iPad | ||||||||
OS: | All | ||||||||
Attachments: |
|
Description
David Farler
2014-06-09 16:26:05 PDT
Created attachment 232802 [details]
Patch
OK, one more time. Comment on attachment 232802 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=232802&action=review r=me > Tools/Scripts/old-run-webkit-tests:1390 > - my $deviceName = architecture() eq 'i386' ? "iPhone 5" : "iPhone 5s"; > + my $deviceName = architecture() eq 'i386' ? "iPhone 5 WebKit Tester" : "iPhone 5s WebKit Tester"; > + > + my $deviceType = "com.apple.CoreSimulator.SimDeviceType.iPhone-5"; > + $deviceType .= "s" if architecture() eq "x86_64"; Nit: It might be clearer to just make this an if/else statement: my $deviceName = "iPhone 5 WebKit Tester"; my $deviceType = "com.apple.CoreSimulator.SimDeviceType.iPhone-5"; if (architecture() eq 'x86_64') { $deviceName = "iPhone 5s WebKit Tester"; $deviceType = "com.apple.CoreSimulator.SimDeviceType.iPhone-5s"; } > Tools/Scripts/webkitdirs.pm:1122 > + return "$ENV{HOME}/Library/Developer/CoreSimulator/Devices"; Should this be $ENV{CFFIXED_USER_HOME} instead? > Tools/Scripts/webkitdirs.pm:1127 > + use Foundation; I'm hoping this won't be evaluated until the method is called, since this could break non-Mac users of the script. > Tools/Scripts/webkitdirs.pm:1166 > + my $tries = 5; > + while (1) { > + my @devices = iOSSimulatorDevices(); > + foreach my $device (@devices) { > + return $device if $device->{name} eq $name and $device->{deviceType} eq $deviceTypeId and $device->{runtime} eq $runtimeId; > + } > + sleep 5; > + $tries -= 1; > + if ($tries <= 0) { > + die "Device $name $deviceTypeId $runtimeId wasn't found in " . iOSSimulatorDevicesPath(); > + } > + } This would be simpler with a for() loop that just falls through: for (my $tries = 5; $tries > 0; $tries--) { [...] sleep 5; } die "Device $name $deviceTypeId $runtimeId wasn't found in " . iOSSimulatorDevicesPath(); (In reply to comment #3) > (From update of attachment 232802 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=232802&action=review > > > Tools/Scripts/webkitdirs.pm:1127 > > + use Foundation; > > I'm hoping this won't be evaluated until the method is called, since this could break non-Mac users of the script. Windows and EFL bots are failing because "use Foundation;" is evaluated at parse time, not run time: https://webkit-queues.appspot.com/patch/232802 Failed to run "['Tools/Scripts/build-webkit', '--release', '--efl', '--update-efl', '--no-webkit1', '--makeargs="-j8"']" exit_code: 2 Can't locate Foundation.pm in @INC (@INC contains: /mnt/eflews/git/webkit/Tools/Scripts /etc/perl /usr/local/lib/perl/5.14.2 /usr/local/share/perl/5.14.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.14 /usr/share/perl/5.14 /usr/local/lib/site_perl .) at /mnt/eflews/git/webkit/Tools/Scripts/webkitdirs.pm line 1127. BEGIN failed--compilation aborted at /mnt/eflews/git/webkit/Tools/Scripts/webkitdirs.pm line 1127. You'll have to use a Perl trick so that you only load Foundation at runtime; I think you either have to use an eval{} block and/or change it to a "require" statement. I think "man perlmod" has the details. (In reply to comment #4) > (In reply to comment #3) > > (From update of attachment 232802 [details] [details]) > > View in context: https://bugs.webkit.org/attachment.cgi?id=232802&action=review > > > > > Tools/Scripts/webkitdirs.pm:1127 > > > + use Foundation; > > > > I'm hoping this won't be evaluated until the method is called, since this could break non-Mac users of the script. > > Windows and EFL bots are failing because "use Foundation;" is evaluated at parse time, not run time: > > https://webkit-queues.appspot.com/patch/232802 > > Failed to run "['Tools/Scripts/build-webkit', '--release', '--efl', '--update-efl', '--no-webkit1', '--makeargs="-j8"']" exit_code: 2 > Can't locate Foundation.pm in @INC (@INC contains: /mnt/eflews/git/webkit/Tools/Scripts /etc/perl /usr/local/lib/perl/5.14.2 /usr/local/share/perl/5.14.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.14 /usr/share/perl/5.14 /usr/local/lib/site_perl .) at /mnt/eflews/git/webkit/Tools/Scripts/webkitdirs.pm line 1127. > BEGIN failed--compilation aborted at /mnt/eflews/git/webkit/Tools/Scripts/webkitdirs.pm line 1127. > > You'll have to use a Perl trick so that you only load Foundation at runtime; I think you either have to use an eval{} block and/or change it to a "require" statement. I think "man perlmod" has the details. Ah, I forgot that `use` is implicitly in the BEGIN block. The documentation recommends eval "require Foundation". (In reply to comment #3) > (From update of attachment 232802 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=232802&action=review > > r=me > > > Tools/Scripts/old-run-webkit-tests:1390 > > - my $deviceName = architecture() eq 'i386' ? "iPhone 5" : "iPhone 5s"; > > + my $deviceName = architecture() eq 'i386' ? "iPhone 5 WebKit Tester" : "iPhone 5s WebKit Tester"; > > + > > + my $deviceType = "com.apple.CoreSimulator.SimDeviceType.iPhone-5"; > > + $deviceType .= "s" if architecture() eq "x86_64"; > > Nit: It might be clearer to just make this an if/else statement: > > my $deviceName = "iPhone 5 WebKit Tester"; > my $deviceType = "com.apple.CoreSimulator.SimDeviceType.iPhone-5"; > if (architecture() eq 'x86_64') { > $deviceName = "iPhone 5s WebKit Tester"; > $deviceType = "com.apple.CoreSimulator.SimDeviceType.iPhone-5s"; > } Yep, that's much clearer. > > > Tools/Scripts/webkitdirs.pm:1122 > > + return "$ENV{HOME}/Library/Developer/CoreSimulator/Devices"; > > Should this be $ENV{CFFIXED_USER_HOME} instead? I'm not familiar with CFFIXED_USER_HOME - where is that defined? > > > Tools/Scripts/webkitdirs.pm:1127 > > + use Foundation; > > I'm hoping this won't be evaluated until the method is called, since this could break non-Mac users of the script. You were right about this :) . I'll fix it in a subsequent patch. > > > Tools/Scripts/webkitdirs.pm:1166 > > + my $tries = 5; > > + while (1) { > > + my @devices = iOSSimulatorDevices(); > > + foreach my $device (@devices) { > > + return $device if $device->{name} eq $name and $device->{deviceType} eq $deviceTypeId and $device->{runtime} eq $runtimeId; > > + } > > + sleep 5; > > + $tries -= 1; > > + if ($tries <= 0) { > > + die "Device $name $deviceTypeId $runtimeId wasn't found in " . iOSSimulatorDevicesPath(); > > + } > > + } > > This would be simpler with a for() loop that just falls through: > > for (my $tries = 5; $tries > 0; $tries--) { > [...] > sleep 5; > } > > die "Device $name $deviceTypeId $runtimeId wasn't found in " . iOSSimulatorDevicesPath(); Good call. I'll switch it over. Created attachment 232811 [details]
Patch
(In reply to comment #6) > (In reply to comment #3) > > (From update of attachment 232802 [details] [details]) > > View in context: https://bugs.webkit.org/attachment.cgi?id=232802&action=review > > > > > Tools/Scripts/webkitdirs.pm:1122 > > > + return "$ENV{HOME}/Library/Developer/CoreSimulator/Devices"; > > > > Should this be $ENV{CFFIXED_USER_HOME} instead? > > I'm not familiar with CFFIXED_USER_HOME - where is that defined? It's a path that the iOS Simulator uses. (In reply to comment #8) > (In reply to comment #6) > > (In reply to comment #3) > > > (From update of attachment 232802 [details] [details] [details]) > > > View in context: https://bugs.webkit.org/attachment.cgi?id=232802&action=review > > > > > > > Tools/Scripts/webkitdirs.pm:1122 > > > > + return "$ENV{HOME}/Library/Developer/CoreSimulator/Devices"; > > > > > > Should this be $ENV{CFFIXED_USER_HOME} instead? > > > > I'm not familiar with CFFIXED_USER_HOME - where is that defined? > > It's a path that the iOS Simulator uses. Ah, no, the simulator device set are always drawn from the host user's home directory unless manually specified. Comment on attachment 232811 [details]
Patch
r=me
Committed r169783: <http://trac.webkit.org/changeset/169783> |