Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(445)

Side by Side Diff: tools/testing/dart/status_reporter.dart

Issue 847873004: Outputing comma-separated report with percentages (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: nits Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | tools/testing/dart/summary_report.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file.
4
5 import 'dart:io';
6 import 'dart:convert';
7
8 List<Map> LINUX_COMBINATIONS = [
9 {
10 'runtimes' : ['none'],
11 'modes' : ['release'],
12 'archs' : ['ia32'],
13 'compiler' : 'dartanalyzer'
14 },
15 {
16 'runtimes' : ['vm'],
17 'modes' : ['debug', 'release'],
18 'archs' : ['ia32', 'x64', 'simarm', 'simmips'],
19 'compiler' : 'none'
20 },
21 {
22 'runtimes' : ['vm'],
23 'modes' : ['release'],
24 'archs' : ['ia32', 'x64'],
25 'compiler' : 'dart2dart'
26 },
27 {
28 'runtimes' : ['d8', 'jsshell', 'chrome', 'ff'],
29 'modes' : ['release'],
30 'archs' : ['ia32'],
31 'compiler' : 'dart2js'
32 },
33 {
34 'runtimes' : ['dartium'],
35 'modes' : ['release', 'debug'],
36 'archs' : ['ia32'],
37 'compiler' : 'none'
38 },
39 ];
40
41 List<Map> MACOS_COMBINATIONS = [
42 {
43 'runtimes' : ['vm'],
44 'modes' : ['debug', 'release'],
45 'archs' : ['ia32', 'x64'],
46 'compiler' : 'none'
47 },
48 {
49 'runtimes' : ['safari', 'safarimobilesim'],
50 'modes' : ['release'],
51 'archs' : ['ia32'],
52 'compiler' : 'dart2js'
53 },
54 {
55 'runtimes' : ['dartium'],
56 'modes' : ['release', 'debug'],
57 'archs' : ['ia32'],
58 'compiler' : 'none'
59 },
60 ];
61
62 List<Map> WINDOWS_COMBINATIONS = [
63 {
64 'runtimes' : ['vm'],
65 'modes' : ['debug', 'release'],
66 'archs' : ['ia32', 'x64'],
67 'compiler' : 'none'
68 },
69 {
70 'runtimes' : ['chrome', 'ff', 'ie11', 'ie10'],
71 'modes' : ['release'],
72 'archs' : ['ia32'],
73 'compiler' : 'dart2js'
74 },
75 {
76 'runtimes' : ['dartium'],
77 'modes' : ['release', 'debug'],
78 'archs' : ['ia32'],
79 'compiler' : 'none'
80 },
81 ];
82
83 Map<String, List<Map>> COMBINATIONS = {
84 'linux' : LINUX_COMBINATIONS,
85 'windows' : WINDOWS_COMBINATIONS,
86 'macos' : MACOS_COMBINATIONS
87 };
88
89 List<Map> getCombinations() {
90 return COMBINATIONS[Platform.operatingSystem];
91 }
92
93 void ensureBuild() {
94 print('Building many platforms. Please be patient.');
95 var archs = Platform.operatingSystem == 'linux'
96 ? '-aia32,x64,simarm,simmips'
97 : '-aia32,x64';
98
99 var result = Process.runSync('python',
100 ['tools/build.py', '-mrelease,debug', archs, 'create_sdk',
101 // We build runtime to be able to list cc tests
102 'runtime']);
103
104 if (result.exitCode != 0) {
105 print('ERROR');
106 print(result.stderr);
107 throw new Exception('Error while building.');
108 }
109 print('Done building.');
110 }
111
112 void sanityCheck(String output) {
113 LineSplitter splitter = new LineSplitter();
114 var lines = splitter.convert(output);
115 // Looks like this:
116 // Total: 15556 tests
117 var total = int.parse(lines[0].split(' ')[1].trim());
118 var count = 0;
119 for (var i = 1; i < lines.length; i++) {
120 if (lines[i] == '') continue;
121 // Looks like this:
122 // * 3218 tests will be skipped (3047 skipped by design)
123 count += int.parse(lines[i].split(' ')[2].trim());
124 }
125 if (count != total) {
126 print('Count: $count, total: $total');
127 throw new Exception(
128 'Count and total do not align. Please validate manually.');
129 }
130 }
131
132 void main(List<String> args) {
133 ensureBuild();
134
135 List<String> keys;
136 for (var combination in getCombinations()) {
137 for (var mode in combination['modes']) {
138 for (var arch in combination['archs']) {
139 for (var runtime in combination['runtimes']) {
140 var compiler = combination['compiler'];
141
142 var args = ['tools/test.py', '-m$mode', '-c$compiler', '-r$runtime',
143 '-a$arch', '--report-in-json', '--use-sdk'];
144 var result = Process.runSync('python', args);
145 if (result.exitCode != 0) {
146 print(result.stdout);
147 print(result.stderr);
148 throw new Exception("Error running: ${args.join(" ")}");
149 }
150
151 // Find Total: 15063 tests
152 // Everything after this will be the report.
153 var totalIndex = result.stdout.indexOf('JSON:');
154 var report = result.stdout.substring(totalIndex + 5);
155
156 var map = JSON.decode(report) as Map;
157
158 if (keys == null) {
159 keys = map.keys.toList();
160 var firstKey = keys.removeAt(0);
161 if (firstKey != 'total') {
162 throw '"total" should be the first key';
163 }
164
165 var headers = ['compiler', 'runtime', 'arch', 'mode', 'total'];
166 for (var k in keys) {
167 headers.addAll([k, '${k}_pct']);
168 }
169 print(headers.join(','));
170 }
171
172 var total = map['total'];
173 var values = [compiler, runtime, arch, mode, total];
174
175 for (var key in keys) {
176 var value = map[key];
177 values.add(value);
178 var pct = 100*(value/total);
179 values.add('${pct.toStringAsFixed(3)}%');
180 }
181
182 print(values.join(','));
183 }
184 }
185 }
186 }
187 }
OLDNEW
« no previous file with comments | « no previous file | tools/testing/dart/summary_report.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698