Title: [220562] trunk
Revision
220562
Author
utatane....@gmail.com
Date
2017-08-10 16:42:14 -0700 (Thu, 10 Aug 2017)

Log Message

Run more WTF tests
https://bugs.webkit.org/show_bug.cgi?id=174970

Reviewed by Michael Catanzaro.

Source/WTF:

CHAR_BIT is not defined.

* wtf/LEBDecoder.h:

Tools:

Some of WTF tests are not executed in non Apple ports while they are generic ones.
This patch adds these tests to non-Apple port TestWebKitAPI.
Currently, we do not add Signals.cpp since it depends on signal functionality.

* TestWebKitAPI/CMakeLists.txt:
* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WTF/PriorityQueue.cpp:
(isHigherPriority):
(TEST):
* TestWebKitAPI/Tests/WTF/Signals.cpp: Copied from Tools/TestWebKitAPI/Tests/WTF/ThreadMessages.cpp.
(TEST):
* TestWebKitAPI/Tests/WTF/ThreadMessages.cpp:
(TEST):

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (220561 => 220562)


--- trunk/Source/WTF/ChangeLog	2017-08-10 23:21:03 UTC (rev 220561)
+++ trunk/Source/WTF/ChangeLog	2017-08-10 23:42:14 UTC (rev 220562)
@@ -1,3 +1,14 @@
+2017-08-10  Yusuke Suzuki  <utatane....@gmail.com>
+
+        Run more WTF tests
+        https://bugs.webkit.org/show_bug.cgi?id=174970
+
+        Reviewed by Michael Catanzaro.
+
+        CHAR_BIT is not defined.
+
+        * wtf/LEBDecoder.h:
+
 2017-08-09  Yusuke Suzuki  <utatane....@gmail.com>
 
         [WTF] ThreadSpecific should not introduce additional indirection

Modified: trunk/Source/WTF/wtf/LEBDecoder.h (220561 => 220562)


--- trunk/Source/WTF/wtf/LEBDecoder.h	2017-08-10 23:21:03 UTC (rev 220561)
+++ trunk/Source/WTF/wtf/LEBDecoder.h	2017-08-10 23:42:14 UTC (rev 220562)
@@ -27,6 +27,7 @@
 
 #include "Compiler.h"
 #include <algorithm>
+#include <limits.h>
 
 // This file contains a bunch of helper functions for decoding LEB numbers.
 // See https://en.wikipedia.org/wiki/LEB128 for more information about the

Modified: trunk/Tools/ChangeLog (220561 => 220562)


--- trunk/Tools/ChangeLog	2017-08-10 23:21:03 UTC (rev 220561)
+++ trunk/Tools/ChangeLog	2017-08-10 23:42:14 UTC (rev 220562)
@@ -1,3 +1,24 @@
+2017-08-10  Yusuke Suzuki  <utatane....@gmail.com>
+
+        Run more WTF tests
+        https://bugs.webkit.org/show_bug.cgi?id=174970
+
+        Reviewed by Michael Catanzaro.
+
+        Some of WTF tests are not executed in non Apple ports while they are generic ones.
+        This patch adds these tests to non-Apple port TestWebKitAPI.
+        Currently, we do not add Signals.cpp since it depends on signal functionality.
+
+        * TestWebKitAPI/CMakeLists.txt:
+        * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+        * TestWebKitAPI/Tests/WTF/PriorityQueue.cpp:
+        (isHigherPriority):
+        (TEST):
+        * TestWebKitAPI/Tests/WTF/Signals.cpp: Copied from Tools/TestWebKitAPI/Tests/WTF/ThreadMessages.cpp.
+        (TEST):
+        * TestWebKitAPI/Tests/WTF/ThreadMessages.cpp:
+        (TEST):
+
 2017-08-10  obinna obike  <oob...@apple.com>
 
         Remove obsolete link from webkit-queues status page

Modified: trunk/Tools/TestWebKitAPI/CMakeLists.txt (220561 => 220562)


--- trunk/Tools/TestWebKitAPI/CMakeLists.txt	2017-08-10 23:21:03 UTC (rev 220561)
+++ trunk/Tools/TestWebKitAPI/CMakeLists.txt	2017-08-10 23:42:14 UTC (rev 220562)
@@ -42,10 +42,10 @@
     ${TESTWEBKITAPI_DIR}/TestsController.cpp
     ${TESTWEBKITAPI_DIR}/Tests/WTF/AtomicString.cpp
     ${TESTWEBKITAPI_DIR}/Tests/WTF/BloomFilter.cpp
