Changeset 201928 in webkit
- Timestamp:
- Jun 10, 2016 10:04:11 AM (8 years ago)
- Location:
- trunk/Tools
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r201914 r201928 1 2016-06-10 Brady Eidson <beidson@apple.com> 2 3 WTF_CrossThreadTask.Basic fails in all non mac ports. 4 https://bugs.webkit.org/show_bug.cgi?id=158612 5 6 Reviewed by Alex Christensen. 7 8 The test is very sensitive to argument evaluation order which is explicitly undefined in C++. 9 10 Instead, we should just count the appropriate events to forget their order. 11 12 * TestWebKitAPI/Tests/WTF/CrossThreadTask.cpp: 13 (TestWebKitAPI::LifetimeLogger::LifetimeLogger): 14 (TestWebKitAPI::LifetimeLogger::~LifetimeLogger): 15 (TestWebKitAPI::LifetimeLogger::isolatedCopy): 16 (TestWebKitAPI::LifetimeLogger::fullName): 17 (TestWebKitAPI::testFunction): 18 (TestWebKitAPI::TEST): 19 (TestWebKitAPI::LifetimeLogger::log): Deleted. 20 (TestWebKitAPI::LifetimeLogger::takeLogStr): Deleted. 21 1 22 2016-06-09 Alex Christensen <achristensen@webkit.org> 2 23 -
trunk/Tools/TestWebKitAPI/Tests/WTF/CrossThreadTask.cpp
r201872 r201928 28 28 #include <string> 29 29 #include <wtf/CrossThreadTask.h> 30 #include <wtf/HashCountedSet.h> 31 #include <wtf/text/StringHash.h> 30 32 31 33 namespace TestWebKitAPI { 34 35 static size_t totalDestructorCalls; 36 static size_t totalIsolatedCopyCalls; 37 38 static HashCountedSet<String> defaultConstructorSet; 39 static HashCountedSet<String> nameConstructorSet; 40 static HashCountedSet<String> copyConstructorSet; 41 static HashCountedSet<String> moveConstructorSet; 32 42 33 43 struct LifetimeLogger { 34 44 LifetimeLogger() 35 45 { 36 log() << "default_constructor(" << &name << "-" << copyGeneration << "-" << moveGeneration << ") ";46 defaultConstructorSet.add(fullName()); 37 47 } 38 48 … … 40 50 : name(*inputName) 41 51 { 42 log() << "name_constructor(" << &name << "-" << copyGeneration << "-" << moveGeneration << ") ";52 nameConstructorSet.add(fullName()); 43 53 } 44 54 … … 48 58 , moveGeneration(other.moveGeneration) 49 59 { 50 log() << "copy_constructor(" << &name << "-" << copyGeneration << "-" << moveGeneration << ") ";60 copyConstructorSet.add(fullName()); 51 61 } 52 62 … … 56 66 , moveGeneration(other.moveGeneration + 1) 57 67 { 58 log() << "move_constructor(" << &name << "-" << copyGeneration << "-" << moveGeneration << ") ";68 moveConstructorSet.add(fullName()); 59 69 } 60 70 61 71 ~LifetimeLogger() 62 72 { 63 log() << "destructor(" << &name << "-" << copyGeneration << "-" << moveGeneration << ") ";73 ++totalDestructorCalls; 64 74 } 65 75 66 76 LifetimeLogger isolatedCopy() const 67 77 { 68 log() << "isolatedCopy() ";78 ++totalIsolatedCopyCalls; 69 79 return LifetimeLogger(*this); 80 } 81 82 String fullName() 83 { 84 return makeString(&name, "-", String::number(copyGeneration), "-", String::number(moveGeneration)); 70 85 } 71 86 … … 73 88 int copyGeneration { 0 }; 74 89 int moveGeneration { 0 }; 75 76 static std::ostringstream& log()77 {78 static std::ostringstream log;79 return log;80 }81 82 static std::string takeLogStr()83 {84 std::string string = log().str();85 log().str("");86 return string;87 }88 90 }; 89 91 90 92 void testFunction(const LifetimeLogger&, const LifetimeLogger&, const LifetimeLogger&) 91 93 { 92 LifetimeLogger::log() << "testFunction called" << " ";94 // Do nothing - Just need to check the side effects of the arguments getting in here. 93 95 } 94 96 … … 103 105 task.performTask(); 104 106 } 105 ASSERT_STREQ("default_constructor(<default>-0-0) copy_constructor(<default>-1-0) name_constructor(logger-0-0) isolatedCopy() copy_constructor(<default>-1-0) isolatedCopy() copy_constructor(<default>-2-0) isolatedCopy() copy_constructor(logger-1-0) move_constructor(<default>-1-1) move_constructor(<default>-2-1) move_constructor(logger-1-1) destructor(logger-1-0) destructor(<default>-2-0) destructor(<default>-1-0) move_constructor(<default>-1-2) move_constructor(<default>-2-2) move_constructor(logger-1-2) destructor(logger-1-1) destructor(<default>-2-1) destructor(<default>-1-1) testFunction called destructor(logger-1-2) destructor(<default>-2-2) destructor(<default>-1-2) destructor(logger-0-0) destructor(<default>-1-0) destructor(<default>-0-0) ", LifetimeLogger::takeLogStr().c_str()); 107 108 ASSERT_EQ(1u, defaultConstructorSet.size()); 109 ASSERT_EQ(1u, defaultConstructorSet.count("<default>-0-0")); 110 111 ASSERT_EQ(1u, nameConstructorSet.size()); 112 ASSERT_EQ(1u, nameConstructorSet.count("logger-0-0")); 113 114 ASSERT_EQ(3u, copyConstructorSet.size()); 115 ASSERT_EQ(1u, copyConstructorSet.count("logger-1-0")); 116 ASSERT_EQ(2u, copyConstructorSet.count("<default>-1-0")); 117 ASSERT_EQ(1u, copyConstructorSet.count("<default>-2-0")); 118 119 ASSERT_EQ(6u, moveConstructorSet.size()); 120 ASSERT_EQ(1u, moveConstructorSet.count("logger-1-1")); 121 ASSERT_EQ(1u, moveConstructorSet.count("logger-1-2")); 122 ASSERT_EQ(1u, moveConstructorSet.count("<default>-2-1")); 123 ASSERT_EQ(1u, moveConstructorSet.count("<default>-2-2")); 124 ASSERT_EQ(1u, moveConstructorSet.count("<default>-1-1")); 125 ASSERT_EQ(1u, moveConstructorSet.count("<default>-1-2")); 126 127 ASSERT_EQ(12u, totalDestructorCalls); 128 ASSERT_EQ(3u, totalIsolatedCopyCalls); 129 106 130 } 107 131
Note: See TracChangeset
for help on using the changeset viewer.