RESOLVED FIXED 142447
Add some WorkQueue tests to TestWebKitAPI
https://bugs.webkit.org/show_bug.cgi?id=142447
Summary Add some WorkQueue tests to TestWebKitAPI
Brent Fulgham
Reported 2015-03-07 20:21:43 PST
WorkQueue is used heavily in WebKit2 code, but we don't really have good test coverage for it. We should exercise it as part of our normal TestWebKitAPI tests.
Attachments
Patch (9.02 KB, patch)
2015-03-07 23:15 PST, Brent Fulgham
no flags
Patch v2 (Activate on Windows) (10.36 KB, patch)
2015-03-07 23:34 PST, Brent Fulgham
no flags
Patch v3 (Update per weinig comments) (12.45 KB, patch)
2015-03-08 14:04 PDT, Brent Fulgham
sam: review+
Brent Fulgham
Comment 1 2015-03-07 23:15:49 PST
Brent Fulgham
Comment 2 2015-03-07 23:17:35 PST
Comment on attachment 248181 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=248181&action=review > Tools/TestWebKitAPI/Tests/WTF/WorkQueue.cpp:110 > + std::this_thread::sleep_for(std::chrono::nanoseconds(1000)); I'm just trying to simulate some lengthy bit of work here. Maybe there's a better way? > Tools/TestWebKitAPI/Tests/WTF/WorkQueue.cpp:132 > + queue1->dispatchAfter(std::chrono::milliseconds(100), finishedTests); I want to verify that the two queues work independently. Not sure if there is a better way to do this? Maybe more condition variables to coordinate the order of things?
Brent Fulgham
Comment 3 2015-03-07 23:34:01 PST
Created attachment 248182 [details] Patch v2 (Activate on Windows)
Brent Fulgham
Comment 4 2015-03-07 23:51:05 PST
Comment on attachment 248182 [details] Patch v2 (Activate on Windows) View in context: https://bugs.webkit.org/attachment.cgi?id=248182&action=review > Tools/TestWebKitAPI/Tests/WTF/WorkQueue.cpp:124 > + queue1->dispatchAfter(std::chrono::milliseconds(100), finishedTests); I'm trying to simulate two queues performing different amounts of work. Maybe there's a better way than these delays...
Brent Fulgham
Comment 5 2015-03-08 14:04:02 PDT
Created attachment 248203 [details] Patch v3 (Update per weinig comments)
Sam Weinig
Comment 6 2015-03-08 14:31:04 PDT
Comment on attachment 248203 [details] Patch v3 (Update per weinig comments) View in context: https://bugs.webkit.org/attachment.cgi?id=248203&action=review > Tools/TestWebKitAPI/Tests/WTF/WorkQueue.cpp:191 > + EXPECT_TRUE(done >= start + std::chrono::milliseconds(500)); I am not sure how guaranteed accurate dispatchAfter is.
Sam Weinig
Comment 7 2015-03-08 14:32:43 PDT
Comment on attachment 248203 [details] Patch v3 (Update per weinig comments) The tests look good, though the DispatchAfter worries me that it could be flakey (as all timing depended tests are). I would land it without testing that the actual timing matches up.
Brent Fulgham
Comment 8 2015-03-08 16:55:35 PDT
Brent Fulgham
Comment 9 2015-03-08 16:58:11 PDT
EFL and GTK ports should probably add this test as well.
Martin Robinson
Comment 10 2015-03-08 21:53:59 PDT
The corresponding change for CMake is here: https://bugs.webkit.org/show_bug.cgi?id=142473
David Kilzer (:ddkilzer)
Comment 11 2015-03-09 05:59:09 PDT
Attempt to fix WTF_WorkQueue.TwoQueues timeout test failure <http://trac.webkit.org/changeset/181265> Easiest to see where it started failing here: <https://build.webkit.org/builders/Apple%20Mavericks%20Debug%20WK2%20(Tests)?numbuilds=50>
Brent Fulgham
Comment 12 2015-03-09 09:41:05 PDT
(In reply to comment #11) > Attempt to fix WTF_WorkQueue.TwoQueues timeout test failure > <http://trac.webkit.org/changeset/181265> > > Easiest to see where it started failing here: > <https://build.webkit.org/builders/ > Apple%20Mavericks%20Debug%20WK2%20(Tests)?numbuilds=50> Looks like that worked. Thank you for fixing that!
Note You need to log in before you can comment on or make changes to this bug.