Chromium Code Reviews| OLD | NEW |
|---|---|
| (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 - please be patient we build a lot of crap'); | |
|
ricow1
2015/01/13 08:03:00
I know I wrote this, but maybe change the wording
kevmoo
2015/01/13 19:27:35
Done.
| |
| 95 var archs = Platform.operatingSystem == 'linux' | |
| 96 ? '-aia32,x64,simarm,simmips' | |
| 97 : '-aia32,x64'; | |
| 98 var result = Process.runSync('python', ['tools/build.py', '-mrelease,debug', | |
|
ricow1
2015/01/13 08:03:01
add comment stating:
// We build runtime to be abl
kevmoo
2015/01/13 19:27:35
Done.
| |
| 99 archs, | |
| 100 'create_sdk', 'runtime']); | |
| 101 if (result.exitCode != 0) { | |
| 102 print('ERROR'); | |
|
ricow1
2015/01/13 08:03:01
remove this line
kevmoo
2015/01/13 19:27:35
Done.
| |
| 103 print(result.stdout); | |
| 104 print(result.stderr); | |
|
ricow1
2015/01/13 08:03:01
trow after this, we don't want to pretend we can r
kevmoo
2015/01/13 19:27:35
Done.
| |
| 105 } | |
| 106 print('done building'); | |
|
ricow1
2015/01/13 08:03:00
s/done/Done
kevmoo
2015/01/13 19:27:35
Done.
| |
| 107 } | |
| 108 | |
| 109 void sanityCheck(String output) { | |
| 110 LineSplitter splitter = new LineSplitter(); | |
| 111 var lines = splitter.convert(output); | |
| 112 // Looks like this: | |
| 113 // Total: 15556 tests | |
| 114 var total = int.parse(lines[0].split(' ')[1].trim()); | |
| 115 var count = 0; | |
| 116 for (var i = 1; i < lines.length; i++) { | |
| 117 if (lines[i] == '') continue; | |
| 118 // Looks like this: | |
| 119 // * 3218 tests will be skipped (3047 skipped by design) | |
| 120 count += int.parse(lines[i].split(' ')[2].trim()); | |
| 121 } | |
| 122 if (count != total) { | |
| 123 print('Count: $count, total: $total'); | |
| 124 throw 'Foobar'; | |
|
ricow1
2015/01/13 08:03:01
Trow a better string than Foobar here:
This is jus
kevmoo
2015/01/13 19:27:35
Done.
| |
| 125 } | |
| 126 } | |
| 127 | |
| 128 void main(List<String> args) { | |
| 129 ensureBuild(); | |
| 130 | |
| 131 List<String> keys; | |
| 132 for (var combination in getCombinations()) { | |
| 133 for (var mode in combination['modes']) { | |
| 134 for (var arch in combination['archs']) { | |
| 135 for (var runtime in combination['runtimes']) { | |
| 136 var compiler = combination['compiler']; | |
| 137 | |
| 138 var args = ['tools/test.py', '-m$mode', '-c$compiler', '-r$runtime', | |
| 139 '-a$arch', '--json-only', '--use-sdk']; | |
| 140 var result = Process.runSync('python', args); | |
| 141 if (result.exitCode != 0) { | |
| 142 print(result.stdout); | |
| 143 print(result.stderr); | |
| 144 throw "Error running"; | |
|
ricow1
2015/01/13 08:03:00
'Error running: ${args.join(" ")}';
kevmoo
2015/01/13 19:27:35
Done.
| |
| 145 } | |
| 146 | |
| 147 // Find Total: 15063 tests | |
| 148 // Everything after this will be the report. | |
| 149 var totalIndex = result.stdout.indexOf('JSON:'); | |
| 150 var report = result.stdout.substring(totalIndex+5); | |
|
ricow1
2015/01/13 08:03:01
space around +
kevmoo
2015/01/13 19:27:35
Done.
| |
| 151 | |
| 152 var map = JSON.decode(report) as Map; | |
| 153 | |
| 154 if (keys == null) { | |
| 155 keys = map.keys.toList(); | |
| 156 var firstKey = keys.removeAt(0); | |
| 157 if (firstKey != 'total') { | |
| 158 throw '"total" should be the first key'; | |
| 159 } | |
| 160 | |
| 161 var headers = ['compiler', 'runtime', 'arch', 'mode', 'total']; | |
| 162 for (var k in keys) { | |
| 163 headers.addAll([k, '${k}_pct']); | |
| 164 } | |
| 165 print(headers.join(',')); | |
| 166 } | |
| 167 | |
| 168 var total = map['total']; | |
| 169 var values = [compiler, runtime, arch, mode, total]; | |
| 170 | |
| 171 for (var key in keys) { | |
| 172 var value = map[key]; | |
| 173 values.add(value); | |
| 174 var pct = 100*(value/total); | |
| 175 values.add('${pct.toStringAsFixed(3)}%'); | |
| 176 } | |
| 177 | |
| 178 print(values.join(',')); | |
| 179 } | |
| 180 } | |
| 181 } | |
| 182 } | |
| 183 } | |
| OLD | NEW |