Title: [90994] trunk/Source/WebKit/gtk
Revision
90994
Author
[email protected]
Date
2011-07-14 06:30:34 -0700 (Thu, 14 Jul 2011)

Log Message

[GTK] Fix GTK unit tests failures when WebKit is build outside repository directory.
https://bugs.webkit.org/show_bug.cgi?id=62935

Patch by Lukasz Slachciak  <[email protected]> on 2011-07-14
Reviewed by Gustavo Noronha.

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
Also coding style in existing functions is fixed.

* tests/test_utils.c: Coding style fixes.
(testutils_relative_chdir): If WEBKITREPODIR is set, change current directory to it.
* tests/test_utils.h: Coding style fixes.

Modified Paths

Diff

Modified: trunk/Source/WebKit/gtk/ChangeLog (90993 => 90994)


--- trunk/Source/WebKit/gtk/ChangeLog	2011-07-14 13:28:19 UTC (rev 90993)
+++ trunk/Source/WebKit/gtk/ChangeLog	2011-07-14 13:30:34 UTC (rev 90994)
@@ -1,3 +1,21 @@
+2011-07-14  Lukasz Slachciak  <[email protected]>
+
+        Reviewed by Gustavo Noronha.
+
+        [GTK] Fix GTK unit tests failures when WebKit is build outside repository directory.
+        https://bugs.webkit.org/show_bug.cgi?id=62935
+
+        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
+        Also coding style in existing functions is fixed.
+
+
+        * tests/test_utils.c: Coding style fixes.
+        (testutils_relative_chdir): If WEBKITREPODIR is set, change current directory to it.
+        * tests/test_utils.h: Coding style fixes.
+
 2011-07-12  Joseph Pecoraro  <[email protected]>
 
         ApplicationCache update should not immediately fail when reaching per-origin quota

Modified: trunk/Source/WebKit/gtk/tests/test_utils.c (90993 => 90994)


--- trunk/Source/WebKit/gtk/tests/test_utils.c	2011-07-14 13:28:19 UTC (rev 90993)
+++ trunk/Source/WebKit/gtk/tests/test_utils.c	2011-07-14 13:30:34 UTC (rev 90994)
@@ -22,29 +22,32 @@
 #include <glib.h>
 #include <glib/gstdio.h>
 
-int testutils_relative_chdir(const gchar* target_filename, const gchar* executable_path)
+int testutils_relative_chdir(const gchar *targetFilename, const gchar *executablePath)
 {
-    if (g_path_is_absolute(executable_path)) {
-        if (g_chdir(g_path_get_dirname(executable_path))) {
+    /* user can set location of the webkit repository directory if it differs from build directory */
+    const gchar *repoPath = g_getenv("WEBKITREPODIR");
+    if (repoPath) {
+        if (g_chdir(repoPath))
             return -1;
-        }
+    } else if (g_path_is_absolute(executablePath)) {
+        if (g_chdir(g_path_get_dirname(executablePath)))
+            return -1;
     }
 
-    while (!g_file_test(target_filename, G_FILE_TEST_EXISTS)) {
-        gchar *path_name;
-        if (g_chdir("..")) {
+    while (!g_file_test(targetFilename, G_FILE_TEST_EXISTS)) {
+        gchar *pathName;
+        if (g_chdir(".."))
             return -1;
-        }
-        g_assert(!g_str_equal((path_name = g_get_current_dir()), "/"));
-        g_free(path_name);
+        g_assert(!g_str_equal((pathName = g_get_current_dir()), "/"));
+        g_free(pathName);
     }
 
-    gchar* dirname = g_path_get_dirname(target_filename);
-    if (g_chdir(dirname)) {
-        g_free(dirname);
+    gchar *dirName = g_path_get_dirname(targetFilename);
+    if (g_chdir(dirName)) {
+        g_free(dirName);
         return -1;
     }
 
-    g_free(dirname);
+    g_free(dirName);
     return 0;
 }

Modified: trunk/Source/WebKit/gtk/tests/test_utils.h (90993 => 90994)


--- trunk/Source/WebKit/gtk/tests/test_utils.h	2011-07-14 13:28:19 UTC (rev 90993)
+++ trunk/Source/WebKit/gtk/tests/test_utils.h	2011-07-14 13:30:34 UTC (rev 90994)
@@ -1,3 +1,3 @@
 #include <glib.h>
 
-int testutils_relative_chdir(const gchar*, const gchar*);
+int testutils_relative_chdir(const gchar *targetFilename, const gchar *executablePath);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to