]> git.lizzy.rs Git - rust.git/blob - src/etc/check-summary.py
Auto merge of #31077 - nagisa:mir-temp-promotion, r=dotdash
[rust.git] / src / etc / check-summary.py
1 #!/usr/bin/env python
2 #
3 # Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
4 # file at the top-level directory of this distribution and at
5 # http://rust-lang.org/COPYRIGHT.
6 #
7 # Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
8 # http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
9 # <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
10 # option. This file may not be copied, modified, or distributed
11 # except according to those terms.
12
13 import glob
14 import sys
15
16 if __name__ == '__main__':
17     summaries = []
18
19     def summarise(fname):
20         summary = {}
21         with open(fname) as fd:
22             for line in fd:
23                 splitline = line.strip().split(' ')
24                 if len(splitline) == 1:
25                     continue
26                 status = splitline[0]
27                 test = splitline[-1]
28                 # track bench runs
29                 if splitline[1] == 'ns/iter':
30                     status = 'bench'
31                 if status not in summary:
32                     summary[status] = []
33                 summary[status].append(test)
34             summaries.append((fname, summary))
35
36     def count(t):
37         return sum(map(lambda f: len(f[1].get(t, [])), summaries))
38
39     logfiles = sys.argv[1:]
40     for files in map(glob.glob, logfiles):
41         map(summarise, files)
42     ok = count('ok')
43     failed = count('failed')
44     ignored = count('ignored')
45     measured = count('bench')
46     print("summary of %d test runs: %d passed; %d failed; %d ignored; %d measured" %
47           (len(logfiles), ok, failed, ignored, measured))
48     print("")
49
50     if failed > 0:
51         print("failed tests:")
52         for f, s in summaries:
53             failures = s.get('failed', [])
54             if len(failures) > 0:
55                 print("  %s:" % (f))
56             for test in failures:
57                 print("    %s" % (test))