Chromium Code Reviews| 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 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 Loading... | |
| 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(args.join(' ')); | |
|
ricow1
2015/01/20 06:15:05
print('Running: python ${args.join(" ")}');
kevmoo
2015/01/20 16:48:10
Done.
| |
| 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 Loading... | |
| 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 = new Set<String>(); | |
|
ricow1
2015/01/20 06:15:05
something like:
var arches = combinations.fold(new
kevmoo
2015/01/20 16:48:10
Done.
| |
| 138 for (var combo in combinations) { | |
| 139 var comboArches = combo['archs']; | |
| 140 arches.addAll(comboArches); | |
| 141 } | |
| 142 | |
| 143 ensureBuild(arches); | |
| 134 | 144 |
| 135 List<String> keys; | 145 List<String> keys; |
| 136 for (var combination in getCombinations()) { | 146 for (var combination in combinations) { |
| 137 for (var mode in combination['modes']) { | 147 for (var mode in combination['modes']) { |
| 138 for (var arch in combination['archs']) { | 148 for (var arch in combination['archs']) { |
| 139 for (var runtime in combination['runtimes']) { | 149 for (var runtime in combination['runtimes']) { |
| 140 var compiler = combination['compiler']; | 150 var compiler = combination['compiler']; |
| 141 | 151 |
| 142 var args = ['tools/test.py', '-m$mode', '-c$compiler', '-r$runtime', | 152 var args = ['tools/test.py', '-m$mode', '-c$compiler', '-r$runtime', |
| 143 '-a$arch', '--report-in-json', '--use-sdk']; | 153 '-a$arch', '--report-in-json', '--use-sdk']; |
| 144 var result = Process.runSync('python', args); | 154 var result = Process.runSync('python', args); |
| 145 if (result.exitCode != 0) { | 155 if (result.exitCode != 0) { |
| 146 print(result.stdout); | 156 print(result.stdout); |
| 147 print(result.stderr); | 157 print(result.stderr); |
| 148 throw new Exception("Error running: ${args.join(" ")}"); | 158 throw new Exception("Error running: ${args.join(" ")}"); |
| 149 } | 159 } |
| 150 | 160 |
| 151 // Find Total: 15063 tests | 161 // Find "JSON:" |
| 152 // Everything after this will be the report. | 162 // Everything after will the JSON-formatted output |
|
ricow1
2015/01/20 06:15:05
. at end of comment, consider also saying "because
kevmoo
2015/01/20 16:48:10
Done.
| |
| 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 Loading... | |
| 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 } |
| OLD | NEW |