Diff
Modified: trunk/Source/WebKit/chromium/ChangeLog (128627 => 128628)
--- trunk/Source/WebKit/chromium/ChangeLog 2012-09-14 17:28:11 UTC (rev 128627)
+++ trunk/Source/WebKit/chromium/ChangeLog 2012-09-14 17:37:44 UTC (rev 128628)
@@ -1,3 +1,38 @@
+2012-09-14 Peter Beverloo <[email protected]>
+
+ [Chromium] Support the --{in,out,err}-fifo arguments on TestWebKitAPI and webkit_unit_tests
+ https://bugs.webkit.org/show_bug.cgi?id=96687
+
+ Reviewed by Tony Chang.
+
+ Android's DumpRenderTree currently supports these arguments, implemented
+ as part of TestShellAndroid:
+ http://trac.webkit.org/browser/trunk/Tools/DumpRenderTree/chromium/TestShellAndroid.cpp?rev=128496
+
+ They're used by the layout test runner to get the STDOUT and STDERR while
+ a layout test run is in process, which is a safer alternative to parsing
+ all the logcat output manually. The implementation can be seen here:
+ http://trac.webkit.org/browser/trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium_android.py?rev=128496#L590
+
+ This patch generalizes parsing of and applying the effects of these arguments
+ so that they can be used for TestWebKitAPI and webkit_unit_tests as well.
+ After this patch, this will make it possible to pull out the output-reading
+ code from Android's layout test port and generalize it so it can be re-used
+ in the new test-runner for the other two test suites.
+
+ This has no effect when compiling and running these tests as part of Chromium
+ code, which has a much more advanced test-runner that does parse complete log
+ output, but also directly depends on code licensed under Apache 2.
+
+ * WebKit.gypi:
+ * tests/ForwardIOStreamsAndroid.cpp: Added.
+ (WebKit):
+ (WebKit::maybeInitIOStreamForwardingForAndroid):
+ * tests/ForwardIOStreamsAndroid.h: Added.
+ (WebKit):
+ * tests/RunAllTests.cpp:
+ (main):
+
2012-09-14 Keishi Hattori <[email protected]>
Make time input lang attribute aware for testing
Modified: trunk/Source/WebKit/chromium/WebKitUnitTests.gyp (128627 => 128628)
--- trunk/Source/WebKit/chromium/WebKitUnitTests.gyp 2012-09-14 17:28:11 UTC (rev 128627)
+++ trunk/Source/WebKit/chromium/WebKitUnitTests.gyp 2012-09-14 17:37:44 UTC (rev 128628)
@@ -126,6 +126,7 @@
'type': 'shared_library',
'dependencies': [
'<(chromium_src_dir)/testing/android/native_test.gyp:native_test_native_code',
+ 'io_stream_forwarder_android',
],
}],
],
@@ -208,6 +209,20 @@
'<(android_app_abi)',
],
}],
+ },
+ # FIXME: When the Android test runner framework in Chromium has stabilized enough,
+ # we should switch to using that and will no longer need the stream forwarding.
+ # https://bugs.webkit.org/show_bug.cgi?id=96764
+ {
+ 'target_name': 'io_stream_forwarder_android',
+ 'type': 'static_library',
+ 'sources': [
+ 'tests/ForwardIOStreamsAndroid.cpp',
+ 'tests/ForwardIOStreamsAndroid.h',
+ ],
+ 'dependencies': [
+ '../../WebCore/WebCore.gyp/WebCore.gyp:webcore',
+ ],
}],
}],
],
Copied: trunk/Source/WebKit/chromium/tests/ForwardIOStreamsAndroid.cpp (from rev 128627, trunk/Tools/DumpRenderTree/chromium/TestShellAndroid.cpp) (0 => 128628)
--- trunk/Source/WebKit/chromium/tests/ForwardIOStreamsAndroid.cpp (rev 0)
+++ trunk/Source/WebKit/chromium/tests/ForwardIOStreamsAndroid.cpp 2012-09-14 17:37:44 UTC (rev 128628)
@@ -0,0 +1,125 @@
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#include "ForwardIOStreamsAndroid.h"
+
+#include <android/log.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include <wtf/StdLibExtras.h>
+
+#ifndef EXIT_FAILURE
+#define EXIT_FAILURE 1
+#endif
+
+namespace {
+
+const char optionInFIFO[] = "--in-fifo=";
+const char optionOutFIFO[] = "--out-fifo=";
+const char optionErrFIFO[] = "--err-fifo=";
+
+void androidLogError(const char* format, ...) WTF_ATTRIBUTE_PRINTF(1, 2);
+
+void androidLogError(const char* format, ...)
+{
+ va_list args;
+ va_start(args, format);
+ __android_log_vprint(ANDROID_LOG_ERROR, "WebKit", format, args);
+ va_end(args);
+}
+
+void removeArg(int index, int* argc, char*** argv)
+{
+ for (int i = index; i < *argc; ++i)
+ (*argv)[i] = (*argv)[i + 1];
+ --*argc;
+}
+
+void createFIFO(const char* fifoPath)
+{
+ unlink(fifoPath);
+ // 0666 is rw-rw-rw-, to allow adb shell to read/write the fifo.
+ // Explicitly call chmod to ensure the mode is set despite umask.
+ if (mkfifo(fifoPath, 0666) || chmod(fifoPath, 0666)) {
+ androidLogError("Failed to create fifo %s: %s\n", fifoPath, strerror(errno));
+ exit(EXIT_FAILURE);
+ }
+}
+
+void redirect(FILE* stream, const char* path, const char* mode)
+{
+ if (!freopen(path, mode, stream)) {
+ androidLogError("Failed to redirect stream to file: %s: %s\n", path, strerror(errno));
+ exit(EXIT_FAILURE);
+ }
+}
+
+} // namespace
+
+namespace WebKit {
+
+void maybeInitIOStreamForwardingForAndroid(int* argc, char*** argv)
+{
+ const char* inFIFO = 0;
+ const char* outFIFO = 0;
+ const char* errFIFO = 0;
+ for (int i = 1; i < *argc; ) {
+ const char* argument = (*argv)[i];
+ if (strstr(argument, optionInFIFO) == argument) {
+ inFIFO = argument + WTF_ARRAY_LENGTH(optionInFIFO) - 1;
+ createFIFO(inFIFO);
+ removeArg(i, argc, argv);
+ } else if (strstr(argument, optionOutFIFO) == argument) {
+ outFIFO = argument + WTF_ARRAY_LENGTH(optionOutFIFO) - 1;
+ createFIFO(outFIFO);
+ removeArg(i, argc, argv);
+ } else if (strstr(argument, optionErrFIFO) == argument) {
+ errFIFO = argument + WTF_ARRAY_LENGTH(optionErrFIFO) - 1;
+ createFIFO(errFIFO);
+ removeArg(i, argc, argv);
+ } else
+ ++i;
+ }
+
+ // The order of createFIFO() and redirectToFIFO() is important to avoid deadlock.
+ if (outFIFO)
+ redirect(stdout, outFIFO, "w");
+ if (inFIFO)
+ redirect(stdin, inFIFO, "r");
+ if (errFIFO)
+ redirect(stderr, errFIFO, "w");
+ else {
+ // Redirect stderr to stdout.
+ dup2(1, 2);
+ }
+}
+
+} // namespace WebKit
Added: trunk/Source/WebKit/chromium/tests/ForwardIOStreamsAndroid.h (0 => 128628)
--- trunk/Source/WebKit/chromium/tests/ForwardIOStreamsAndroid.h (rev 0)
+++ trunk/Source/WebKit/chromium/tests/ForwardIOStreamsAndroid.h 2012-09-14 17:37:44 UTC (rev 128628)
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ForwardIOStreamsAndroid_h
+#define ForwardIOStreamsAndroid_h
+
+namespace WebKit {
+
+// The test executables for Android support three additional command line flags
+// (--in-fifo, --out-fifo and --err-fifo) to make it possible to retrieve input
+// from a file instead of STDIN, and to forward STDOUT and STDERR to files. When
+// running DumpRenderTree, TestWebKitAPI or webkit_unit_tests in WebKit
+// infrastructure, these will be used instead of parsing all log output.
+void maybeInitIOStreamForwardingForAndroid(int* argc, char*** argv);
+
+} // namespace WebKit
+
+#endif // ForwardIOStreamsAndroid_h
Modified: trunk/Source/WebKit/chromium/tests/RunAllTests.cpp (128627 => 128628)
--- trunk/Source/WebKit/chromium/tests/RunAllTests.cpp 2012-09-14 17:28:11 UTC (rev 128627)
+++ trunk/Source/WebKit/chromium/tests/RunAllTests.cpp 2012-09-14 17:37:44 UTC (rev 128628)
@@ -43,6 +43,10 @@
#include "WebUnitTests.h"
#endif
+#if defined(OS_ANDROID)
+#include "ForwardIOStreamsAndroid.h"
+#endif
+
#include <gmock/gmock.h>
// TestSuite must be created before SetUpTestEnvironment so it performs
@@ -59,6 +63,9 @@
WebKit::DeleteTestSuite();
#else
::testing::InitGoogleMock(&argc, argv);
+#if defined(OS_ANDROID)
+ WebKit::maybeInitIOStreamForwardingForAndroid(&argc, &argv);
+#endif
TestSuite testSuite(argc, argv);
webkit_support::SetUpTestEnvironmentForUnitTests();
int result = testSuite.Run();
Modified: trunk/Tools/ChangeLog (128627 => 128628)
--- trunk/Tools/ChangeLog 2012-09-14 17:28:11 UTC (rev 128627)
+++ trunk/Tools/ChangeLog 2012-09-14 17:37:44 UTC (rev 128628)
@@ -1,3 +1,34 @@
+2012-09-14 Peter Beverloo <[email protected]>
+
+ [Chromium] Support the --{in,out,err}-fifo arguments on TestWebKitAPI and webkit_unit_tests
+ https://bugs.webkit.org/show_bug.cgi?id=96687
+
+ Reviewed by Tony Chang.
+
+ Android's DumpRenderTree currently supports these arguments, implemented
+ as part of TestShellAndroid:
+ http://trac.webkit.org/browser/trunk/Tools/DumpRenderTree/chromium/TestShellAndroid.cpp?rev=128496
+
+ They're used by the layout test runner to get the STDOUT and STDERR while
+ a layout test run is in process, which is a safer alternative to parsing
+ all the logcat output manually. The implementation can be seen here:
+ http://trac.webkit.org/browser/trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium_android.py?rev=128496#L590
+
+ This patch generalizes parsing of and applying the effects of these arguments
+ so that they can be used for TestWebKitAPI and webkit_unit_tests as well.
+ After this patch, this will make it possible to pull out the output-reading
+ code from Android's layout test port and generalize it so it can be re-used
+ in the new test-runner for the other two test suites.
+
+ This has no effect when compiling and running these tests as part of Chromium
+ code, which has a much more advanced test-runner that does parse complete log
+ output, but also directly depends on code licensed under Apache 2.
+
+ * DumpRenderTree/DumpRenderTree.gyp/DumpRenderTree.gyp:
+ * DumpRenderTree/chromium/TestShellAndroid.cpp:
+ (platformInit):
+ * TestWebKitAPI/TestWebKitAPI.gyp/TestWebKitAPI.gyp:
+
2012-09-14 Zoltan Horvath <[email protected]>
check-webkit-style should not warn in case of NONCOPYABLE and FAST_ALLOCATED macros
Modified: trunk/Tools/DumpRenderTree/DumpRenderTree.gyp/DumpRenderTree.gyp (128627 => 128628)
--- trunk/Tools/DumpRenderTree/DumpRenderTree.gyp/DumpRenderTree.gyp 2012-09-14 17:28:11 UTC (rev 128627)
+++ trunk/Tools/DumpRenderTree/DumpRenderTree.gyp/DumpRenderTree.gyp 2012-09-14 17:37:44 UTC (rev 128628)
@@ -285,6 +285,7 @@
'<(chromium_src_dir)/testing/android/native_test.gyp:native_test_native_code',
'<(chromium_src_dir)/tools/android/forwarder/forwarder.gyp:forwarder',
'<(chromium_src_dir)/tools/android/md5sum/md5sum.gyp:md5sum',
+ '<(source_dir)/WebKit/chromium/WebKitUnitTests.gyp:io_stream_forwarder_android',
],
'dependencies!': [
'ImageDiff',
Modified: trunk/Tools/DumpRenderTree/chromium/TestShellAndroid.cpp (128627 => 128628)
--- trunk/Tools/DumpRenderTree/chromium/TestShellAndroid.cpp 2012-09-14 17:28:11 UTC (rev 128627)
+++ trunk/Tools/DumpRenderTree/chromium/TestShellAndroid.cpp 2012-09-14 17:37:44 UTC (rev 128628)
@@ -32,15 +32,8 @@
#include "TestShell.h"
#include "linux/WebFontRendering.h"
+#include "tests/ForwardIOStreamsAndroid.h"
#include "third_party/skia/include/ports/SkTypeface_android.h"
-#include <android/log.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <unistd.h>
-#include <wtf/Assertions.h>
namespace {
@@ -51,46 +44,6 @@
const char fontFallbackConfigFile[] = DEVICE_DRT_DIR "android_fallback_fonts.xml";
const char fontsDir[] = DEVICE_DRT_DIR "fonts/";
-const char optionInFIFO[] = "--in-fifo=";
-const char optionOutFIFO[] = "--out-fifo=";
-const char optionErrFIFO[] = "--err-fifo=";
-
-void androidLogError(const char* format, ...) WTF_ATTRIBUTE_PRINTF(1, 2);
-
-void androidLogError(const char* format, ...)
-{
- va_list args;
- va_start(args, format);
- __android_log_vprint(ANDROID_LOG_ERROR, "DumpRenderTree", format, args);
- va_end(args);
-}
-
-void removeArg(int index, int* argc, char*** argv)
-{
- for (int i = index; i < *argc; ++i)
- (*argv)[i] = (*argv)[i + 1];
- --*argc;
-}
-
-void createFIFO(const char* fifoPath)
-{
- unlink(fifoPath);
- // 0666 is rw-rw-rw-, to allow adb shell to read/write the fifo.
- // Explicitly call chmod to ensure the mode is set despite umask.
- if (mkfifo(fifoPath, 0666) || chmod(fifoPath, 0666)) {
- androidLogError("Failed to create fifo %s: %s\n", fifoPath, strerror(errno));
- exit(EXIT_FAILURE);
- }
-}
-
-void redirect(FILE* stream, const char* path, const char* mode)
-{
- if (!freopen(path, mode, stream)) {
- androidLogError("Failed to redirect stream to file: %s: %s\n", path, strerror(errno));
- exit(EXIT_FAILURE);
- }
-}
-
} // namespace
void platformInit(int* argc, char*** argv)
@@ -98,39 +51,9 @@
// Initialize skia with customized font config files.
SkUseTestFontConfigFile(fontMainConfigFile, fontFallbackConfigFile, fontsDir);
- const char* inFIFO = 0;
- const char* outFIFO = 0;
- const char* errFIFO = 0;
- for (int i = 1; i < *argc; ) {
- const char* argument = (*argv)[i];
- if (strstr(argument, optionInFIFO) == argument) {
- inFIFO = argument + WTF_ARRAY_LENGTH(optionInFIFO) - 1;
- createFIFO(inFIFO);
- removeArg(i, argc, argv);
- } else if (strstr(argument, optionOutFIFO) == argument) {
- outFIFO = argument + WTF_ARRAY_LENGTH(optionOutFIFO) - 1;
- createFIFO(outFIFO);
- removeArg(i, argc, argv);
- } else if (strstr(argument, optionErrFIFO) == argument) {
- errFIFO = argument + WTF_ARRAY_LENGTH(optionErrFIFO) - 1;
- createFIFO(errFIFO);
- removeArg(i, argc, argv);
- } else
- ++i;
- }
+ // Set up IO stream forwarding if necessary.
+ WebKit::maybeInitIOStreamForwardingForAndroid(argc, argv);
- // The order of createFIFO() and redirectToFIFO() is important to avoid deadlock.
- if (outFIFO)
- redirect(stdout, outFIFO, "w");
- if (inFIFO)
- redirect(stdin, inFIFO, "r");
- if (errFIFO)
- redirect(stderr, errFIFO, "w");
- else {
- // Redirect stderr to stdout.
- dup2(1, 2);
- }
-
// Disable auto hint and use normal hinting in layout test mode to produce the same font metrics as chromium-linux.
WebKit::WebFontRendering::setAutoHint(false);
WebKit::WebFontRendering::setHinting(SkPaint::kNormal_Hinting);
Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.gyp/TestWebKitAPI.gyp (128627 => 128628)
--- trunk/Tools/TestWebKitAPI/TestWebKitAPI.gyp/TestWebKitAPI.gyp 2012-09-14 17:28:11 UTC (rev 128627)
+++ trunk/Tools/TestWebKitAPI/TestWebKitAPI.gyp/TestWebKitAPI.gyp 2012-09-14 17:37:44 UTC (rev 128628)
@@ -87,6 +87,7 @@
'type': 'shared_library',
'dependencies': [
'<(chromium_src_dir)/testing/android/native_test.gyp:native_test_native_code',
+ '<(source_dir)/WebKit/chromium/WebKitUnitTests.gyp:io_stream_forwarder_android',
],
}],
],