| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 // Helper file that can be used to manually test the stability of incremental | 5 // Helper file that can be used to manually test the stability of incremental |
| 6 // compilation. Currently this test is not run automatically. | 6 // compilation. Currently this test is not run automatically. |
| 7 | 7 |
| 8 import 'dart:async'; | 8 import 'dart:async'; |
| 9 | 9 |
| 10 import 'dart:io'; | 10 import 'dart:io'; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 String source = | 31 String source = |
| 32 new File.fromUri(Uri.base.resolve(argument)).readAsStringSync(); | 32 new File.fromUri(Uri.base.resolve(argument)).readAsStringSync(); |
| 33 sources['${uri.path}'] = source; | 33 sources['${uri.path}'] = source; |
| 34 } | 34 } |
| 35 sw.stop(); | 35 sw.stop(); |
| 36 print(sw.elapsedMilliseconds); | 36 print(sw.elapsedMilliseconds); |
| 37 compileTests(sources); | 37 compileTests(sources); |
| 38 } | 38 } |
| 39 | 39 |
| 40 void compileTests(Map<String, String> sources) { | 40 void compileTests(Map<String, String> sources) { |
| 41 int cancellations = 0; | |
| 42 int testCount = 0; | 41 int testCount = 0; |
| 43 int skipCount = 0; | 42 int skipCount = 0; |
| 44 Set<String> crashes = new Set<String>(); | 43 Set<String> crashes = new Set<String>(); |
| 45 Compiler memoryCompiler = compilerFor(sources); | 44 Compiler memoryCompiler = compilerFor(sources); |
| 46 memoryCompiler.handler.verbose = verbose; | 45 memoryCompiler.handler.verbose = verbose; |
| 47 var options = ['--analyze-main']; | 46 var options = ['--analyze-main']; |
| 48 if (true || verbose) options.add('--verbose'); | 47 if (true || verbose) options.add('--verbose'); |
| 49 IncrementalCompiler compiler = new IncrementalCompiler( | 48 IncrementalCompiler compiler = new IncrementalCompiler( |
| 50 libraryRoot: memoryCompiler.libraryRoot, | 49 libraryRoot: memoryCompiler.libraryRoot, |
| 51 inputProvider: memoryCompiler.provider, | 50 inputProvider: memoryCompiler.provider, |
| (...skipping 10 matching lines...) Expand all Loading... |
| 62 print('Skipped broken test $path'); | 61 print('Skipped broken test $path'); |
| 63 skipCount++; | 62 skipCount++; |
| 64 return new Future.value(null); | 63 return new Future.value(null); |
| 65 } | 64 } |
| 66 } | 65 } |
| 67 Stopwatch sw = new Stopwatch()..start(); | 66 Stopwatch sw = new Stopwatch()..start(); |
| 68 return compiler.compile(Uri.parse('memory:$path')).then((bool success) { | 67 return compiler.compile(Uri.parse('memory:$path')).then((bool success) { |
| 69 UserTag.defaultTag.makeCurrent(); | 68 UserTag.defaultTag.makeCurrent(); |
| 70 sw.stop(); | 69 sw.stop(); |
| 71 print('Compiled $path in ${sw.elapsedMilliseconds}'); | 70 print('Compiled $path in ${sw.elapsedMilliseconds}'); |
| 72 if (compiler.compilerWasCancelled) cancellations++; | |
| 73 sw..reset()..start(); | 71 sw..reset()..start(); |
| 74 }).catchError((error, trace) { | 72 }).catchError((error, trace) { |
| 75 sw.stop(); | 73 sw.stop(); |
| 76 print('$error\n$trace'); | 74 print('$error\n$trace'); |
| 77 print('Crash when compiling $path after ${sw.elapsedMilliseconds}'); | 75 print('Crash when compiling $path after ${sw.elapsedMilliseconds}'); |
| 78 sw..reset()..start(); | 76 sw..reset()..start(); |
| 79 crashes.add(path); | 77 crashes.add(path); |
| 80 }); | 78 }); |
| 81 }).then((_) { | 79 }).then((_) { |
| 82 percent(i) => '${(i/testCount*100).toStringAsFixed(3)}%'; | 80 percent(i) => '${(i/testCount*100).toStringAsFixed(3)}%'; |
| 83 print(''' | 81 print(''' |
| 84 | 82 |
| 85 Total: $testCount tests | 83 Total: $testCount tests |
| 86 * $cancellations tests (${percent(cancellations)}) cancelled the compiler | |
| 87 * ${crashes.length} tests (${percent(crashes.length)}) crashed the compiler | 84 * ${crashes.length} tests (${percent(crashes.length)}) crashed the compiler |
| 88 * $skipCount tests (${percent(skipCount)}) were skipped | 85 * $skipCount tests (${percent(skipCount)}) were skipped |
| 89 '''); | 86 '''); |
| 90 for (String crash in crashes) { | 87 for (String crash in crashes) { |
| 91 print('Crashed: $crash'); | 88 print('Crashed: $crash'); |
| 92 } | 89 } |
| 93 if (!crashes.isEmpty) { | 90 if (!crashes.isEmpty) { |
| 94 throw 'Test had crashes'; | 91 throw 'Test had crashes'; |
| 95 } | 92 } |
| 96 }); | 93 }); |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 "/language/setter_declaration2_negative_test.dart", | 166 "/language/setter_declaration2_negative_test.dart", |
| 170 "/language/source_self_negative_test.dart", | 167 "/language/source_self_negative_test.dart", |
| 171 "/language/syntax_test.dart", | 168 "/language/syntax_test.dart", |
| 172 "/language/type_variable_bounds2_test.dart", | 169 "/language/type_variable_bounds2_test.dart", |
| 173 "/language/type_variable_conflict2_test.dart", | 170 "/language/type_variable_conflict2_test.dart", |
| 174 "/language/type_variable_field_initializer_test.dart", | 171 "/language/type_variable_field_initializer_test.dart", |
| 175 "/language/type_variable_nested_test.dart", | 172 "/language/type_variable_nested_test.dart", |
| 176 "/language/vm/reflect_core_vm_test.dart", | 173 "/language/vm/reflect_core_vm_test.dart", |
| 177 "/language/vm/regress_14903_test.dart", | 174 "/language/vm/regress_14903_test.dart", |
| 178 ]); | 175 ]); |
| OLD | NEW |