| OLD | NEW |
| 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 final LINUX_COMBINATIONS = [ | 8 final LINUX_COMBINATIONS = [ |
| 9 { | 9 { |
| 10 'runtimes': ['none'], | 10 'runtimes': ['none'], |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 var combinations = getCombinations(); | 142 var combinations = getCombinations(); |
| 143 | 143 |
| 144 var arches = new Set<String>(); | 144 var arches = new Set<String>(); |
| 145 var modes = new Set<String>(); | 145 var modes = new Set<String>(); |
| 146 | 146 |
| 147 if (args.contains('--simple')) { | 147 if (args.contains('--simple')) { |
| 148 arches = ['ia32'].toSet(); | 148 arches = ['ia32'].toSet(); |
| 149 modes = ['release'].toSet(); | 149 modes = ['release'].toSet(); |
| 150 } else { | 150 } else { |
| 151 for (var combo in combinations) { | 151 for (var combo in combinations) { |
| 152 arches.addAll(combo['archs']); | 152 arches.addAll(combo['archs'] as List<String>); |
| 153 modes.addAll(combo['modes']); | 153 modes.addAll(combo['modes'] as List<String>); |
| 154 } | 154 } |
| 155 } | 155 } |
| 156 | 156 |
| 157 ensureBuild(modes, arches); | 157 ensureBuild(modes, arches); |
| 158 | 158 |
| 159 List<String> keys; | 159 List<String> keys; |
| 160 for (var combination in combinations) { | 160 for (var combination in combinations) { |
| 161 for (var mode in combination['modes']) { | 161 for (var mode in combination['modes']) { |
| 162 if (!modes.contains(mode)) { | 162 if (!modes.contains(mode)) { |
| 163 continue; | 163 continue; |
| 164 } | 164 } |
| 165 | 165 |
| 166 for (var arch in combination['archs']) { | 166 for (var arch in combination['archs']) { |
| 167 if (!arches.contains(arch)) { | 167 if (!arches.contains(arch)) { |
| 168 continue; | 168 continue; |
| 169 } | 169 } |
| 170 | 170 |
| 171 for (var runtime in combination['runtimes']) { | 171 for (var runtime in combination['runtimes']) { |
| 172 var compiler = combination['compiler']; | 172 var compiler = combination['compiler'] as String; |
| 173 | 173 |
| 174 var args = [ | 174 var args = [ |
| 175 'tools/test.py', | 175 'tools/test.py', |
| 176 '-m$mode', | 176 '-m$mode', |
| 177 '-c$compiler', | 177 '-c$compiler', |
| 178 '-r$runtime', | 178 '-r$runtime', |
| 179 '-a$arch', | 179 '-a$arch', |
| 180 '--report-in-json', | 180 '--report-in-json', |
| 181 '--use-sdk' | 181 '--use-sdk' |
| 182 ]; | 182 ]; |
| 183 var result = Process.runSync('python', args); | 183 var result = Process.runSync('python', args); |
| 184 if (result.exitCode != 0) { | 184 if (result.exitCode != 0) { |
| 185 print(result.stdout); | 185 print(result.stdout); |
| 186 print(result.stderr); | 186 print(result.stderr); |
| 187 throw new Exception("Error running: ${args.join(" ")}"); | 187 throw new Exception("Error running: ${args.join(" ")}"); |
| 188 } | 188 } |
| 189 | 189 |
| 190 // Find "JSON:" | 190 // Find "JSON:" |
| 191 // Everything after will the JSON-formatted output | 191 // Everything after will the JSON-formatted output |
| 192 // per --report-in-json flag above | 192 // per --report-in-json flag above |
| 193 var totalIndex = result.stdout.indexOf('JSON:'); | 193 var totalIndex = (result.stdout as String).indexOf('JSON:'); |
| 194 var report = result.stdout.substring(totalIndex + 5); | 194 var report = (result.stdout as String).substring(totalIndex + 5); |
| 195 | 195 |
| 196 var map = JSON.decode(report) as Map<String, int>; | 196 var map = JSON.decode(report) as Map<String, int>; |
| 197 | 197 |
| 198 if (keys == null) { | 198 if (keys == null) { |
| 199 keys = map.keys.toList(); | 199 keys = map.keys.toList(); |
| 200 var firstKey = keys.removeAt(0); | 200 var firstKey = keys.removeAt(0); |
| 201 if (firstKey != 'total') { | 201 if (firstKey != 'total') { |
| 202 throw '"total" should be the first key'; | 202 throw '"total" should be the first key'; |
| 203 } | 203 } |
| 204 | 204 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 218 var pct = 100 * (value / total); | 218 var pct = 100 * (value / total); |
| 219 values.add('${pct.toStringAsFixed(3)}%'); | 219 values.add('${pct.toStringAsFixed(3)}%'); |
| 220 } | 220 } |
| 221 | 221 |
| 222 print(values.join(',')); | 222 print(values.join(',')); |
| 223 } | 223 } |
| 224 } | 224 } |
| 225 } | 225 } |
| 226 } | 226 } |
| 227 } | 227 } |
| OLD | NEW |