diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 17:20:00 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 17:20:00 +0000 |
commit | 8daa83a594a2e98f39d764422bfbdbc62c9efd44 (patch) | |
tree | 4099e8021376c7d8c05bdf8503093d80e9c7bad0 /script/show_test_time | |
parent | Initial commit. (diff) | |
download | samba-8daa83a594a2e98f39d764422bfbdbc62c9efd44.tar.xz samba-8daa83a594a2e98f39d764422bfbdbc62c9efd44.zip |
Adding upstream version 2:4.20.0+dfsg.upstream/2%4.20.0+dfsg
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'script/show_test_time')
-rwxr-xr-x | script/show_test_time | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/script/show_test_time b/script/show_test_time new file mode 100755 index 0000000..70d29d7 --- /dev/null +++ b/script/show_test_time @@ -0,0 +1,29 @@ +#!/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)) |