mirror of
https://github.com/samba-team/samba.git
synced 2024-12-23 17:34:34 +03:00
aecb2b779b
This made Python 2's print behave like Python 3's print(). In some cases, where we had: from __future__ import print_function """Intended module documentation...""" this will have the side effect of making the intended module documentation work as the actual module documentation (i.e. becoming __doc__), because it is once again the first statement in the module. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
30 lines
825 B
Python
Executable File
30 lines
825 B
Python
Executable File
#!/usr/bin/python
|
|
import optparse
|
|
import os.path
|
|
import subprocess
|
|
import sys
|
|
|
|
parser = optparse.OptionParser()
|
|
parser.add_option("--limit", dest="limit", type=int,
|
|
help="Limit to this number of output entries.", default=0)
|
|
(opts, args) = parser.parse_args()
|
|
|
|
durations = {}
|
|
|
|
cmd = "subunit-1to2 | subunit-ls --times --no-passthrough"
|
|
|
|
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stdin=sys.stdin, shell=True)
|
|
for l in p.stdout:
|
|
l = l.strip()
|
|
(name, duration) = l.rsplit(" ", 1)
|
|
durations[name] = float(duration)
|
|
|
|
if opts.limit:
|
|
print("Top %d tests by run time:" % opts.limit)
|
|
|
|
for i, (name, length) in enumerate(sorted(
|
|
durations.items(), key=lambda x: x[1], reverse=True)):
|
|
if opts.limit and i == opts.limit:
|
|
break
|
|
print("%d: %s -> %ds" % (i+1, name, length))
|