[test-suite] r297571 - compare.py: Fix empty names being displayed if no common suffix was found
Matthias Braun via llvm-commits
llvm-commits at lists.llvm.org
Sat Mar 11 15:54:03 PST 2017
Author: matze
Date: Sat Mar 11 17:54:03 2017
New Revision: 297571
URL: http://llvm.org/viewvc/llvm-project?rev=297571&view=rev
Log:
compare.py: Fix empty names being displayed if no common suffix was found
Modified:
test-suite/trunk/utils/compare.py
Modified: test-suite/trunk/utils/compare.py
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/utils/compare.py?rev=297571&r1=297570&r2=297571&view=diff
==============================================================================
--- test-suite/trunk/utils/compare.py (original)
+++ test-suite/trunk/utils/compare.py Sat Mar 11 17:54:03 2017
@@ -206,9 +206,13 @@ def print_result(d, limit_output=True, s
formatters['diff'] = format_diff
if shorten_names:
drop_prefix, drop_suffix = determine_common_prefix_suffix(dataout.Program)
- formatters['Program'] = lambda x: "%-45s" % truncate(x[drop_prefix:-drop_suffix], 10, 30)
- # TODO: it would be cool to drop prefixes/suffix common to all
- # names
+ def format_name(name, common_prefix, common_suffix):
+ name = name[common_prefix:]
+ if common_suffix > 0:
+ name = name[:-common_suffix]
+ return "%-45s" % truncate(name, 10, 30)
+
+ formatters['Program'] = lambda name: format_name(name, drop_prefix, drop_suffix)
float_format = lambda x: "%6.2f" % (x,)
pd.set_option("display.max_colwidth", 0)
out = dataout.to_string(index=False, justify='left',
More information about the llvm-commits
mailing list