Bug 34940

Summary: [Gtk] testwebview does not work when called with absolute path
Product: WebKit Reporter: arno. <a.renevier>
Component: WebKitGTKAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: PC   
OS: Linux   
Bug Depends on:    
Bug Blocks: 62935    
Attachments:
Description Flags
patch v1
gustavo: review-, gustavo: commit-queue-
patch v2
none
patch v2.2
gustavo: review-, gustavo: commit-queue-
patch v2.3 none

Description arno. 2010-02-15 06:05:28 PST
Hi, when trying to run testwebviow from a random directory (ie: with an absolute path), it fails with following error: 

15:04 127 ~ % ~/webkit/WebKit/WebKitBuild/Release/Programs/unittests/testwebview
**
ERROR:../../WebKit/gtk/tests/testwebview.c:244:main: assertion failed: (!g_str_equal(getcwd(path_name, PATH_MAX), "/"))
zsh: abort      ~/webkit/WebKit/WebKitBuild/Release/Programs/unittests/testwebview

other testes in unittests succeed when run with absolute path.
Comment 1 arno. 2010-02-15 06:11:01 PST
Created attachment 48749 [details]
patch v1
Comment 2 Gustavo Noronha (kov) 2010-02-18 06:06:40 PST
Comment on attachment 48749 [details]
patch v1

That looks good. I'm afraid at least one more test needs this fix, though, and it would be good to have this split to a function in an utils file. Would you mind applying the fix to the other file, and potentially do this refactoring? It's OK if you just apply the fix to the other files, but the refactoring would rock =).

 236     if (g_path_is_absolute (argv[0])) {
 237         g_chdir (g_path_get_dirname (argv[0]));

These spaces before the ( are wrong, r- for this style problem.
Comment 3 arno. 2010-02-19 10:31:03 PST
Created attachment 49090 [details]
patch v2

Here is an updated version.
Comment 4 arno. 2010-02-19 10:36:34 PST
Created attachment 49091 [details]
patch v2.2

updated patch: last one did not mention added tests/test_utils.c in WebKit/gtk/ChangeLog
Comment 5 Gustavo Noronha (kov) 2010-02-22 09:17:18 PST
Comment on attachment 49091 [details]
patch v2.2

 30 extern int testutils_relative_chdir(const gchar*, const gchar*);

Adding a header, and a proper signature would be better, plus, you should add the bug URL, and its description to the changelog:

 8         Need a short description and bug URL (OOPS!)

Otherwise, this patch is a good step forward, thanks for taking the time to refactor this! One more round to fix up these two small issues, and I'll r+ it.
Comment 6 arno. 2010-02-22 09:52:26 PST
Created attachment 49222 [details]
patch v2.3

updated patch
Comment 7 Gustavo Noronha (kov) 2010-02-23 14:24:05 PST
Comment on attachment 49222 [details]
patch v2.3

Better, thanks!
Comment 8 WebKit Commit Bot 2010-02-23 14:43:30 PST
Comment on attachment 49222 [details]
patch v2.3

Clearing flags on attachment: 49222

Committed r55173: <http://trac.webkit.org/changeset/55173>
Comment 9 WebKit Commit Bot 2010-02-23 14:43:34 PST
All reviewed patches have been landed.  Closing bug.