-    ${TESTWEBKITAPI_DIR}/Tests/WTF/CrossThreadTask.cpp
     ${TESTWEBKITAPI_DIR}/Tests/WTF/CString.cpp
     ${TESTWEBKITAPI_DIR}/Tests/WTF/CheckedArithmeticOperations.cpp
     ${TESTWEBKITAPI_DIR}/Tests/WTF/Condition.cpp
+    ${TESTWEBKITAPI_DIR}/Tests/WTF/CrossThreadTask.cpp
     ${TESTWEBKITAPI_DIR}/Tests/WTF/DateMath.cpp
     ${TESTWEBKITAPI_DIR}/Tests/WTF/Deque.cpp
     ${TESTWEBKITAPI_DIR}/Tests/WTF/EnumTraits.cpp
@@ -55,6 +55,7 @@
     ${TESTWEBKITAPI_DIR}/Tests/WTF/HashMap.cpp
     ${TESTWEBKITAPI_DIR}/Tests/WTF/HashSet.cpp
     ${TESTWEBKITAPI_DIR}/Tests/WTF/IntegerToStringConversion.cpp
+    ${TESTWEBKITAPI_DIR}/Tests/WTF/LEBDecoder.cpp
     ${TESTWEBKITAPI_DIR}/Tests/WTF/LifecycleLogger.cpp
     ${TESTWEBKITAPI_DIR}/Tests/WTF/ListHashSet.cpp
     ${TESTWEBKITAPI_DIR}/Tests/WTF/Lock.cpp
@@ -68,6 +69,7 @@
     ${TESTWEBKITAPI_DIR}/Tests/WTF/Optional.cpp
     ${TESTWEBKITAPI_DIR}/Tests/WTF/OptionSet.cpp
     ${TESTWEBKITAPI_DIR}/Tests/WTF/ParkingLot.cpp
+    ${TESTWEBKITAPI_DIR}/Tests/WTF/PriorityQueue.cpp
     ${TESTWEBKITAPI_DIR}/Tests/WTF/RedBlackTree.cpp
     ${TESTWEBKITAPI_DIR}/Tests/WTF/Ref.cpp
     ${TESTWEBKITAPI_DIR}/Tests/WTF/RefCounter.cpp
@@ -79,12 +81,15 @@
     ${TESTWEBKITAPI_DIR}/Tests/WTF/ScopedLambda.cpp
     ${TESTWEBKITAPI_DIR}/Tests/WTF/SetForScope.cpp
     ${TESTWEBKITAPI_DIR}/Tests/WTF/StringBuilder.cpp
+    ${TESTWEBKITAPI_DIR}/Tests/WTF/StringConcatenate.cpp
     ${TESTWEBKITAPI_DIR}/Tests/WTF/StringHasher.cpp
     ${TESTWEBKITAPI_DIR}/Tests/WTF/StringImpl.cpp
     ${TESTWEBKITAPI_DIR}/Tests/WTF/StringOperators.cpp
     ${TESTWEBKITAPI_DIR}/Tests/WTF/StringView.cpp
+    ${TESTWEBKITAPI_DIR}/Tests/WTF/SynchronizedFixedQueue.cpp
     ${TESTWEBKITAPI_DIR}/Tests/WTF/TextBreakIterator.cpp
     ${TESTWEBKITAPI_DIR}/Tests/WTF/ThreadGroup.cpp
+    ${TESTWEBKITAPI_DIR}/Tests/WTF/ThreadMessages.cpp
     ${TESTWEBKITAPI_DIR}/Tests/WTF/Time.cpp
     ${TESTWEBKITAPI_DIR}/Tests/WTF/UniqueRef.cpp
     ${TESTWEBKITAPI_DIR}/Tests/WTF/Variant.cpp

Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (220561 => 220562)


--- trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj	2017-08-10 23:21:03 UTC (rev 220561)
+++ trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj	2017-08-10 23:42:14 UTC (rev 220562)
@@ -645,6 +645,7 @@
 		D34E08761E4E42E1005FF14A /* WKWebViewGetContents.mm in Sources */ = {isa = PBXBuildFile; fileRef = D3BE5E341E4CE85E00FD563A /* WKWebViewGetContents.mm */; };
 		E1220DCA155B28AA0013E2FC /* MemoryCacheDisableWithinResourceLoadDelegate.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = E1220DC9155B287D0013E2FC /* MemoryCacheDisableWithinResourceLoadDelegate.html */; };
 		E194E1BD177E53C7009C4D4E /* StopLoadingFromDidReceiveResponse.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = E194E1BC177E534A009C4D4E /* StopLoadingFromDidReceiveResponse.html */; };
+		E373D7911F2CF35200C6FAAF /* Signals.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E3953F951F2CF32100A76A2E /* Signals.cpp */; };
 		E3DEA8111F0A589000CBC2E8 /* ThreadGroup.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E3DEA8101F0A588000CBC2E8 /* ThreadGroup.cpp */; };
 		ECA680CE1E68CC0900731D20 /* StringUtilities.mm in Sources */ = {isa = PBXBuildFile; fileRef = ECA680CD1E68CC0900731D20 /* StringUtilities.mm */; };
 		F407FE391F1D0DFC0017CF25 /* enormous.svg in Copy Resources */ = {isa = PBXBuildFile; fileRef = F407FE381F1D0DE60017CF25 /* enormous.svg */; };
@@ -1652,6 +1653,7 @@
 		E194E1BA177E5145009C4D4E /* StopLoadingFromDidReceiveResponse.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = StopLoadingFromDidReceiveResponse.mm; sourceTree = "<group>"; };
 		E194E1BC177E534A009C4D4E /* StopLoadingFromDidReceiveResponse.html */ = {isa = PBXFileReference; lastKnownFileType = text.html; path = StopLoadingFromDidReceiveResponse.html; sourceTree = "<group>"; };
 		E19DB9781B32137C00DB38D4 /* NavigatorLanguage.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = NavigatorLanguage.mm; sourceTree = "<group>"; };
+		E3953F951F2CF32100A76A2E /* Signals.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Signals.cpp; sourceTree = "<group>"; };
 		E3DEA8101F0A588000CBC2E8 /* ThreadGroup.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ThreadGroup.cpp; sourceTree = "<group>"; };
 		E40019301ACE9B5C001B0A2A /* BloomFilter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BloomFilter.cpp; sourceTree = "<group>"; };
 		E490296714E2E3A4002BEDD1 /* TypingStyleCrash.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = TypingStyleCrash.mm; sourceTree = "<group>"; };
@@ -2448,6 +2450,7 @@
 				DC69AA621CF77C6500C6272F /* ScopedLambda.cpp */,
 				0BCD85691485C98B00EA2003 /* SetForScope.cpp */,
 				CD5393C91757BAC400C07123 /* SHA1.cpp */,
+				E3953F951F2CF32100A76A2E /* Signals.cpp */,
 				81B50192140F232300D9EB58 /* StringBuilder.cpp */,
 				7CD4C26C1E2C0E6E00929470 /* StringConcatenate.cpp */,
 				93ABA80816DDAB91002DB2FA /* StringHasher.cpp */,
@@ -3000,6 +3003,7 @@
 				7C83DF121D0A590C00FEBCF3 /* ScopedLambda.cpp in Sources */,
 				7C83DF3D1D0A590C00FEBCF3 /* SetForScope.cpp in Sources */,
 				7C83DF2A1D0A590C00FEBCF3 /* SHA1.cpp in Sources */,
+				E373D7911F2CF35200C6FAAF /* Signals.cpp in Sources */,
 				7C83DF321D0A590C00FEBCF3 /* StringBuilder.cpp in Sources */,
 				7CD4C26E1E2C0E6E00929470 /* StringConcatenate.cpp in Sources */,
 				7C83DF361D0A590C00FEBCF3 /* StringHasher.cpp in Sources */,
@@ -3069,6 +3073,7 @@
 				8349D3C21DB96DDE004A9F65 /* ContextMenuDownload.mm in Sources */,
 				5C2936931D5BF70D00DEAB1E /* CookieAcceptPolicy.mm in Sources */,
 				51D1249B1E785425002B2820 /* CookieManager.cpp in Sources */,
