Bug 75064

Summary: TestWebKitAPI: initialize the main thread before running tests
Product: WebKit Reporter: David Kilzer (:ddkilzer) <ddkilzer>
Component: Tools / TestsAssignee: David Kilzer (:ddkilzer) <ddkilzer>
Status: RESOLVED WONTFIX    
Severity: Normal CC: aroben, sam, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch v1 none

David Kilzer (:ddkilzer)
Reported 2011-12-21 21:47:58 PST
Currently TestWebKitAPI doesn't initialize the main thread before running any tests. This can lead to assertion failures in Debug builds when calling (for example) WebCore::UTF8Encoding() in a test.
Attachments
Patch v1 (1.55 KB, patch)
2011-12-21 21:55 PST, David Kilzer (:ddkilzer)
no flags
David Kilzer (:ddkilzer)
Comment 1 2011-12-21 21:55:10 PST
Created attachment 120271 [details] Patch v1
David Kilzer (:ddkilzer)
Comment 2 2011-12-21 22:27:31 PST
Here's an example stack trace of such a crash: Exception Type: EXC_BAD_ACCESS (SIGSEGV) Exception Codes: KERN_INVALID_ADDRESS at 0x00000000bbadbeef VM Regions Near 0xbbadbeef: --> __TEXT 0000000105fe7000-00000001060fd000 [ 1112K] r-x/rwx SM=COW /Volumes/VOLUME/* Application Specific Information: objc[49579]: garbage collection is OFF Thread 0 Crashed:: Dispatch queue: com.apple.main-thread 0 com.apple.JavaScriptCore 0x000000010792e203 WTF::isMainThread() + 195 (MainThreadMac.mm:144) 1 com.apple.WebCore 0x00000001098a3efd _ZN7WebCoreL22buildBaseTextCodecMapsEv + 13 (TextEncodingRegistry.cpp:213) 2 com.apple.WebCore 0x00000001098a3e2a WebCore::atomicCanonicalTextEncodingName(char const*) + 74 (TextEncodingRegistry.cpp:338) 3 com.apple.WebCore 0x00000001098a2c21 WebCore::TextEncoding::TextEncoding(char const*) + 33 (TextEncoding.cpp:55) 4 com.apple.WebCore 0x00000001098a2bed WebCore::TextEncoding::TextEncoding(char const*) + 29 (TextEncoding.cpp:58) 5 com.apple.WebCore 0x00000001098a3598 WebCore::UTF8Encoding() + 40 (TextEncoding.cpp:250) 6 com.apple.WebCore 0x000000010928e7b4 WebCore::decodeURLEscapeSequences(WTF::String const&) + 36 (KURL.cpp:919) 7 com.apple.WebCore 0x000000010928e77a WebCore::KURL::host() const + 90 (KURL.cpp:586) 8 TestWebKitAPI 0x0000000106073fbf TestWebKitAPI::WebCore_KURLConstCharConstructor_Test::TestBody() + 2015 (KURL.cpp:54) 9 TestWebKitAPI 0x000000010607e7ca testing::Test::Run() + 154 10 TestWebKitAPI 0x000000010607f0cd testing::internal::TestInfoImpl::Run() + 189 11 TestWebKitAPI 0x000000010607f8fd testing::TestCase::Run() + 205 12 TestWebKitAPI 0x00000001060849e9 testing::internal::UnitTestImpl::RunAllTests() + 793 13 TestWebKitAPI 0x00000001060846c9 testing::UnitTest::Run() + 25 14 TestWebKitAPI 0x0000000105fe9870 TestWebKitAPI::TestsController::run(int, char**) + 48 (TestsController.cpp:51) 15 TestWebKitAPI 0x0000000105fe96e9 main + 121 (main.mm:35) 16 TestWebKitAPI 0x0000000105fe8ca4 start + 52
WebKit Review Bot
Comment 3 2011-12-22 08:41:42 PST
Comment on attachment 120271 [details] Patch v1 Clearing flags on attachment: 120271 Committed r103546: <http://trac.webkit.org/changeset/103546>
WebKit Review Bot
Comment 4 2011-12-22 08:41:46 PST
All reviewed patches have been landed. Closing bug.
Sam Weinig
Comment 5 2011-12-25 12:31:38 PST
I am not sure I like this solution. Since one of the goals of this test runner is to test that the API works (and you wouldn't use this internal method when using API) this won't be testing if we forget to initialize threading for some API calls. Perhaps we can install some sort of helper for WebCore / JavaScriptCore internals tests that does the initialization only for them.
David Kilzer (:ddkilzer)
Comment 6 2012-01-04 11:02:01 PST
(In reply to comment #5) > I am not sure I like this solution. Since one of the goals of this test runner is to test that the API works (and you wouldn't use this internal method when using API) this won't be testing if we forget to initialize threading for some API calls. > > Perhaps we can install some sort of helper for WebCore / JavaScriptCore internals tests that does the initialization only for them. That's a great point. I will back out this change and use a setup/helper function for the WebCore tests I'm writing.
David Kilzer (:ddkilzer)
Comment 7 2012-01-04 11:26:25 PST
(In reply to comment #6) > (In reply to comment #5) > > I am not sure I like this solution. Since one of the goals of this test runner is to test that the API works (and you wouldn't use this internal method when using API) this won't be testing if we forget to initialize threading for some API calls. > > > > Perhaps we can install some sort of helper for WebCore / JavaScriptCore internals tests that does the initialization only for them. > > That's a great point. I will back out this change and use a setup/helper function for the WebCore tests I'm writing. Backed out in r104050: <http://trac.webkit.org/changeset/104050> Marking this bug as RESOLVED/WONTFIX.
Note You need to log in before you can comment on or make changes to this bug.