[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Regtest script improvements: (issue 5493073)
From: |
julien . rioux |
Subject: |
Regtest script improvements: (issue 5493073) |
Date: |
Sun, 18 Dec 2011 16:51:59 +0000 |
Reviewers: ,
Message:
Some general improvements in the way the regtest comparison page is
generated, including displaying the path of the input file relative to
the top source directory.
Description:
Regtest script improvements:
- Allow to customize the length of shortened strings.
- When filtering through js, don't filter out header rows.
- Output an header row at every change of directory.
- Add the prefix to the filename (e.g. input/regression).
Please review this at http://codereview.appspot.com/5493073/
Affected files:
M scripts/build/output-distance.py
Index: scripts/build/output-distance.py
diff --git a/scripts/build/output-distance.py
b/scripts/build/output-distance.py
index
941f879f478accc3a71ab92dc3a739fd13c5d47e..767e253fa2afe94c29ef10ec5b307481f44b2228
100755
--- a/scripts/build/output-distance.py
+++ b/scripts/build/output-distance.py
@@ -53,8 +53,7 @@ def system (c):
raise Exception ("failed")
return
-def shorten_string (s):
- threshold = 15
+def shorten_string (s, threshold = 15):
if len (s) > 2*threshold:
s = s[:threshold] + '..' + s[-threshold:]
return s
@@ -377,12 +376,18 @@ class FileLink:
return ''
+ def directories (self):
+ return map (os.path.dirname, self.file_names)
+
def name (self):
base = os.path.basename (self.file_names[1])
base = os.path.splitext (base)[0]
base = hash_to_original_name.get (base, base)
base = os.path.splitext (base)[0]
- return base
+ return os.path.join (self.prefix (), base)
+
+ def prefix (self):
+ return os.path.dirname (os.path.commonprefix (self.file_names))
def extension (self):
return os.path.splitext (self.file_names[1])[1]
@@ -951,16 +956,25 @@ class ComparisonData:
(changed, below, unchanged) = self.thresholded_results (threshold)
+ header_row = '''
+<tr>
+<th>distance</th>
+<th>%(short_dir1)s</th>
+<th>%(short_dir2)s</th>
+</tr>
+'''
table_rows = ''
- old_prefix = os.path.split (dir1)[1]
+ old_prefix = None
for link in changed:
+ this_prefix = link.prefix ()
+ if (old_prefix != this_prefix):
+ old_prefix = this_prefix
+ short_dir1 = shorten_string (link.directories ()[0], 30)
+ short_dir2 = shorten_string (link.directories ()[1], 30)
+ table_rows += header_row % locals()
table_rows += link.html_record_string (dest_dir)
-
- short_dir1 = shorten_string (dir1)
- short_dir2 = shorten_string (dir2)
-
summary = ''
below_count = len (below)
@@ -981,7 +995,8 @@ class ComparisonData:
row = rows[i];
html = row.innerHTML;
row.style.display =
- (html.indexOf(substring + '">') != -1) ? "" : "none";
+ ((html.indexOf('>distance<') != -1) ||
+ (html.indexOf(substring + '">') != -1)) ? "" : "none";
}
}
// ]]>
@@ -1006,11 +1021,6 @@ class ComparisonData:
<hr />
<table rules="rows" border bordercolor="blue">
-<tr>
-<th>distance</th>
-<th>%(short_dir1)s</th>
-<th>%(short_dir2)s</th>
-</tr>
%(table_rows)s
</table>
</body>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Regtest script improvements: (issue 5493073),
julien . rioux <=