]> git.lizzy.rs Git - rust.git/blob - src/etc/check-summary.py
auto merge of #14133 : db48x/rust/ord-for-mut-refs, r=alexcrichton
[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     def summarise(fname):
19         summary = {}
20         with open(fname) as fd:
21             for line in fd:
22                 splitline = line.strip().split(' ')
23                 if len(splitline) == 1:
24                     continue
25                 status = splitline[0]
26                 test = splitline[-1]
27                 # track bench runs
28                 if splitline[1] == 'ns/iter':
29                     status = 'bench'
30                 if not summary.has_key(status):
31                     summary[status] = []
32                 summary[status].append(test)
33             summaries.append((fname, summary))
34     def count(t):
35         return sum(map(lambda (f, s): len(s.get(t, [])), summaries))
36     logfiles = sys.argv[1:]
37     for files in map(glob.glob, logfiles):
38         map(summarise, files)
39     ok = count('ok')
40     failed = count('failed')
41     ignored = count('ignored')
42     measured = count('bench')
43     print "summary of %d test runs: %d passed; %d failed; %d ignored; %d measured" % \
44             (len(logfiles), ok, failed, ignored, measured)
45     print ""
46     if failed > 0:
47         print "failed tests:"
48         for f, s in summaries:
49             failures = s.get('failed', [])
50             if len(failures) > 0:
51                 print "  %s:" % (f)
52             for test in failures:
53                 print "    %s" % (test)