Title: [221893] trunk/Tools
Revision
221893
Author
[email protected]
Date
2017-09-11 16:34:03 -0700 (Mon, 11 Sep 2017)

Log Message

[iOS WK2] ExternalSourceDataTransferItemGetAsEntry tests produce inconsistent results on test automation bots
https://bugs.webkit.org/show_bug.cgi?id=176736

Reviewed by Andy Estes and Megan Gardner.

The test output dumped when dropping a file in DataTransferItem-getAsEntry.html should adhere to some deterministic order.
Currently, this is not enforced, so on some systems, these tests fail due to expected test output being out of order. To
fix this, simply have the test harness alphabetically sort the output before writing to the textarea.

* TestWebKitAPI/Tests/WebKitCocoa/DataTransferItem-getAsEntry.html:
* TestWebKitAPI/Tests/ios/DataInteractionTests.mm:
(TestWebKitAPI::TEST):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (221892 => 221893)


--- trunk/Tools/ChangeLog	2017-09-11 23:28:25 UTC (rev 221892)
+++ trunk/Tools/ChangeLog	2017-09-11 23:34:03 UTC (rev 221893)
@@ -1,3 +1,18 @@
+2017-09-11  Wenson Hsieh  <[email protected]>
+
+        [iOS WK2] ExternalSourceDataTransferItemGetAsEntry tests produce inconsistent results on test automation bots
+        https://bugs.webkit.org/show_bug.cgi?id=176736
+
+        Reviewed by Andy Estes and Megan Gardner.
+
+        The test output dumped when dropping a file in DataTransferItem-getAsEntry.html should adhere to some deterministic order.
+        Currently, this is not enforced, so on some systems, these tests fail due to expected test output being out of order. To
+        fix this, simply have the test harness alphabetically sort the output before writing to the textarea.
+
+        * TestWebKitAPI/Tests/WebKitCocoa/DataTransferItem-getAsEntry.html:
+        * TestWebKitAPI/Tests/ios/DataInteractionTests.mm:
+        (TestWebKitAPI::TEST):
+
 2017-09-11  Ryosuke Niwa  <[email protected]>
 
         webkitbot should recognize commands even when colon is omitted

Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/DataTransferItem-getAsEntry.html (221892 => 221893)


--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/DataTransferItem-getAsEntry.html	2017-09-11 23:28:25 UTC (rev 221892)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/DataTransferItem-getAsEntry.html	2017-09-11 23:34:03 UTC (rev 221893)
@@ -69,16 +69,16 @@
 
     async function representationForFileSystemEntry(entry)
     {
-        let representation = "";
+        let lines = [];
         if (entry.isDirectory) {
-            representation += `DIR: ${entry.fullPath}\n`;
+            lines.push(`DIR: ${entry.fullPath}`);
             for (let child of await getChildEntries(entry))
-                representation += await representationForFileSystemEntry(child);
+                lines = lines.concat(await representationForFileSystemEntry(child));
         } else if (entry.isFile) {
             let file = await fileFromFileSystemFileEntry(entry);
-            representation += `FILE: ${entry.fullPath} ('${file.type}', ${file.size} bytes)\n`;
+            lines.push(`FILE: ${entry.fullPath} ('${file.type}', ${file.size} bytes)`);
         }
-        return representation;
+        return lines;
     }
 
     async function logItemAndFileEntryInformation(items)
@@ -89,7 +89,7 @@
             output.value += `Found data transfer item (kind: '${item.kind}', type: '${item.type}')\n`;
             let entry = item.webkitGetAsEntry();
             if (entry)
-                output.value += await representationForFileSystemEntry(entry);
+                output.value += (await representationForFileSystemEntry(entry)).sort().join("\n");
         }
     }
 </script>

Modified: trunk/Tools/TestWebKitAPI/Tests/ios/DataInteractionTests.mm (221892 => 221893)


--- trunk/Tools/TestWebKitAPI/Tests/ios/DataInteractionTests.mm	2017-09-11 23:28:25 UTC (rev 221892)
+++ trunk/Tools/TestWebKitAPI/Tests/ios/DataInteractionTests.mm	2017-09-11 23:34:03 UTC (rev 221893)
@@ -953,17 +953,18 @@
 
 TEST(DataInteractionTests, ExternalSourceDataTransferItemGetFolderAsEntry)
 {
+    // The expected output is sorted by alphabetical order here for consistent behavior across different test environments.
+    // See DataTransferItem-getAsEntry.html for more details.
     NSArray<NSString *> *expectedOutput = @[
         @"Found data transfer item (kind: 'string', type: 'text/plain')",
         @"Found data transfer item (kind: 'file', type: '')",
         @"DIR: /somedirectory",
+        @"DIR: /somedirectory/subdirectory1",
+        @"DIR: /somedirectory/subdirectory2",
+        @"FILE: /somedirectory/archive.zip ('application/zip', 988 bytes)",
         @"FILE: /somedirectory/icon.png ('image/png', 42130 bytes)",
-        @"DIR: /somedirectory/subdirectory1",
         @"FILE: /somedirectory/subdirectory1/text-file-1.txt ('text/plain', 43 bytes)",
-        @"FILE: /somedirectory/archive.zip ('application/zip', 988 bytes)",
-        @"DIR: /somedirectory/subdirectory2",
-        @"FILE: /somedirectory/subdirectory2/text-file-2.txt ('text/plain', 44 bytes)",
-        @""
+        @"FILE: /somedirectory/subdirectory2/text-file-2.txt ('text/plain', 44 bytes)"
     ];
 
     auto webView = setUpTestWebViewForDataTransferItems();
@@ -994,8 +995,7 @@
     NSArray<NSString *> *expectedOutput = @[
         @"Found data transfer item (kind: 'string', type: 'text/plain')",
         @"Found data transfer item (kind: 'file', type: 'text/plain')",
-        @"FILE: /foo.txt ('text/plain', 28 bytes)",
-        @""
+        @"FILE: /foo.txt ('text/plain', 28 bytes)"
     ];
 
     auto webView = setUpTestWebViewForDataTransferItems();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to