Title: [292508] trunk
Revision
292508
Author
j_pas...@apple.com
Date
2022-04-06 14:57:52 -0700 (Wed, 06 Apr 2022)

Log Message

Fix expected, actual links for variant-based imported wpt tests
https://bugs.webkit.org/show_bug.cgi?id=238832
rdar://problem/91313891

Reviewed by Brent Fulgham.

Tools:

Ensure that the workaround involving "len(fs.splitext(output_basename)[1]) - 1 > 5"
does not affect imported templated wpt tests that may match that condition, such as
".../pbkdf2.https.any.worker.html."

* Scripts/webkitpy/layout_tests/controllers/test_result_writer.py:
(TestResultWriter.output_filename):
* Scripts/webkitpy/layout_tests/controllers/test_result_writer_unittest.py:
(TestResultWriterTest.test_output_filename):
(TestResultWriterTest):
(TestResultWriterTest.test_output_filename_variant):

LayoutTests:

The changes to LayoutTests/fast/harness/results.html were wiped when
preparing https://bugs.webkit.org/show_bug.cgi?id=231544, causing the
links not to match. This patch fixes it.

* fast/harness/results.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (292507 => 292508)


--- trunk/LayoutTests/ChangeLog	2022-04-06 21:49:12 UTC (rev 292507)
+++ trunk/LayoutTests/ChangeLog	2022-04-06 21:57:52 UTC (rev 292508)
@@ -1,3 +1,17 @@
+2022-04-06  J Pascoe  <j_pas...@apple.com>
+
+        Fix expected, actual links for variant-based imported wpt tests
+        https://bugs.webkit.org/show_bug.cgi?id=238832
+        rdar://problem/91313891
+
+        Reviewed by Brent Fulgham.
+
+        The changes to LayoutTests/fast/harness/results.html were wiped when
+        preparing https://bugs.webkit.org/show_bug.cgi?id=231544, causing the
+        links not to match. This patch fixes it.
+
+        * fast/harness/results.html:
+
 2022-04-06  Matteo Flores  <matteo_flo...@apple.com>
 
         [ Mac , iOS Debug ] imported/w3c/web-platform-tests/html/cross-origin-opener-policy/resource-popup.https.html is a flaky failure.

Modified: trunk/LayoutTests/fast/harness/results.html (292507 => 292508)


--- trunk/LayoutTests/fast/harness/results.html	2022-04-06 21:49:12 UTC (rev 292507)
+++ trunk/LayoutTests/fast/harness/results.html	2022-04-06 21:57:52 UTC (rev 292508)
@@ -280,13 +280,19 @@
         return null;
     }
 
-    static stripExtension(testName)
+    static testPrefix(testName)
     {
         // Temporary fix, also in Tools/Scripts/webkitpy/layout_tests/constrollers/test_result_writer.py, line 95.
         // FIXME: Refactor to avoid confusing reference to both test and process names.
-        if (Utils.splitExtension(testName)[1].length > 5)
+        let parts = Utils.splitExtension(testName);
+        let prefix = parts[0];
+        if (parts[1].includes('?'))
+            prefix += '_' + parts[1].split('?')[1]
+        else if (parts[1].includes('#'))
+            prefix += '_' + parts[1].split('#')[1]
+        else if (Utils.splitExtension(parts[0])[1].length > 5)
             return testName;
-        return Utils.splitExtension(testName)[0];
+        return prefix;
     }
 
     static splitExtension(testName)
@@ -1168,7 +1174,7 @@
                 TestResultsController._getResultContainer(node).remove();
             else if (url.match('-actual.png$')) {
                 let name = Utils.parentOfType(node, 'tbody').querySelector('.test-link').textContent;
-                TestResultsController._getResultContainer(node).outerHTML = togglingImageFunction(Utils.stripExtension(name));
+                TestResultsController._getResultContainer(node).outerHTML = togglingImageFunction(Utils.testPrefix(name));
             }
         }
     }
@@ -1344,7 +1350,7 @@
 
         let actualTokens = testResult.info.actual.split(/\s+/);
 
