s3:libads: don't dump securityIdentifier and msDS-TrustForestTrustInfo as strings
[samba.git] / script / show_test_time
1 #!/usr/bin/python
2 import optparse
3 import os.path
4 import subprocess
5 import sys
6
7 parser = optparse.OptionParser()
8 parser.add_option("--limit", dest="limit", type=int,
9                   help="Limit to this number of output entries.", default=0)
10 (opts, args) = parser.parse_args()
11
12 durations = {}
13
14 cmd = "subunit-1to2 | subunit-ls --times --no-passthrough"
15
16 p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stdin=sys.stdin, shell=True)
17 for l in p.stdout:
18     l = l.strip()
19     (name, duration) = l.rsplit(" ", 1)
20     durations[name] = float(duration)
21
22 if opts.limit:
23     print("Top %d tests by run time:" % opts.limit)
24
25 for i, (name, length) in enumerate(sorted(
26         durations.items(), key=lambda x: x[1], reverse=True)):
27     if opts.limit and i == opts.limit:
28         break
29     print("%d: %s -> %ds" % (i+1, name, length))