Bug 62935

Summary: [GTK] Fix GTK unit tests failures when WebKit is build outside repository directory.
Product: WebKit Reporter: Lukasz Slachciak <l.slachciak>
Component: WebKitGTKAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: a.renevier, gustavo
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: Linux   
Bug Depends on: 34940    
Bug Blocks:    
Attachments:
Description Flags
testutils1.patch
none
Patch
none
Patch2
gustavo: review-
Fix GTK unit test failures gustavo: commit-queue-

Description Lukasz Slachciak 2011-06-18 12:15:23 PDT
WebKit can be build with WEBKITOUTPUTDIR env variable set using build-webkit script. In this case WEBKITOUTPUDIR may be outside repository structure. This causes testmimehandling and testwebview to fail because they use external test files in WebKit Source directory.
This bug fixes this issue introducing optional environment variable WEBKITREPODIR
Comment 1 Lukasz Slachciak 2011-06-18 12:20:40 PDT
Created attachment 97704 [details]
testutils1.patch
Comment 2 Lukasz Slachciak 2011-06-19 00:17:46 PDT
Subscribing Arno and Gustavo involved in connected bug (this one improves it) - 34940 [Gtk] testwebview does not work when called with absolute path
Comment 3 Lukasz Slachciak 2011-06-22 01:59:06 PDT
Created attachment 98135 [details]
Patch
Comment 4 Lukasz Slachciak 2011-06-22 02:54:20 PDT
Created attachment 98142 [details]
Patch2

Updated code style
Comment 5 Gustavo Noronha (kov) 2011-07-11 07:55:40 PDT
Comment on attachment 98142 [details]
Patch2

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

> Source/WebKit/gtk/tests/test_utils.c:34
> +    /* user can set location of the webkit repository directory if it differs from build directory */
> +    const char* repo_path = g_getenv("WEBKITREPODIR");
> +    if (repo_path) {
> +        if (g_chdir(repo_path)) {
> +	    return -1;
> +	}
> +    }
> +    else if (g_path_is_absolute(executable_path)) {

Indentation seems quite off here, or is it the patch viewer? The inner if should not have bracers (this file has plenty of this problem, unfortunately), and the else if should be in the same line as the }. Also, given this is a C file, the * should be on the right side. What do you think of doing a style cleanup on this file? ;)
Comment 6 Lukasz Slachciak 2011-07-13 13:56:38 PDT
Comment on attachment 98142 [details]
Patch2

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

>> Source/WebKit/gtk/tests/test_utils.c:34
>> +    else if (g_path_is_absolute(executable_path)) {
> 
> Indentation seems quite off here, or is it the patch viewer? The inner if should not have bracers (this file has plenty of this problem, unfortunately), and the else if should be in the same line as the }. Also, given this is a C file, the * should be on the right side. What do you think of doing a style cleanup on this file? ;)

Indentation fixed. Coding style cleanup done. Unfortunately this file has exception in check-webkit-style so it is not taken into account when checking style
Comment 7 Lukasz Slachciak 2011-07-13 14:02:05 PDT
Created attachment 100705 [details]
Fix GTK unit test failures

+ coding style enhancements
Comment 8 Gustavo Noronha (kov) 2011-07-14 06:28:42 PDT
Comment on attachment 100705 [details]
Fix GTK unit test failures

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

> Source/WebKit/gtk/tests/test_utils.c:31
> +    if (repoPath) {
> +        if (g_chdir(repoPath))
> +	    return -1;

I believe this return is still misindented; there is a tab here. I'll land it manually and fix it before doing it.
Comment 9 Gustavo Noronha (kov) 2011-07-14 06:31:45 PDT
Comment on attachment 100705 [details]
Fix GTK unit test failures

http://trac.webkit.org/changeset/90994
Comment 10 Lukasz Slachciak 2011-07-14 14:27:15 PDT
Gustavo, thank you for review and commit update.