+				9999108B1F393C96008AD455 /* Copying.mm in Sources */,
 				7CCE7EAC1A411A3400447C4C /* Counters.cpp in Sources */,
 				7AEAD47F1E20116C00416EFE /* CrossPartitionFileSchemeAccess.mm in Sources */,
 				7CCE7EDB1A411A9200447C4C /* CSSParser.cpp in Sources */,
@@ -3318,7 +3323,6 @@
 				51DB16CE1F085137001FA4C5 /* WebViewIconLoading.mm in Sources */,
 				7CCE7F1B1A411AE600447C4C /* WillLoad.cpp in Sources */,
 				7CCE7ED71A411A7E00447C4C /* WillPerformClientRedirectToURLCrash.mm in Sources */,
-				9999108B1F393C96008AD455 /* Copying.mm in Sources */,
 				7CCE7F1C1A411AE600447C4C /* WillSendSubmitEvent.cpp in Sources */,
 				7CCE7ED81A411A7E00447C4C /* WillSendSubmitEvent.mm in Sources */,
 				7CCE7ED91A411A7E00447C4C /* WindowlessWebViewWithMedia.mm in Sources */,

Modified: trunk/Tools/TestWebKitAPI/Tests/WTF/PriorityQueue.cpp (220561 => 220562)


--- trunk/Tools/TestWebKitAPI/Tests/WTF/PriorityQueue.cpp	2017-08-10 23:21:03 UTC (rev 220561)
+++ trunk/Tools/TestWebKitAPI/Tests/WTF/PriorityQueue.cpp	2017-08-10 23:42:14 UTC (rev 220562)
@@ -97,15 +97,16 @@
 }
 
 template<bool (*isHigherPriority)(const unsigned&, const unsigned&)>
-static bool compareMove(const MoveOnly& m1, const MoveOnly& m2)
-{
-    return isHigherPriority(m1.value(), m2.value());
-}
+struct CompareMove {
+    static bool compare(const MoveOnly& m1, const MoveOnly& m2)
+    {
+        return isHigherPriority(m1.value(), m2.value());
+    }
+};
 
-
 TEST(WTF_PriorityQueue, MoveOnly)
 {
-    PriorityQueue<MoveOnly, compareMove<isLessThan<unsigned>>> queue;
+    PriorityQueue<MoveOnly, CompareMove<isLessThan<unsigned>>::compare> queue;
 
     Vector<unsigned> values = { 23, 54, 4, 8, 1, 2, 4, 0 };
     Vector<unsigned> sorted = values;
@@ -122,7 +123,7 @@
 
 TEST(WTF_PriorityQueue, DecreaseKey)
 {
-    PriorityQueue<MoveOnly, compareMove<isLessThan<unsigned>>> queue;
+    PriorityQueue<MoveOnly, CompareMove<isLessThan<unsigned>>::compare> queue;
 
     Vector<unsigned> values = { 23, 54, 4, 8, 1, 2, 4, 0 };
     Vector<unsigned> sorted = values;
@@ -148,7 +149,7 @@
 
 TEST(WTF_PriorityQueue, IncreaseKey)
 {
-    PriorityQueue<MoveOnly, compareMove<isGreaterThan<unsigned>>> queue;
+    PriorityQueue<MoveOnly, CompareMove<isGreaterThan<unsigned>>::compare> queue;
 
     Vector<unsigned> values = { 23, 54, 4, 8, 1, 2, 4, 0 };
     Vector<unsigned> sorted = values;
@@ -174,7 +175,7 @@
 
 TEST(WTF_PriorityQueue, Iteration)
 {
-    PriorityQueue<MoveOnly, compareMove<isGreaterThan<unsigned>>> queue;
+    PriorityQueue<MoveOnly, CompareMove<isGreaterThan<unsigned>>::compare> queue;
 
     Vector<unsigned> values = { 23, 54, 4, 8, 1, 2, 4, 0 };
     Vector<unsigned> sorted = values;

Copied: trunk/Tools/TestWebKitAPI/Tests/WTF/Signals.cpp (from rev 220556, trunk/Tools/TestWebKitAPI/Tests/WTF/ThreadMessages.cpp) (0 => 220562)


--- trunk/Tools/TestWebKitAPI/Tests/WTF/Signals.cpp	                        (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WTF/Signals.cpp	2017-08-10 23:42:14 UTC (rev 220562)
@@ -0,0 +1,67 @@
+/*
+ * Copyright (C) 2017 Apple 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 INC. 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 INC. 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 <type_traits>
+#include <wtf/DataLog.h>
+#include <wtf/Threading.h>
+#include <wtf/threads/Signals.h>
+
+class ReflectedThread : public Thread {
+public:
+    using Thread::m_mutex;
+    using Thread::m_handle;
+    using Thread::hasExited;
+};
+
+TEST(Signals, SignalsWorkOnExit)
+{
+    static bool handlerRan = false;
+    installSignalHandler(Signal::Usr, [] (Signal, SigInfo&, PlatformRegisters&) -> SignalAction {
+        dataLogLn("here");
+        handlerRan = true;
+        return SignalAction::Handled;
+    });
+
+    Atomic<bool> receiverShouldKeepRunning(true);
+    RefPtr<Thread> receiverThread = (Thread::create("ThreadMessage receiver",
+        [&receiverShouldKeepRunning] () {
+            while (receiverShouldKeepRunning.load()) { }
+    }));
+    ASSERT_TRUE(receiverThread);
+
+    bool signalFired;
+    {
+        std::unique_lock<std::mutex> locker(static_cast<ReflectedThread*>(receiverThread.get())->m_mutex);
+        receiverShouldKeepRunning.store(false);
+        EXPECT_FALSE(static_cast<ReflectedThread*>(receiverThread.get())->hasExited());
+        sleep(1);
+        signalFired = !pthread_kill(static_cast<ReflectedThread*>(receiverThread.get())->m_handle, std::get<0>(toSystemSignal(Signal::Usr)));
+    }
+
+    receiverThread->waitForCompletion();
+    EXPECT_TRUE(handlerRan || !signalFired);
+}

Modified: trunk/Tools/TestWebKitAPI/Tests/WTF/ThreadMessages.cpp (220561 => 220562)


--- trunk/Tools/TestWebKitAPI/Tests/WTF/ThreadMessages.cpp	2017-08-10 23:21:03 UTC (rev 220561)
+++ trunk/Tools/TestWebKitAPI/Tests/WTF/ThreadMessages.cpp	2017-08-10 23:42:14 UTC (rev 220562)
@@ -25,13 +25,10 @@
 
 #include "config.h"
 
-#include <type_traits>
-#include <wtf/DataLog.h>
 #include <wtf/HashSet.h>
 #include <wtf/Ref.h>
 #include <wtf/ThreadMessage.h>
 #include <wtf/Vector.h>
-#include <wtf/threads/Signals.h>
 
 static void runThreadMessageTest(unsigned numSenders, unsigned numMessages)
 {
@@ -84,40 +81,3 @@
     runThreadMessageTest(10, 100);
     runThreadMessageTest(10, 10000);
 }
-
-class ReflectedThread : public Thread {
-public:
-    using Thread::m_mutex;
-    using Thread::m_handle;
-    using Thread::hasExited;
-};
-
-TEST(ThreadMessage, SignalsWorkOnExit)
-{
-    static bool handlerRan = false;
-    installSignalHandler(Signal::Usr, [] (Signal, SigInfo&, PlatformRegisters&) -> SignalAction {
-        dataLogLn("here");
-        handlerRan = true;
-        return SignalAction::Handled;
-    });
-
-    Atomic<bool> receiverShouldKeepRunning(true);
-    RefPtr<Thread> receiverThread = (Thread::create("ThreadMessage receiver",
-        [&receiverShouldKeepRunning] () {
-            while (receiverShouldKeepRunning.load()) { }
-    }));
-    ASSERT_TRUE(receiverThread);
-
-    bool signalFired;
-    {
-        std::unique_lock<std::mutex> locker(static_cast<ReflectedThread*>(receiverThread.get())->m_mutex);
-        receiverShouldKeepRunning.store(false);
-        EXPECT_FALSE(static_cast<ReflectedThread*>(receiverThread.get())->hasExited());
-        sleep(1);
-        signalFired = !pthread_kill(static_cast<ReflectedThread*>(receiverThread.get())->m_handle, std::get<0>(toSystemSignal(Signal::Usr)));
-    }
-
-    receiverThread->waitForCompletion();
-    EXPECT_TRUE(handlerRan || !signalFired);
-}
-
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to