Skip to content
Snippets Groups Projects
unit_test_speed.py 582 B
Newer Older
"""
Usage unit_test_speed.py <build-log> <output-csv>

Given a the raw output from a Jenkins build server log this script will output
a CSV file of the speed for each unit test.
"""
import sys

with open(sys.argv[1], 'r') as f:
    lines = f.readlines()

lines = filter(lambda x: "....   Passed" in x, lines)
names = [l.split(':')[1].split("....")[0] for l in lines]
times = [l.split('Passed')[-1].split('sec')[0] for l in lines]

with open(sys.argv[2], 'w') as f:
    f.write("name, time\n")
    for name, time in zip(names, times):
        f.write(", ".join([name, time]) + "\n")