Bug 229782

Summary: [GTK][WPE] Port API test runner to python3
Product: WebKit Reporter: Carlos Alberto Lopez Perez <clopez>
Component: Tools / TestsAssignee: Carlos Alberto Lopez Perez <clopez>
Status: RESOLVED FIXED    
Severity: Normal CC: aakash_jain, cgarcia, darin, jbedard, pnormand, ryanhaddad, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=229758
Attachments:
Description Flags
Patch none

Description Carlos Alberto Lopez Perez 2021-09-01 17:21:30 PDT
Port API test runner to python3
Comment 1 Carlos Alberto Lopez Perez 2021-09-01 19:06:15 PDT
Created attachment 437104 [details]
Patch
Comment 2 Philippe Normand 2021-09-02 01:24:38 PDT
Comment on attachment 437104 [details]
Patch

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

> Tools/glib/glib_test_runner.py:252
> +            p = subprocess.Popen(command, stderr=subprocess.PIPE, env=env, pass_fds=[pipe_w])

Why pass_fds here?
Comment 3 Carlos Alberto Lopez Perez 2021-09-02 03:55:50 PDT
(In reply to Philippe Normand from comment #2)
> Comment on attachment 437104 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=437104&action=review
> 
> > Tools/glib/glib_test_runner.py:252
> > +            p = subprocess.Popen(command, stderr=subprocess.PIPE, env=env, pass_fds=[pipe_w])
> 
> Why pass_fds here?

Because the program called need to write on that "pipe_w" FD.

The runner uses a pipe to communicate with it, see https://trac.webkit.org/browser/webkit/trunk/Tools/glib/glib_test_runner.py?rev=281888#L239
Then the runner reads (binary) data from the pipe with the function GLibTestRunner._read_from_pipe() and converts that data to strings, unsigned or doubles with the Message() class.

With python3 if you don't explicitly pass the list of FDs that should be kept available to the subprocess invocation then the subprocess won't have access to those FDs. 

This was the part that gave me more trouble when porting this.
Comment 4 Philippe Normand 2021-09-02 04:07:48 PDT
Comment on attachment 437104 [details]
Patch

Thanks :)
Comment 5 Carlos Alberto Lopez Perez 2021-09-02 04:28:07 PDT
Thanks! 

But I need r+, not cq+ :)
Comment 6 Philippe Normand 2021-09-02 04:34:32 PDT
Comment on attachment 437104 [details]
Patch

OK I'm awake now, you got it!
Comment 7 Carlos Alberto Lopez Perez 2021-09-02 04:45:47 PDT
Comment on attachment 437104 [details]
Patch

Clearing flags on attachment: 437104

Committed r281919 (241228@main): <https://commits.webkit.org/241228@main>
Comment 8 Carlos Alberto Lopez Perez 2021-09-02 04:45:52 PDT
All reviewed patches have been landed.  Closing bug.
Comment 9 Radar WebKit Bug Importer 2021-09-02 04:47:23 PDT
<rdar://problem/82669592>
Comment 10 Carlos Alberto Lopez Perez 2021-09-02 11:41:34 PDT
Committed r281942 (241251@main): <https://commits.webkit.org/241251@main>
Comment 11 Aakash Jain 2021-09-02 15:16:55 PDT
This seems to have broken gtk api tests. 
e.g.: https://ews-build.webkit.org/#/builders/34/builds/42638/steps/13/logs/stdio
ModuleNotFoundError: No module named 'gi'