[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: *.profile file changes in regression tests?
From: |
Adam Spiers |
Subject: |
Re: *.profile file changes in regression tests? |
Date: |
Thu, 3 Nov 2011 00:38:02 +0000 |
On Wed, Nov 2, 2011 at 1:02 PM, Graham Percival
<address@hidden> wrote:
> On Wed, Nov 02, 2011 at 12:03:08PM +0000, Adam Spiers wrote:
>> I might have time to take a bash at adding Javascript buttons if
>> someone can give me a crash course in how those HTML files are
>> constructed (in particular, how I can add stuff to the <head></head>
>> section).
>
> No clue, sorry. git grep is your friend, as is poking around in
> the makefiles and/or build scripts until you find something.
Damn you - I couldn't resist ;-) See below.
Do I need to create an issue and/or Rietveld entry for this and for
my other patch to {doc,cg}-section.sh, or will someone who knows the
processes (e.g. Bug Squad member) take care of this?
>From 2288999255794f2c4ab70376390707b4d7a78fca Mon Sep 17 00:00:00 2001
From: Adam Spiers <address@hidden>
Date: Thu, 3 Nov 2011 00:31:13 +0000
Subject: [PATCH] Improve HTML output of regression tests
- Use Javascript to enable filtering of table rows by type
- Make sure git file compare cell contents are HTML-escaped
- Fix some HTML validation issues
---
scripts/build/output-distance.py | 64 ++++++++++++++++++++++++++++++--------
1 files changed, 51 insertions(+), 13 deletions(-)
mode change 100644 => 100755 scripts/build/output-distance.py
diff --git a/scripts/build/output-distance.py b/scripts/build/output-distance.py
old mode 100644
new mode 100755
index b90bda5..4b4475e
--- a/scripts/build/output-distance.py
+++ b/scripts/build/output-distance.py
@@ -5,6 +5,8 @@ import os
import math
import re
+from cgi import escape
+
## so we can call directly as scripts/build/output-distance.py
me_path = os.path.abspath (os.path.split (sys.argv[0])[0])
sys.path.insert (0, me_path + '/../python/')
@@ -457,7 +459,7 @@ class GitFileCompareLink (FileCompareLink):
str = '\n'.join ([l[:80] for l in str.split ('\n')])
- str = '<font size="-2"><pre>%s</pre></font>' % str
+ str = '<font size="-2"><pre>%s</pre></font>' % escape(str)
return str
def calc_distance (self):
@@ -942,33 +944,69 @@ class ComparisonData:
(changed, below, unchanged) = self.thresholded_results (threshold)
- html = ''
+ table_rows = ''
old_prefix = os.path.split (dir1)[1]
for link in changed:
- html += link.html_record_string (dest_dir)
+ table_rows += link.html_record_string (dest_dir)
short_dir1 = shorten_string (dir1)
short_dir2 = shorten_string (dir2)
+
+ summary = ''
+ below_count = len (below)
+
+ if below_count:
+ summary += '<p>%d below threshold</p>' % below_count
+
+ summary += '<p>%d unchanged</p>' % len (unchanged)
+
html = '''<html>
+<head>
+<title>LilyPond regression test results</title>
+<script language="javascript" type="text/javascript">
+// <![CDATA[
+ var rows = document.getElementsByTagName("tr");
+ function showOnlyMatchingRows(substring) {
+ var rowcount = rows.length;
+ for (var i = 0; i < rowcount; i++) {
+ row = rows[i];
+ html = row.innerHTML;
+ row.style.display =
+ (html.indexOf(substring + '">') != -1) ? "" : "none";
+ }
+ }
+// ]]>
+</script>
+</head>
+<body>
+<p>
+ click to filter rows by type:
+ <a href="#" onClick="showOnlyMatchingRows('.profile')">profiling</a> /
+ <a href="#" onClick="showOnlyMatchingRows('.signature')">signature</a> /
+ <a href="#" onClick="showOnlyMatchingRows('.midi')">midi</a> /
+ <a href="#" onClick="showOnlyMatchingRows('.log')">log</a> /
+ <a href="#" onClick="showOnlyMatchingRows('.gittxt')">gittxt</a> /
+ <a href="#" onClick="showOnlyMatchingRows('')">reset to all</a>
+</p>
+
+<hr />
+
+%(summary)s
+
+<hr />
+
<table rules="rows" border bordercolor="blue">
<tr>
<th>distance</th>
<th>%(short_dir1)s</th>
<th>%(short_dir2)s</th>
</tr>
-%(html)s
+%(table_rows)s
</table>
+</body>
</html>''' % locals()
- html += ('<p>')
- below_count = len (below)
-
- if below_count:
- html += ('<p>%d below threshold</p>' % below_count)
-
- html += ('<p>%d unchanged</p>' % len (unchanged))
-
dest_file = dest_dir + '/index.html'
open_write_file (dest_file).write (html)
@@ -1262,7 +1300,7 @@ def main ():
run_tests ()
sys.exit (0)
- if len (args) % 2:
+ if len (args) % 2 == 1:
p.print_usage ()
sys.exit (2)
--
1.7.6.4
- *.profile file changes in regression tests?, Adam Spiers, 2011/11/01
- Re: *.profile file changes in regression tests?, Adam Spiers, 2011/11/01
- Re: *.profile file changes in regression tests?, Graham Percival, 2011/11/02
- Re: *.profile file changes in regression tests?, Adam Spiers, 2011/11/02
- Re: *.profile file changes in regression tests?, Graham Percival, 2011/11/02
- Re: *.profile file changes in regression tests?,
Adam Spiers <=
- Re: *.profile file changes in regression tests?, Adam Spiers, 2011/11/02
- Re: *.profile file changes in regression tests?, Carl Sorensen, 2011/11/02
- Re: *.profile file changes in regression tests?, Carl Sorensen, 2011/11/02
- Re: *.profile file changes in regression tests?, David Kastrup, 2011/11/03
- Re: *.profile file changes in regression tests?, Graham Percival, 2011/11/03
- Re: *.profile file changes in regression tests?, Graham Percival, 2011/11/03
- Re: *.profile file changes in regression tests?, Adam Spiers, 2011/11/03
Re: *.profile file changes in regression tests?, Graham Percival, 2011/11/02