WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
171881
webkitpy: Run sample/spindump on iOS devices
https://bugs.webkit.org/show_bug.cgi?id=171881
Summary
webkitpy: Run sample/spindump on iOS devices
Jonathan Bedard
Reported
2017-05-09 13:39:47 PDT
We should enable running both sample and spindump on iOS devices.
Attachments
Patch
(5.62 KB, patch)
2017-05-09 14:33 PDT
,
Jonathan Bedard
no flags
Details
Formatted Diff
Diff
Patch
(8.42 KB, patch)
2017-06-07 09:16 PDT
,
Jonathan Bedard
no flags
Details
Formatted Diff
Diff
Patch
(7.36 KB, patch)
2017-06-07 13:10 PDT
,
Jonathan Bedard
no flags
Details
Formatted Diff
Diff
Patch
(10.05 KB, patch)
2017-06-07 15:41 PDT
,
Jonathan Bedard
no flags
Details
Formatted Diff
Diff
Patch
(7.53 KB, patch)
2017-06-08 10:20 PDT
,
Jonathan Bedard
no flags
Details
Formatted Diff
Diff
Patch for landing
(7.53 KB, patch)
2017-06-08 13:01 PDT
,
Jonathan Bedard
no flags
Details
Formatted Diff
Diff
Show Obsolete
(5)
View All
Add attachment
proposed patch, testcase, etc.
Radar WebKit Bug Importer
Comment 1
2017-05-09 13:40:21 PDT
<
rdar://problem/32084602
>
Jonathan Bedard
Comment 2
2017-05-09 14:33:57 PDT
Created
attachment 309542
[details]
Patch
Jonathan Bedard
Comment 3
2017-06-07 09:16:14 PDT
Created
attachment 312191
[details]
Patch
Aakash Jain
Comment 4
2017-06-07 11:59:48 PDT
Comment on
attachment 312191
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=312191&action=review
looks fine to me.
> Tools/ChangeLog:3 > + webkitpy: Preform sample/spindump on iOS devices
"Preform" seems like a typo.
Daniel Bates
Comment 5
2017-06-07 12:50:44 PDT
Comment on
attachment 312191
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=312191&action=review
> Tools/Scripts/webkitpy/port/darwin.py:155 > + def _need_sudo_for_root():
Can we make use of PlatformInfo to avoid the need to add such a method?
> Tools/Scripts/webkitpy/port/darwin.py:181 > + DarwinPort.sample_file_path(host, name, pid, self.results_directory()))
This change seems like an unrelated bug fix. In general, a bug/patch should fix one issue. If we have unit tests for this code then it would be good to add a test for this change. If it is not possible to write a test for this change and you feel it is excessive to file a new bug for this change then please add a remark to the ChangeLog for this change.
> Tools/Scripts/webkitpy/port/darwin.py:186 > + DarwinPort.spindump_file_path(host, name, pid, self.results_directory()))
Ditto.
Jonathan Bedard
Comment 6
2017-06-07 12:58:09 PDT
Comment on
attachment 312191
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=312191&action=review
>> Tools/Scripts/webkitpy/port/darwin.py:155 >> + def _need_sudo_for_root(): > > Can we make use of PlatformInfo to avoid the need to add such a method?
Yes, we could directly check if the platform is iOS.
>> Tools/Scripts/webkitpy/port/darwin.py:181 >> + DarwinPort.sample_file_path(host, name, pid, self.results_directory())) > > This change seems like an unrelated bug fix. In general, a bug/patch should fix one issue. If we have unit tests for this code then it would be good to add a test for this change. If it is not possible to write a test for this change and you feel it is excessive to file a new bug for this change then please add a remark to the ChangeLog for this change.
Actually, this is a change which shouldn't be here at all. The previous code is correct.
Jonathan Bedard
Comment 7
2017-06-07 13:10:52 PDT
Created
attachment 312214
[details]
Patch
Daniel Bates
Comment 8
2017-06-07 13:43:38 PDT
Comment on
attachment 312214
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=312214&action=review
> Tools/Scripts/webkitpy/port/darwin.py:157 > + command_begin = ['/usr/bin/sudo', '-n'] if self.host.platform.is_ios() else []
We should only call sudo if the platform is Mac. On another note, can we come up with a better name? command_prefix?
> Tools/Scripts/webkitpy/port/darwin_testcase.py:108 > + command_begin = ['/usr/bin/sudo', '-n'] if port.host.platform.is_ios() else []
We should not be modifying the expected behavior of a test based on a variable as it negates the value of the test since if the test code is wrong then bugs in the real code can pass through undetected. We should have a separate test that mocks an iOS platform.
> Tools/Scripts/webkitpy/port/darwin_testcase.py:117 > - if args[0] == '/usr/bin/sudo': > + if args[0] == '/usr/bin/sudo' or args[0] == '/usr/sbin/spindump':
Similarly this test methodology is error prone. Hopefully this can be resolved once we do the above.
> Tools/Scripts/webkitpy/port/darwin_testcase.py:132 > + if args[0] == '/usr/bin/sudo' or args[0] == '/usr/sbin/spindump':
Ditto.
Jonathan Bedard
Comment 9
2017-06-07 15:41:45 PDT
Created
attachment 312245
[details]
Patch
Daniel Bates
Comment 10
2017-06-07 20:08:22 PDT
Comment on
attachment 312245
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=312245&action=review
> Tools/Scripts/webkitpy/port/darwin.py:159 > + str(pid),
Is it necessary to stringify this? I thought Executive will do this for us. If so, then please remove the str().
> Tools/Scripts/webkitpy/port/darwin.py:160 > + '10',
Similarly, do we need to stringify this? See my above remark.
> Tools/Scripts/webkitpy/port/darwin.py:162 > + '-file',
Ditto.
> Tools/Scripts/webkitpy/port/darwin.py:165 > + command = ['/usr/bin/sudo', '-n'] + command if self.host.platform.is_mac() else command
I suggest writing this as a single if statement without an else clause.
> Tools/Scripts/webkitpy/port/darwin.py:171 > + str(pid),
Do we need to stringify this? See my remark for line 159.
> Tools/Scripts/webkitpy/port/darwin.py:172 > + '10',
Ditto.
> Tools/Scripts/webkitpy/port/darwin.py:173 > + '10',
Ditto.
> Tools/Scripts/webkitpy/port/darwin_testcase.py:107 > port.host.filesystem.files['/__im_tmp/tmp_0_/test-42-spindump.txt'] = 'Spindump file'
We should move this test and the test you modify below as well as any other applicable ones to the test file for the Mac port. We should not be asserting Mac in this test because these tests should be applicable to all Darwin-based platforms.
> Tools/Scripts/webkitpy/port/ios_device_unittest.py:32 > + os_name = 'ios'
What do we use this class variable for?
> Tools/Scripts/webkitpy/port/ios_device_unittest.py:82 > + raise ScriptError("MOCK script error")
" => '
> Tools/Scripts/webkitpy/port/ios_simulator_unittest.py:33 > + os_name = 'mac'
What do we use this class variable for?
Jonathan Bedard
Comment 11
2017-06-08 08:15:53 PDT
Comment on
attachment 312245
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=312245&action=review
>> Tools/Scripts/webkitpy/port/darwin.py:159 >> + str(pid), > > Is it necessary to stringify this? I thought Executive will do this for us. If so, then please remove the str().
Yes, we do need to stringily this.
>> Tools/Scripts/webkitpy/port/darwin_testcase.py:107 >> port.host.filesystem.files['/__im_tmp/tmp_0_/test-42-spindump.txt'] = 'Spindump file' > > We should move this test and the test you modify below as well as any other applicable ones to the test file for the Mac port. We should not be asserting Mac in this test because these tests should be applicable to all Darwin-based platforms.
iOS-Simulator ports have an os_name of mac as well. This test definitely belongs in Darwin. I assert the os_name because spindump/sample may fail with the wrong os_name, and this failure is not very intuitive. This assert catches the root-cause of an issue which could break the rest of the test.
>> Tools/Scripts/webkitpy/port/ios_device_unittest.py:32 >> + os_name = 'ios' > > What do we use this class variable for?
This is used to define platform.os_name.
>> Tools/Scripts/webkitpy/port/ios_simulator_unittest.py:33 >> + os_name = 'mac' > > What do we use this class variable for?
See above.
Jonathan Bedard
Comment 12
2017-06-08 10:20:43 PDT
Created
attachment 312317
[details]
Patch
Jonathan Bedard
Comment 13
2017-06-08 10:22:25 PDT
Fixed the bug which made it necessary to stringify integers. Added a FixMe regarding the os_name, and removed the assert since after talking with Dan, the hope is that this is a temporary arrangement.
Daniel Bates
Comment 14
2017-06-08 12:24:39 PDT
Comment on
attachment 312317
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=312317&action=review
> Tools/Scripts/webkitpy/port/darwin.py:165 > + command = ['/usr/bin/sudo', '-n'] + command if self.host.platform.is_mac() else command
I take it you disagreed with by suggestion in
comment #10
that it would be more idiomatic to write this line as a single if statement without an else clause: if self.host.platform.is_mac(): command = ['/usr/bin/sudo', '-n'] + command ?
> Tools/Scripts/webkitpy/port/ios_device_unittest.py:50 > +
I do not see the value of having this empty line and its presence is inconsistent with the lack of an empty line at the beginning of test_sample_process_exception(). I suggest we remove this empty line.
> Tools/Scripts/webkitpy/port/ios_device_unittest.py:63 > +
Ditto.
Jonathan Bedard
Comment 15
2017-06-08 13:01:13 PDT
Created
attachment 312335
[details]
Patch for landing
WebKit Commit Bot
Comment 16
2017-06-08 13:39:04 PDT
Comment on
attachment 312335
[details]
Patch for landing Clearing flags on attachment: 312335 Committed
r217946
: <
http://trac.webkit.org/changeset/217946
>
WebKit Commit Bot
Comment 17
2017-06-08 13:39:05 PDT
All reviewed patches have been landed. Closing bug.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug