Bug 111346 - [GTK] Some WebKit2 GTK+ unit tests are failing in 32 bits bot
Summary: [GTK] Some WebKit2 GTK+ unit tests are failing in 32 bits bot
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
Keywords: Gtk
Depends on:
Reported: 2013-03-04 10:37 PST by Carlos Garcia Campos
Modified: 2013-03-04 11:34 PST (History)
4 users (show)

See Also:

Patch (8.59 KB, patch)
2013-03-04 10:42 PST, Carlos Garcia Campos
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Carlos Garcia Campos 2013-03-04 10:37:29 PST
The problem is the use of a temporary CString object in the macro g_assert_cmpstr. It's a common mistake because we usually forget that g_assert_cmpstr is not a function but a macro, that expands to multiple lines. 

Some examples:

ERROR:../../Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitSettings.cpp:277:void assertThatUserAgentIsSentInHeaders(WebViewTest*, const WTF::CString&): assertion failed (convertWebViewMainResourceDataToCString(test).data() == userAgent.data()): ("\021r\241\006lla/5.0 (X11; Linux i686) AppleWebKit/537.30 (KHTML, like Gecko) Chromium/25.0.1349.2 Chrome/25.0.1349.2 Safari/537.30" == "Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.30 (KHTML, like Gecko) Chromium/25.0.1349.2 Chrome/25.0.1349.2 Safari/537.30")

ERROR:../../Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitFaviconDatabase.cpp:207:void testGetFaviconURI(FaviconDatabaseTest*, gconstpointer): assertion failed (iconURI.get() == kServer->getURIForPath("/icon/favicon.ico").data()): (NULL == "q\354\317\006://")

And there are more cases, sometimes the memory is not overwritten yet when the comparison happens, and the test passes.
Comment 1 Carlos Garcia Campos 2013-03-04 10:42:10 PST
Created attachment 191269 [details]
Comment 2 WebKit Review Bot 2013-03-04 10:44:06 PST
Thanks for the patch. If this patch contains new public API please make sure it follows the guidelines for new WebKit2 GTK+ API. See http://trac.webkit.org/wiki/WebKitGTK/AddingNewWebKit2API
Comment 3 WebKit Review Bot 2013-03-04 10:44:20 PST
Attachment 191269 [details] did not pass style-queue:

Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/WebKit2/ChangeLog', u'Source/WebKit2/UIProcess/API/gtk/tests/TestDownloads.cpp', u'Source/WebKit2/UIProcess/API/gtk/tests/TestInspectorServer.cpp', u'Source/WebKit2/UIProcess/API/gtk/tests/TestLoaderClient.cpp', u'Source/WebKit2/UIProcess/API/gtk/tests/TestMain.h', u'Source/WebKit2/UIProcess/API/gtk/tests/TestResources.cpp', u'Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitFaviconDatabase.cpp', u'Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitSettings.cpp']" exit_code: 1
Source/WebKit2/UIProcess/API/gtk/tests/TestMain.h:44:  More than one command on the same line  [whitespace/newline] [4]
Source/WebKit2/UIProcess/API/gtk/tests/TestMain.h:45:  Else clause should never be on same line as else (use 2 lines)  [whitespace/newline] [4]
Source/WebKit2/UIProcess/API/gtk/tests/TestMain.h:45:  More than one command on the same line in if  [whitespace/parens] [4]
Source/WebKit2/UIProcess/API/gtk/tests/TestMain.h:47:  preprocessor directives (e.g., #ifdef, #define, #import) should never be indented.  [whitespace/indent] [4]
Total errors found: 4 in 8 files

If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 4 Martin Robinson 2013-03-04 10:58:19 PST
Comment on attachment 191269 [details]

Looks good for now. Later we probably want to replace all g_assert_cmpstr with a templatized function we can use everywhere.
Comment 5 WebKit Review Bot 2013-03-04 11:34:07 PST
Comment on attachment 191269 [details]

Clearing flags on attachment: 191269

Committed r144652: <http://trac.webkit.org/changeset/144652>
Comment 6 WebKit Review Bot 2013-03-04 11:34:10 PST
All reviewed patches have been landed.  Closing bug.