source: vendor/current/script/show_test_time

Last change on this file was 988, checked in by Silvan Scherrer, 9 years ago

Samba Server: update vendor to version 4.4.3

File size: 919 bytes
Line 
1#!/usr/bin/python
2
3import optparse
4import os.path
5import subprocess
6import sys
7
8parser = optparse.OptionParser()
9parser.add_option("--limit", dest="limit", type=int,
10 help="Limit to this number of output entries.", default=0)
11(opts, args) = parser.parse_args()
12
13third_party_path = os.path.join(os.path.dirname(sys.argv[0]), "..", "lib")
14
15durations = {}
16
17cmd = "subunit-1to2 | subunit-ls --times --no-passthrough"
18
19p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stdin=sys.stdin, shell=True)
20for l in p.stdout:
21 l = l.strip()
22 (name, duration) = l.rsplit(" ", 1)
23 durations[name] = float(duration)
24
25if opts.limit:
26 print "Top %d tests by run time:" % opts.limit
27
28for i, (name, length) in enumerate(sorted(
29 durations.items(), cmp=lambda (k1,v1), (k2, v2): cmp(v1, v2), reverse=True)):
30 if opts.limit and i == opts.limit:
31 break
32 print "%d: %s -> %ds" % (i+1, name, length)
Note: See TracBrowser for help on using the repository browser.