[PATCH] D78241: Fix opt-viewer tests failing after move from cgi.escape to html.escape

James Nagurne via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 15 13:47:29 PDT 2020


JamesNagurne created this revision.
JamesNagurne added a reviewer: LocutusOfBorg.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

These two tests utilize pre-generated opt-viewer output to diff against
a run of opt-viewer over a known yaml file.

In commit 4b428e8f <https://reviews.llvm.org/rG4b428e8f18c7006f69b3d4ef0fdf091d998d0941> (D76126 <https://reviews.llvm.org/D76126>), the escape function used for rendering was changed
from cgi.escape to html.escape. This modification causes a behavioral
difference with regards to quote characters.

cgi will not escape quotes by default, but html will.

Therefore, these tests were failing because they expected the old behavior
of "string", but was instead seeing "string&quot.

This solution modifies the known test outputs to use the escaped quotes
rather than not escaping quotes during rendering for no particular reason.

It is notable that when testing the optimization records generated by
LLVM, there was never quotes in the remarks I could find, specifically in
the Callee field where they exist in the pre-generated yaml for testing.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D78241

Files:
  llvm/test/tools/opt-viewer/Outputs/suppress/s.swift.html
  llvm/test/tools/opt-viewer/Outputs/unicode-function-name/s.swift.html


Index: llvm/test/tools/opt-viewer/Outputs/unicode-function-name/s.swift.html
===================================================================
--- llvm/test/tools/opt-viewer/Outputs/unicode-function-name/s.swift.html
+++ llvm/test/tools/opt-viewer/Outputs/unicode-function-name/s.swift.html
@@ -124,7 +124,7 @@
 <td></td>
 <td></td>
 <td class="column-entry-green">sil-inliner</td>
-<td><pre style="display:inline">               </pre><span class="column-entry-yellow"> <a href="s.swift.html#L3">"s.• infix(_:_:)"</a> inlined into "main" (cost = 2, benefit = 40) </span></td>
+<td><pre style="display:inline">               </pre><span class="column-entry-yellow"> <a href="s.swift.html#L3">"s.• infix(_:_:)"</a> inlined into "main" (cost = 2, benefit = 40) </span></td>
 <td class="column-entry-yellow">main</td>
 </tr>
 
Index: llvm/test/tools/opt-viewer/Outputs/suppress/s.swift.html
===================================================================
--- llvm/test/tools/opt-viewer/Outputs/suppress/s.swift.html
+++ llvm/test/tools/opt-viewer/Outputs/suppress/s.swift.html
@@ -124,7 +124,7 @@
 <td></td>
 <td></td>
 <td class="column-entry-green">sil-inliner</td>
-<td><pre style="display:inline"></pre><span class="column-entry-yellow"> <a href="s.swift.html#L6">"s.f()"</a> inlined into "main" (cost = 20, benefit = 20) </span></td>
+<td><pre style="display:inline"></pre><span class="column-entry-yellow"> <a href="s.swift.html#L6">"s.f()"</a> inlined into "main" (cost = 20, benefit = 20) </span></td>
 <td class="column-entry-yellow">main</td>
 </tr>
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D78241.257831.patch
Type: text/x-patch
Size: 1629 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200415/8e043f74/attachment.bin>


More information about the llvm-commits mailing list