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

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

Issue 860723002: cleanup to status_reporter (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: oops 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 | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 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 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. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 import 'dart:io'; 5 import 'dart:io';
6 import 'dart:convert'; 6 import 'dart:convert';
7 7
8 List<Map> LINUX_COMBINATIONS = [ 8 List<Map> LINUX_COMBINATIONS = [
9 { 9 {
10 'runtimes' : ['none'], 10 'runtimes' : ['none'],
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 Map<String, List<Map>> COMBINATIONS = { 83 Map<String, List<Map>> COMBINATIONS = {
84 'linux' : LINUX_COMBINATIONS, 84 'linux' : LINUX_COMBINATIONS,
85 'windows' : WINDOWS_COMBINATIONS, 85 'windows' : WINDOWS_COMBINATIONS,
86 'macos' : MACOS_COMBINATIONS 86 'macos' : MACOS_COMBINATIONS
87 }; 87 };
88 88
89 List<Map> getCombinations() { 89 List<Map> getCombinations() {
90 return COMBINATIONS[Platform.operatingSystem]; 90 return COMBINATIONS[Platform.operatingSystem];
91 } 91 }
92 92
93 void ensureBuild() { 93 void ensureBuild(Iterable<String> archs) {
94 print('Building many platforms. Please be patient.'); 94 print('Building many platforms. Please be patient.');
95 var archs = Platform.operatingSystem == 'linux'
96 ? '-aia32,x64,simarm,simmips'
97 : '-aia32,x64';
98 95
99 var result = Process.runSync('python', 96 var archString = '-a${archs.join(',')}';
100 ['tools/build.py', '-mrelease,debug', archs, 'create_sdk', 97
101 // We build runtime to be able to list cc tests 98 var args = ['tools/build.py', '-mrelease,debug', archString, 'create_sdk',
102 'runtime']); 99 // We build runtime to be able to list cc tests
100 'runtime'];
101
102 print('Running: python ${args.join(" ")}');
103
104 var result = Process.runSync('python', args);
103 105
104 if (result.exitCode != 0) { 106 if (result.exitCode != 0) {
105 print('ERROR'); 107 print('ERROR');
106 print(result.stderr); 108 print(result.stderr);
107 throw new Exception('Error while building.'); 109 throw new Exception('Error while building.');
108 } 110 }
109 print('Done building.'); 111 print('Done building.');
110 } 112 }
111 113
112 void sanityCheck(String output) { 114 void sanityCheck(String output) {
(...skipping 10 matching lines...) Expand all
123 count += int.parse(lines[i].split(' ')[2].trim()); 125 count += int.parse(lines[i].split(' ')[2].trim());
124 } 126 }
125 if (count != total) { 127 if (count != total) {
126 print('Count: $count, total: $total'); 128 print('Count: $count, total: $total');
127 throw new Exception( 129 throw new Exception(
128 'Count and total do not align. Please validate manually.'); 130 'Count and total do not align. Please validate manually.');
129 } 131 }
130 } 132 }
131 133
132 void main(List<String> args) { 134 void main(List<String> args) {
133 ensureBuild(); 135 var combinations = getCombinations();
136
137 var arches = combinations.fold(new Set<String>(), (set, value) {
138 set.addAll(value['archs']);
139 return set;
140 });
141
142 ensureBuild(arches);
134 143
135 List<String> keys; 144 List<String> keys;
136 for (var combination in getCombinations()) { 145 for (var combination in combinations) {
137 for (var mode in combination['modes']) { 146 for (var mode in combination['modes']) {
138 for (var arch in combination['archs']) { 147 for (var arch in combination['archs']) {
139 for (var runtime in combination['runtimes']) { 148 for (var runtime in combination['runtimes']) {
140 var compiler = combination['compiler']; 149 var compiler = combination['compiler'];
141 150
142 var args = ['tools/test.py', '-m$mode', '-c$compiler', '-r$runtime', 151 var args = ['tools/test.py', '-m$mode', '-c$compiler', '-r$runtime',
143 '-a$arch', '--report-in-json', '--use-sdk']; 152 '-a$arch', '--report-in-json', '--use-sdk'];
144 var result = Process.runSync('python', args); 153 var result = Process.runSync('python', args);
145 if (result.exitCode != 0) { 154 if (result.exitCode != 0) {
146 print(result.stdout); 155 print(result.stdout);
147 print(result.stderr); 156 print(result.stderr);
148 throw new Exception("Error running: ${args.join(" ")}"); 157 throw new Exception("Error running: ${args.join(" ")}");
149 } 158 }
150 159
151 // Find Total: 15063 tests 160 // Find "JSON:"
152 // Everything after this will be the report. 161 // Everything after will the JSON-formatted output
162 // per --report-in-json flag above
153 var totalIndex = result.stdout.indexOf('JSON:'); 163 var totalIndex = result.stdout.indexOf('JSON:');
154 var report = result.stdout.substring(totalIndex + 5); 164 var report = result.stdout.substring(totalIndex + 5);
155 165
156 var map = JSON.decode(report) as Map; 166 var map = JSON.decode(report) as Map;
157 167
158 if (keys == null) { 168 if (keys == null) {
159 keys = map.keys.toList(); 169 keys = map.keys.toList();
160 var firstKey = keys.removeAt(0); 170 var firstKey = keys.removeAt(0);
161 if (firstKey != 'total') { 171 if (firstKey != 'total') {
162 throw '"total" should be the first key'; 172 throw '"total" should be the first key';
(...skipping 15 matching lines...) Expand all
178 var pct = 100*(value/total); 188 var pct = 100*(value/total);
179 values.add('${pct.toStringAsFixed(3)}%'); 189 values.add('${pct.toStringAsFixed(3)}%');
180 } 190 }
181 191
182 print(values.join(',')); 192 print(values.join(','));
183 } 193 }
184 } 194 }
185 } 195 }
186 } 196 }
187 } 197 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698