Bug 231512

Summary: [run-benchmark] Make Python 3 compatible
Product: WebKit Reporter: Jonathan Bedard <jbedard>
Component: Tools / TestsAssignee: Jonathan Bedard <jbedard>
Status: RESOLVED FIXED    
Severity: Normal CC: dewei_zhu, ews-watchlist, fpizlo, glenn, slewis, webkit-bug-importer, ysuzuki
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch for landing none

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>