| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 /** | 5 /** |
| 6 * This is a helper for run.sh. We try to run all of the Dart code in one | 6 * This is a helper for run.sh. We try to run all of the Dart code in one |
| 7 * instance of the Dart VM to reduce warm-up time. | 7 * instance of the Dart VM to reduce warm-up time. |
| 8 */ | 8 */ |
| 9 library run_impl; | 9 library run_impl; |
| 10 | 10 |
| 11 import 'dart:io'; | 11 import 'dart:io'; |
| 12 import 'package:unittest/compact_vm_config.dart'; | 12 import 'package:unittest/compact_vm_config.dart'; |
| 13 import 'package:unittest/unittest.dart'; | 13 import 'package:unittest/unittest.dart'; |
| 14 import 'package:polymer/testing/content_shell_test.dart'; | 14 import 'package:polymer/testing/content_shell_test.dart'; |
| 15 | 15 |
| 16 import 'css_test.dart' as css_test; | 16 import 'css_test.dart' as css_test; |
| 17 import 'compiler_test.dart' as compiler_test; | 17 import 'compiler_test.dart' as compiler_test; |
| 18 import 'paths_test.dart' as paths_test; | |
| 19 import 'utils_test.dart' as utils_test; | 18 import 'utils_test.dart' as utils_test; |
| 19 import 'transform/all_phases_test.dart' as all_phases_test; |
| 20 import 'transform/code_extractor_test.dart' as code_extractor_test; | 20 import 'transform/code_extractor_test.dart' as code_extractor_test; |
| 21 import 'transform/import_inliner_test.dart' as import_inliner_test; | 21 import 'transform/import_inliner_test.dart' as import_inliner_test; |
| 22 import 'transform/polyfill_injector_test.dart' as polyfill_injector_test; |
| 22 import 'transform/script_compactor_test.dart' as script_compactor_test; | 23 import 'transform/script_compactor_test.dart' as script_compactor_test; |
| 23 import 'transform/all_phases_test.dart' as all_phases_test; | |
| 24 | 24 |
| 25 main() { | 25 main() { |
| 26 var args = new Options().arguments; | 26 var args = new Options().arguments; |
| 27 var pattern = new RegExp(args.length > 0 ? args[0] : '.'); | 27 var pattern = new RegExp(args.length > 0 ? args[0] : '.'); |
| 28 | 28 |
| 29 useCompactVMConfiguration(); | 29 useCompactVMConfiguration(); |
| 30 | 30 |
| 31 void addGroup(testFile, testMain) { | 31 void addGroup(testFile, testMain) { |
| 32 if (pattern.hasMatch(testFile)) { | 32 if (pattern.hasMatch(testFile)) { |
| 33 group(testFile.replaceAll('_test.dart', ':'), testMain); | 33 group(testFile.replaceAll('_test.dart', ':'), testMain); |
| 34 } | 34 } |
| 35 } | 35 } |
| 36 | 36 |
| 37 addGroup('compiler_test.dart', compiler_test.main); | 37 addGroup('compiler_test.dart', compiler_test.main); |
| 38 addGroup('css_test.dart', css_test.main); | 38 addGroup('css_test.dart', css_test.main); |
| 39 addGroup('paths_test.dart', paths_test.main); | |
| 40 addGroup('utils_test.dart', utils_test.main); | 39 addGroup('utils_test.dart', utils_test.main); |
| 41 addGroup('transform/code_extractor_test.dart', code_extractor_test.main); | 40 addGroup('transform/code_extractor_test.dart', code_extractor_test.main); |
| 42 addGroup('transform/import_inliner_test.dart', import_inliner_test.main); | 41 addGroup('transform/import_inliner_test.dart', import_inliner_test.main); |
| 43 addGroup('transform/script_compactor_test.dart', script_compactor_test.main); | 42 addGroup('transform/script_compactor_test.dart', script_compactor_test.main); |
| 43 addGroup('transform/polyfill_injector_test.dart', |
| 44 polyfill_injector_test.main); |
| 44 addGroup('transform/all_phases_test.dart', all_phases_test.main); | 45 addGroup('transform/all_phases_test.dart', all_phases_test.main); |
| 45 | 46 |
| 46 endToEndTests('data/unit/', 'data/out'); | 47 endToEndTests('data/unit/', 'data/out'); |
| 47 | 48 |
| 48 // Note: if you're adding more render test suites, make sure to update run.sh | 49 // Note: if you're adding more render test suites, make sure to update run.sh |
| 49 // as well for convenient baseline diff/updating. | 50 // as well for convenient baseline diff/updating. |
| 50 | 51 |
| 51 // TODO(jmesserly): figure out why this fails in content_shell but works in | 52 // TODO(jmesserly): figure out why this fails in content_shell but works in |
| 52 // Dartium and Firefox when using the ShadowDOM polyfill. | 53 // Dartium and Firefox when using the ShadowDOM polyfill. |
| 53 exampleTest('../example/component/news', ['--no-shadowdom']..addAll(args)); | 54 exampleTest('../example/component/news', ['--no-shadowdom']..addAll(args)); |
| 54 | 55 |
| 55 exampleTest('../../../samples/third_party/todomvc'); | 56 exampleTest('../../../samples/third_party/todomvc'); |
| 56 } | 57 } |
| 57 | 58 |
| 58 void exampleTest(String path, [List<String> args]) { | 59 void exampleTest(String path, [List args]) { |
| 59 renderTests(path, '$path/test', '$path/test/expected', '$path/test/out', | 60 // TODO(sigmund): renderTests currently contatenates [path] with the out |
| 60 arguments: args); | 61 // folder. This can be a problem with relative paths that go up (like todomvc |
| 62 // above, which has '../../../'). If we continue running tests with |
| 63 // test/run.sh, we should fix this. For now we work around this problem by |
| 64 // using a long path 'data/out/example/test'. That way we avoid dumping output |
| 65 // in the source-tree. |
| 66 renderTests(path, '$path/test', '$path/test/expected', |
| 67 'data/out/example/test', arguments: args); |
| 61 } | 68 } |
| 62 | |
| 63 void cssCompileMangleTest(String path, String pattern, | |
| 64 [bool deleteDirectory = true]) { | |
| 65 renderTests(path, path, '$path/expected', '$path/out', | |
| 66 arguments: ['--css-mangle'], pattern: pattern, | |
| 67 deleteDir: deleteDirectory); | |
| 68 } | |
| 69 | |
| 70 void cssCompilePolyFillTest(String path, String pattern, String cssReset, | |
| 71 [bool deleteDirectory = true]) { | |
| 72 var args = ['--no-css-mangle']; | |
| 73 if (cssReset != null) { | |
| 74 args.addAll(['--css-reset', '${path}/${cssReset}']); | |
| 75 } | |
| 76 renderTests(path, path, '$path/expected', '$path/out', | |
| 77 arguments: args, pattern: pattern, deleteDir: deleteDirectory); | |
| 78 } | |
| 79 | |
| 80 void cssCompileShadowDOMTest(String path, String pattern, | |
| 81 [bool deleteDirectory = true]) { | |
| 82 var args = ['--no-css']; | |
| 83 renderTests(path, path, '$path/expected', '$path/out', | |
| 84 arguments: args, pattern: pattern, | |
| 85 deleteDir: deleteDirectory); | |
| 86 } | |
| OLD | NEW |