[commit: testsuite] master: Make failing perf test output easier to read (d83875f)
Ian Lynagh
igloo at earth.li
Thu Feb 7 03:57:28 CET 2013
Repository : ssh://darcs.haskell.org//srv/darcs/testsuite
On branch : master
http://hackage.haskell.org/trac/ghc/changeset/d83875fb76639dd704599fa4867e7ffbcdf5211e
>---------------------------------------------------------------
commit d83875fb76639dd704599fa4867e7ffbcdf5211e
Author: Ian Lynagh <ian at well-typed.com>
Date: Wed Feb 6 17:30:23 2013 +0000
Make failing perf test output easier to read
>---------------------------------------------------------------
driver/testlib.py | 33 +++++++++++++++++++++++----------
1 files changed, 23 insertions(+), 10 deletions(-)
diff --git a/driver/testlib.py b/driver/testlib.py
index 0254b12..846c401 100644
--- a/driver/testlib.py
+++ b/driver/testlib.py
@@ -1122,19 +1122,32 @@ def checkStats(stats_file, range_fields):
result = failBecause('no such stats field')
val = int(m.group(1))
- min = trunc( expected * ((100 - float(dev))/100));
- max = trunc(0.5 + ceil(expected * ((100 + float(dev))/100)));
-
- if val < min:
- print field, val, 'is more than ' + repr(dev) + '%'
- print 'less than the exepected value', expected
- print 'If this is because you have improved GHC, please'
- print 'update the test so that GHC doesn\'t regress again'
+ lowerBound = trunc( expected * ((100 - float(dev))/100));
+ upperBound = trunc(0.5 + ceil(expected * ((100 + float(dev))/100)));
+
+ if val < lowerBound:
+ print field, 'value is too low:'
+ print '(If this is because you have improved GHC, please'
+ print 'update the test so that GHC doesn\'t regress again)'
result = failBecause('stat too good')
- if val > max:
- print field, val, 'is more than ' + repr(dev) + '% greater than the expected value,', expected, max
+ if val > upperBound:
+ print field, 'value is too high:'
result = failBecause('stat not good enough')
+ if val < lowerBound or val > upperBound:
+ valStr = str(val)
+ valLen = len(valStr)
+ expectedStr = str(expected)
+ expectedLen = len(expectedStr)
+ length = max(map (lambda x : len(str(x)), [expected, lowerBound, upperBound, val]))
+ def display(descr, val, extra):
+ valStr = str(val)
+ print descr, (' ' * (length - len(valStr))) + valStr, extra
+ display(' Expected ' + field + ':', expected, '+/-' + str(dev) + '%')
+ display(' Lower bound ' + field + ':', lowerBound, '')
+ display(' Upper bound ' + field + ':', upperBound, '')
+ display(' Actual ' + field + ':', val, '')
+
return result
# -----------------------------------------------------------------------------
More information about the ghc-commits
mailing list