diff options
author | Daniel Dunbar <daniel@zuster.org> | 2009-11-15 01:02:09 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2009-11-15 01:02:09 +0000 |
commit | ad6c15465c2b304f07c3c0e83c7c416255040968 (patch) | |
tree | 879864136f14fda8ce1575c508fbce5dbbeaed06 /llvm/utils/lit/lit.py | |
parent | 6499e9c625e12feb9d3813cee67810cc08fd2f2e (diff) | |
download | bcm5719-llvm-ad6c15465c2b304f07c3c0e83c7c416255040968.tar.gz bcm5719-llvm-ad6c15465c2b304f07c3c0e83c7c416255040968.zip |
lit: Add --repeat=N option, for running each test N times.
- Currently just useful for timing, although it could be extended as one (bad) way to deal with flaky tests.
llvm-svn: 88827
Diffstat (limited to 'llvm/utils/lit/lit.py')
-rwxr-xr-x | llvm/utils/lit/lit.py | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/llvm/utils/lit/lit.py b/llvm/utils/lit/lit.py index 70bd0605794..dcdce7d5c3c 100755 --- a/llvm/utils/lit/lit.py +++ b/llvm/utils/lit/lit.py @@ -388,6 +388,9 @@ def main(): group.add_option("", "--no-tcl-as-sh", dest="useTclAsSh", help="Don't run Tcl scripts using 'sh'", action="store_false", default=True) + group.add_option("", "--repeat", dest="repeatTests", metavar="N", + help="Repeat tests N times (for timing)", + action="store", default=None, type=int) parser.add_option_group(group) (opts, args) = parser.parse_args() @@ -472,6 +475,11 @@ def main(): header = '-- Testing: %d%s tests, %d threads --'%(len(tests),extra, opts.numThreads) + if opts.repeatTests: + tests = [t.copyWithIndex(i) + for t in tests + for i in range(opts.repeatTests)] + progressBar = None if not opts.quiet: if opts.succinct and opts.useProgressBar: @@ -524,11 +532,16 @@ def main(): print if opts.timeTests: - byTime = list(tests) - byTime.sort(key = lambda t: t.elapsed) + # Collate, in case we repeated tests. + times = {} + for t in tests: + key = t.getFullName() + times[key] = times.get(key, 0.) + t.elapsed + + byTime = list(times.items()) + byTime.sort(key = lambda (name,elapsed): elapsed) if byTime: - Util.printHistogram([(t.getFullName(), t.elapsed) for t in byTime], - title='Tests') + Util.printHistogram(byTime, title='Tests') for name,code in (('Expected Passes ', Test.PASS), ('Expected Failures ', Test.XFAIL), |