-        let testPrefix = Utils.stripExtension(testResult.name);
+        let testPrefix = Utils.testPrefix(testResult.name);
         let imageResults = this.imageResultLinks(testResult, testPrefix, actualTokens[0]);
         if (!imageResults && actualTokens.length > 1)
             imageResults = this.imageResultLinks(testResult, 'retries/' + testPrefix, actualTokens[1]);
@@ -1374,12 +1380,12 @@
 
     appendTextFailureLinks(testResult, cell)
     {
-        cell.innerHTML += this._resultsController.textResultLinks(Utils.stripExtension(testResult.name));
+        cell.innerHTML += this._resultsController.textResultLinks(Utils.testPrefix(testResult.name));
     }
     
     appendAudioFailureLinks(testResult, cell)
     {
-        let prefix = Utils.stripExtension(testResult.name);
+        let prefix = Utils.testPrefix(testResult.name);
         cell.innerHTML += TestResultsController.resultLink(prefix, '-expected.wav', 'expected audio')
             + TestResultsController.resultLink(prefix, '-actual.wav', 'actual audio')
             + TestResultsController.resultLink(prefix, '-diff.txt', 'textual diff');
@@ -1387,7 +1393,7 @@
     
     appendActualOnlyLinks(testResult, cell)
     {
-        let prefix = Utils.stripExtension(testResult.name);
+        let prefix = Utils.testPrefix(testResult.name);
         if (testResult.isMissingAudio())
             cell.innerHTML += TestResultsController.resultLink(prefix, '-actual.wav', 'audio result');
 
@@ -1471,7 +1477,7 @@
 
     fillTestResultCell(testResult, cell)
     {
-        cell.innerHTML = TestResultsController.resultLink(Utils.stripExtension(testResult.name), '-stderr.txt', 'stderr');
+        cell.innerHTML = TestResultsController.resultLink(Utils.testPrefix(testResult.name), '-stderr.txt', 'stderr');
     }
 };
 
@@ -1481,7 +1487,7 @@
     fillTestResultCell(testResult, cell)
     {
         // FIXME: only include timeout actual/diff results here if we actually spit out results for timeout tests.
-        cell.innerHTML = this._resultsController.textResultLinks(Utils.stripExtension(testResult.name));
+        cell.innerHTML = this._resultsController.textResultLinks(Utils.testPrefix(testResult.name));
     }
 };
 
@@ -1490,8 +1496,8 @@
 
     fillTestResultCell(testResult, cell)
     {
-        cell.innerHTML = TestResultsController.resultLink(Utils.stripExtension(testResult.name), '-crash-log.txt', 'crash log')
-                       + TestResultsController.resultLink(Utils.stripExtension(testResult.name), '-sample.txt', 'sample');
+        cell.innerHTML = TestResultsController.resultLink(Utils.testPrefix(testResult.name), '-crash-log.txt', 'crash log')
+                       + TestResultsController.resultLink(Utils.testPrefix(testResult.name), '-sample.txt', 'sample');
     }
 };
 
@@ -1499,7 +1505,7 @@
     sectionTitle() { return 'Other crashes'; }
     fillTestResultCell(testResult, cell)
     {
-        cell.innerHTML = TestResultsController.resultLink(Utils.stripExtension(testResult.name), '-crash-log.txt', 'crash log');
+        cell.innerHTML = TestResultsController.resultLink(Utils.testPrefix(testResult.name), '-crash-log.txt', 'crash log');
     }
 
     createHistoryCell(testResult)

Modified: trunk/Tools/ChangeLog (292507 => 292508)


--- trunk/Tools/ChangeLog	2022-04-06 21:49:12 UTC (rev 292507)
+++ trunk/Tools/ChangeLog	2022-04-06 21:57:52 UTC (rev 292508)
@@ -1,3 +1,22 @@
+2022-04-06  J Pascoe  <j_pas...@apple.com>
+
+        Fix expected, actual links for variant-based imported wpt tests
+        https://bugs.webkit.org/show_bug.cgi?id=238832
+        rdar://problem/91313891
+
+        Reviewed by Brent Fulgham.
+
+        Ensure that the workaround involving "len(fs.splitext(output_basename)[1]) - 1 > 5"
+        does not affect imported templated wpt tests that may match that condition, such as
+        ".../pbkdf2.https.any.worker.html."
+
+        * Scripts/webkitpy/layout_tests/controllers/test_result_writer.py:
+        (TestResultWriter.output_filename):
+        * Scripts/webkitpy/layout_tests/controllers/test_result_writer_unittest.py:
+        (TestResultWriterTest.test_output_filename):
+        (TestResultWriterTest):
+        (TestResultWriterTest.test_output_filename_variant):
+
 2022-04-06  Jonathan Bedard  <jbed...@apple.com>
 
         [Merge-Queue] Use rebase over merge when canonicalizing commit

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/controllers/test_result_writer.py (292507 => 292508)


--- trunk/Tools/Scripts/webkitpy/layout_tests/controllers/test_result_writer.py	2022-04-06 21:49:12 UTC (rev 292507)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/controllers/test_result_writer.py	2022-04-06 21:57:52 UTC (rev 292508)
@@ -102,17 +102,14 @@
         output_basename = ext_parts[0]
         if len(ext_parts) > 1 and '?' in ext_parts[1]:
             output_basename += '_' + ext_parts[1].split('?')[1]
-        if len(ext_parts) > 1 and '#' in ext_parts[1]:
+        elif len(ext_parts) > 1 and '#' in ext_parts[1]:
             output_basename += '_' + ext_parts[1].split('#')[1]
+        elif len(fs.splitext(output_basename)[1]) - 1 > 5:
+            # Temporary fix, also in LayoutTests/fast/harness/results.html, line 275.
+            # FIXME: Refactor to avoid confusing reference to both test and process names.
+            return fs.join(self._root_output_dir, self._test_name) + modifier
+        return fs.join(self._root_output_dir, output_basename) + modifier
 
-        output_filename = fs.join(self._root_output_dir, output_basename + ext_parts[1])
-
-        # Temporary fix, also in LayoutTests/fast/harness/results.html, line 275.
-        # FIXME: Refactor to avoid confusing reference to both test and process names.
-        if len(fs.splitext(output_filename)[1]) - 1 > 5:
-            return output_filename + modifier
-        return fs.splitext(output_filename)[0] + modifier
-
     def _write_binary_file(self, path, contents):
         if contents is not None:
             self._make_output_directory()

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/controllers/test_result_writer_unittest.py (292507 => 292508)


--- trunk/Tools/Scripts/webkitpy/layout_tests/controllers/test_result_writer_unittest.py	2022-04-06 21:49:12 UTC (rev 292507)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/controllers/test_result_writer_unittest.py	2022-04-06 21:57:52 UTC (rev 292508)
@@ -61,3 +61,17 @@
         fs = host.filesystem
         writer = test_result_writer.TestResultWriter(fs, port, port.results_directory(), 'require-corp-revalidated-images.https.html')
         self.assertEqual(writer.output_filename('-diff.txt'), fs.join(port.results_directory(), 'require-corp-revalidated-images.https-diff.txt'))
+
+    def test_output_filename_variant(self):
+        host = MockHost()
+        port = TestPort(host)
+        fs = host.filesystem
+        writer = test_result_writer.TestResultWriter(fs, port, port.results_directory(), 'template_test/pbkdf2.https.any.worker.html?1-1000')
+        self.assertEqual(fs.join(port.results_directory(), 'template_test/pbkdf2.https.any.worker_1-1000-diff.txt'), writer.output_filename('-diff.txt'))
+
+    def test_output_filename_variant(self):
+        host = MockHost()
+        port = TestPort(host)
+        fs = host.filesystem
+        writer = test_result_writer.TestResultWriter(fs, port, port.results_directory(), 'template_test2/pbkdf2.https.any.html?1-1000')
+        self.assertEqual(fs.join(port.results_directory(), 'template_test2/pbkdf2.https.any_1-1000-diff.txt'), writer.output_filename('-diff.txt'))
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to