Bug 219160 - [GTK][WPE] Migrate WebKitTestServer to libsoup 2.48 API
Summary: [GTK][WPE] Migrate WebKitTestServer to libsoup 2.48 API
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: Frédéric Wang (:fredw)
URL:
Keywords: InRadar
Depends on: 220922
Blocks: 219257
  Show dependency treegraph
 
Reported: 2020-11-19 07:15 PST by Frédéric Wang (:fredw)
Modified: 2021-02-02 00:50 PST (History)
9 users (show)

See Also:


Attachments
Untested patch (1.93 KB, patch)
2020-11-19 07:15 PST, Frédéric Wang (:fredw)
no flags Details | Formatted Diff | Diff
Untested patch (1.93 KB, patch)
2020-11-19 07:16 PST, Frédéric Wang (:fredw)
no flags Details | Formatted Diff | Diff
Untested patch (1.93 KB, patch)
2020-11-19 07:17 PST, Frédéric Wang (:fredw)
cgarcia: review+
Details | Formatted Diff | Diff
Patch (3.10 KB, patch)
2020-11-20 00:54 PST, Frédéric Wang (:fredw)
no flags Details | Formatted Diff | Diff
Patch (10.35 KB, patch)
2021-02-01 04:43 PST, Carlos Garcia Campos
mcatanzaro: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Frédéric Wang (:fredw) 2020-11-19 07:15:42 PST
Created attachment 414575 [details]
Untested patch

It seems our WebDriver code uses the new soup_server_listen APIs from 2.48, so the code added in bug 146165 is no longer correct, we should really require 2.48 or higher.
Comment 1 Frédéric Wang (:fredw) 2020-11-19 07:16:25 PST
Created attachment 414576 [details]
Untested patch
Comment 2 Frédéric Wang (:fredw) 2020-11-19 07:17:07 PST
Created attachment 414577 [details]
Untested patch
Comment 3 Frédéric Wang (:fredw) 2020-11-19 09:52:16 PST
Comment on attachment 414577 [details]
Untested patch

Please take a look.

Disclaimer: I haven't use glib for a long time, hopefully I haven't misused the API.
Comment 4 Frédéric Wang (:fredw) 2020-11-20 00:54:40 PST
Created attachment 414660 [details]
Patch
Comment 5 EWS 2020-11-20 01:40:37 PST
Committed r270074: <https://trac.webkit.org/changeset/270074>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 414660 [details].
Comment 6 Radar WebKit Bug Importer 2020-11-20 01:41:16 PST
<rdar://problem/71620310>
Comment 7 WebKit Commit Bot 2021-01-25 07:06:46 PST
Re-opened since this is blocked by bug 220922
Comment 8 Carlos Garcia Campos 2021-02-01 04:43:28 PST
Created attachment 418858 [details]
Patch
Comment 9 Michael Catanzaro 2021-02-01 06:54:17 PST
Comment on attachment 418858 [details]
Patch

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

> Tools/TestWebKitAPI/glib/WebKitGLib/WebKitTestServer.cpp:35
> +    m_soupServer = adoptGRef(soup_server_new("server-header", "WebKitTestServer ", nullptr));

If options[ServerRunInThread] is set, I would go even further and create this on the WorkQueue thread using your trick with BinarySemaphore to dispatch a function and wait until it completes. Sharing m_soupServer across threads like the current code does might work in practice, but I doubt it's safe.
Comment 10 Carlos Garcia Campos 2021-02-01 07:09:28 PST
(In reply to Michael Catanzaro from comment #9)
> Comment on attachment 418858 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=418858&action=review
> 
> > Tools/TestWebKitAPI/glib/WebKitGLib/WebKitTestServer.cpp:35
> > +    m_soupServer = adoptGRef(soup_server_new("server-header", "WebKitTestServer ", nullptr));
> 
> If options[ServerRunInThread] is set, I would go even further and create
> this on the WorkQueue thread using your trick with BinarySemaphore to
> dispatch a function and wait until it completes. Sharing m_soupServer across
> threads like the current code does might work in practice, but I doubt it's
> safe.

Well, the creation and run happen before any test start, so it should be safe, I would say. We don't even need the run, and server callback could be a constructor parameter, but that would require all the tests and I don't think it's worth it.
Comment 11 Michael Catanzaro 2021-02-01 07:12:24 PST
I just like to be paranoid about sharing objects across threads. Anyway, it's probably OK. You have r+.
Comment 12 Carlos Garcia Campos 2021-02-02 00:50:35 PST
Committed r272195: <https://trac.webkit.org/changeset/272195>