[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.22-985-g3c00f00
eric at webkit.org
eric at webkit.org
Wed Mar 17 17:57:49 UTC 2010
The following commit has been merged in the webkit-1.1 branch:
commit 043b942df39ad127f80b4fabfeab8e39891e825f
Author: eric at webkit.org <eric at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Tue Feb 23 22:43:23 2010 +0000
2010-02-23 Arno Renevier <arno at renevier.net>
Reviewed by Gustavo Noronha Silva.
[Gtk]: testwebview does not work when called with absolute path
https://bugs.webkit.org/show_bug.cgi?id=34940
When testwebview is called as absolute path, chdir to executable
directory before searching resource files.
* GNUmakefile.am:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@55173 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/ChangeLog b/ChangeLog
index 2ede05a..65c71bd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2010-02-23 Arno Renevier <arno at renevier.net>
+
+ Reviewed by Gustavo Noronha Silva.
+
+ [Gtk]: testwebview does not work when called with absolute path
+ https://bugs.webkit.org/show_bug.cgi?id=34940
+
+ When testwebview is called as absolute path, chdir to executable
+ directory before searching resource files.
+
+ * GNUmakefile.am:
+
2010-02-23 Leandro Pereira <leandro at profusion.mobi>
Reviewed by Gustavo Noronha Silva.
diff --git a/GNUmakefile.am b/GNUmakefile.am
index 5f6af48..854a1b0 100644
--- a/GNUmakefile.am
+++ b/GNUmakefile.am
@@ -596,7 +596,7 @@ Programs_unittests_testloading_CFLAGS = $(webkit_tests_cflags)
Programs_unittests_testloading_LDADD = $(webkit_tests_ldadd)
Programs_unittests_testloading_LDFLAGS = $(webkit_tests_ldflags)
-Programs_unittests_testmimehandling_SOURCES = WebKit/gtk/tests/testmimehandling.c
+Programs_unittests_testmimehandling_SOURCES = WebKit/gtk/tests/testmimehandling.c WebKit/gtk/tests/test_utils.c
Programs_unittests_testmimehandling_CFLAGS = $(webkit_tests_cflags)
Programs_unittests_testmimehandling_LDADD = $(webkit_tests_ldadd)
Programs_unittests_testmimehandling_LDFLAGS = $(webkit_tests_ldflags)
@@ -654,7 +654,7 @@ Programs_unittests_testwebdatasource_SOURCES = WebKit/gtk/tests/testwebdatasourc
Programs_unittests_testwebdatasource_CFLAGS = $(webkit_tests_cflags)
Programs_unittests_testwebdatasource_LDADD = $(webkit_tests_ldadd)
-Programs_unittests_testwebview_SOURCES = WebKit/gtk/tests/testwebview.c
+Programs_unittests_testwebview_SOURCES = WebKit/gtk/tests/testwebview.c WebKit/gtk/tests/test_utils.c
Programs_unittests_testwebview_CFLAGS = $(webkit_tests_cflags)
Programs_unittests_testwebview_LDADD = $(webkit_tests_ldadd)
Programs_unittests_testwebview_LDFLAGS = $(webkit_tests_ldflags)
diff --git a/WebKit/gtk/tests/test_utils.c b/WebKit/gtk/tests/test_utils.c
new file mode 100644
index 0000000..646fd25
--- /dev/null
+++ b/WebKit/gtk/tests/test_utils.c
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2010 Arno Renevier
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "test_utils.h"
+
+#include <glib.h>
+#include <glib/gstdio.h>
+
+int testutils_relative_chdir(const gchar* target_filename, const gchar* executable_path)
+{
+ if (g_path_is_absolute(executable_path)) {
+ if (g_chdir(g_path_get_dirname(executable_path))) {
+ return -1;
+ }
+ }
+
+ while (!g_file_test(target_filename, G_FILE_TEST_EXISTS)) {
+ gchar *path_name;
+ if (g_chdir("..")) {
+ return -1;
+ }
+ g_assert(!g_str_equal((path_name = g_get_current_dir()), "/"));
+ g_free(path_name);
+ }
+
+ gchar* dirname = g_path_get_dirname(target_filename);
+ if (g_chdir(dirname)) {
+ g_free(dirname);
+ return -1;
+ }
+
+ g_free(dirname);
+ return 0;
+}
diff --git a/WebKit/gtk/tests/test_utils.h b/WebKit/gtk/tests/test_utils.h
new file mode 100644
index 0000000..e761f74
--- /dev/null
+++ b/WebKit/gtk/tests/test_utils.h
@@ -0,0 +1,3 @@
+#include <glib.h>
+
+int testutils_relative_chdir(const gchar*, const gchar*);
diff --git a/WebKit/gtk/tests/testmimehandling.c b/WebKit/gtk/tests/testmimehandling.c
index e6e8d45..2ab0257 100644
--- a/WebKit/gtk/tests/testmimehandling.c
+++ b/WebKit/gtk/tests/testmimehandling.c
@@ -18,6 +18,8 @@
* Boston, MA 02110-1301, USA.
*/
+#include "test_utils.h"
+
#include <glib.h>
#include <glib/gstdio.h>
#include <libsoup/soup.h>
@@ -182,16 +184,7 @@ int main(int argc, char** argv)
gtk_test_init(&argc, &argv, NULL);
/* Hopefully make test independent of the path it's called from. */
- while (!g_file_test ("WebKit/gtk/tests/resources/test.html", G_FILE_TEST_EXISTS)) {
- gchar *path_name;
-
- g_chdir("..");
-
- g_assert(!g_str_equal((path_name = g_get_current_dir()), "/"));
- g_free(path_name);
- }
-
- g_chdir("WebKit/gtk/tests/resources/");
+ testutils_relative_chdir("WebKit/gtk/tests/resources/test.html", argv[0]);
server = soup_server_new(SOUP_SERVER_PORT, 0, NULL);
soup_server_run_async(server);
diff --git a/WebKit/gtk/tests/testwebview.c b/WebKit/gtk/tests/testwebview.c
index 34b6867..ceac8a0 100644
--- a/WebKit/gtk/tests/testwebview.c
+++ b/WebKit/gtk/tests/testwebview.c
@@ -18,6 +18,8 @@
* Boston, MA 02110-1301, USA.
*/
+#include "test_utils.h"
+
#include <errno.h>
#include <unistd.h>
#include <string.h>
@@ -233,16 +235,7 @@ int main(int argc, char** argv)
gtk_test_init(&argc, &argv, NULL);
/* Hopefully make test independent of the path it's called from. */
- while (!g_file_test ("WebKit/gtk/tests/resources/test.html", G_FILE_TEST_EXISTS)) {
- gchar *path_name;
-
- g_chdir("..");
-
- g_assert(!g_str_equal((path_name = g_get_current_dir()), "/"));
- g_free(path_name);
- }
-
- g_chdir("WebKit/gtk/tests/resources/");
+ testutils_relative_chdir("WebKit/gtk/tests/resources/test.html", argv[0]);
server = soup_server_new(SOUP_SERVER_PORT, 0, NULL);
soup_server_run_async(server);
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list