Bug 231512 - [run-benchmark] Make Python 3 compatible
Summary: [run-benchmark] Make Python 3 compatible
Status: RESOLVED FIXED
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: 2021-10-11 07:40 PDT by Jonathan Bedard
Modified: 2021-10-12 12:37 PDT (History)
7 users (show)

See Also:


Attachments
Patch (3.50 KB, patch)
2021-10-11 07:42 PDT, Jonathan Bedard
no flags Details | Formatted Diff | Diff
Patch for landing (3.44 KB, patch)
2021-10-11 12:57 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 2021-10-11 07:40:14 PDT
run-benchmark is almost Python 3 compatible, there are a few Popen calls that need to be decoded.
Comment 1 Radar WebKit Bug Importer 2021-10-11 07:41:05 PDT
<rdar://problem/84098736>
Comment 2 Jonathan Bedard 2021-10-11 07:42:06 PDT
Created attachment 440792 [details]
Patch
Comment 3 dewei_zhu 2021-10-11 11:25:45 PDT
Comment on attachment 440792 [details]
Patch

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

r=me

> Tools/Scripts/webkitpy/benchmark_runner/browser_driver/linux_browser_driver.py:107
> +        )

If we decide to go with invoking decode('utf-8') on output, we may not need it here because I don't think use output from `_browser_process` anyway.

> Tools/Scripts/webkitpy/benchmark_runner/browser_driver/osx_safari_driver.py:73
> +                **(dict(encoding='utf-8') if sys.version_info >= (3, 0) else dict())

I think encoding only available since python3.6.
A most compatible way would be `process.communicate()[0].decode('utf-8')`.
Comment 4 Stephanie Lewis 2021-10-11 11:28:29 PDT
(In reply to dewei_zhu from comment #3)
> Comment on attachment 440792 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=440792&action=review
> 
> r=me
> 
> > Tools/Scripts/webkitpy/benchmark_runner/browser_driver/linux_browser_driver.py:107
> > +        )
> 
> If we decide to go with invoking decode('utf-8') on output, we may not need
> it here because I don't think use output from `_browser_process` anyway.
> 
> > Tools/Scripts/webkitpy/benchmark_runner/browser_driver/osx_safari_driver.py:73
> > +                **(dict(encoding='utf-8') if sys.version_info >= (3, 0) else dict())
> 
> I think encoding only available since python3.6.
> A most compatible way would be `process.communicate()[0].decode('utf-8')`.

+1.  We are using decode('utf-8') on pretty much all subprocess output throughout the perf. code
Comment 5 Jonathan Bedard 2021-10-11 12:57:32 PDT
Created attachment 440826 [details]
Patch for landing
Comment 6 EWS 2021-10-11 14:12:15 PDT
Committed r283936 (242795@main): <https://commits.webkit.org/242795@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 440826 [details].
Comment 7 Yusuke Suzuki 2021-10-12 12:37:41 PDT
Committed r284004 (242847@main): <https://commits.webkit.org/242847@main>