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:async'; | 11 import 'dart:async'; |
12 import 'dart:io'; | 12 import 'dart:io'; |
13 import 'dart:utf' show encodeUtf8; | 13 import 'dart:utf' show encodeUtf8; |
14 import 'dart:isolate'; | 14 import 'dart:isolate'; |
15 import 'package:unittest/compact_vm_config.dart'; | 15 import 'package:unittest/compact_vm_config.dart'; |
16 import 'package:unittest/unittest.dart'; | 16 import 'package:unittest/unittest.dart'; |
17 import 'package:web_ui/dwc.dart' as dwc; | 17 import 'package:web_ui/dwc.dart' as dwc; |
18 | 18 |
19 import 'analyzer_test.dart' as analyzer_test; | 19 import 'analyzer_test.dart' as analyzer_test; |
20 import 'compiler_test.dart' as compiler_test; | 20 import 'compiler_test.dart' as compiler_test; |
21 import 'directive_parser_test.dart' as directive_test; | |
22 import 'emitter_test.dart' as emitter_test; | 21 import 'emitter_test.dart' as emitter_test; |
23 import 'html5_utils_test.dart' as html5_utils_test; | 22 import 'html5_utils_test.dart' as html5_utils_test; |
24 import 'html_cleaner_test.dart' as html_cleaner_test; | 23 import 'html_cleaner_test.dart' as html_cleaner_test; |
25 import 'linked_list_test.dart' as linked_list_test; | 24 import 'linked_list_test.dart' as linked_list_test; |
| 25 import 'observe_test.dart' as observe_test; |
26 import 'path_info_test.dart' as path_info_test; | 26 import 'path_info_test.dart' as path_info_test; |
27 import 'utils_test.dart' as utils_test; | 27 import 'utils_test.dart' as utils_test; |
28 import 'watcher_test.dart' as watcher_test; | 28 import 'watcher_test.dart' as watcher_test; |
29 | 29 |
30 main() { | 30 main() { |
31 var args = new Options().arguments; | 31 var args = new Options().arguments; |
32 var pattern = new RegExp(args.length > 0 ? args[0] : '.'); | 32 var pattern = new RegExp(args.length > 0 ? args[0] : '.'); |
33 | 33 |
34 useCompactVMConfiguration(); | 34 useCompactVMConfiguration(); |
35 | 35 |
36 void addGroup(testFile, testMain) { | 36 void addGroup(testFile, testMain) { |
37 if (pattern.hasMatch(testFile)) { | 37 if (pattern.hasMatch(testFile)) { |
38 group(testFile.replaceAll('_test.dart', ':'), testMain); | 38 group(testFile.replaceAll('_test.dart', ':'), testMain); |
39 } | 39 } |
40 } | 40 } |
41 | 41 |
42 addGroup('analyzer_test.dart', analyzer_test.main); | 42 addGroup('analyzer_test.dart', analyzer_test.main); |
43 addGroup('compiler_test.dart', compiler_test.main); | 43 addGroup('compiler_test.dart', compiler_test.main); |
44 addGroup('directive_parser_test.dart', directive_test.main); | |
45 addGroup('emitter_test.dart', emitter_test.main); | 44 addGroup('emitter_test.dart', emitter_test.main); |
46 addGroup('html5_utils_test.dart', html5_utils_test.main); | 45 addGroup('html5_utils_test.dart', html5_utils_test.main); |
47 addGroup('html_cleaner_test.dart', html_cleaner_test.main); | 46 addGroup('html_cleaner_test.dart', html_cleaner_test.main); |
48 addGroup('linked_list_test.dart', linked_list_test.main); | 47 addGroup('linked_list_test.dart', linked_list_test.main); |
| 48 addGroup('observe_test.dart', observe_test.main); |
49 addGroup('path_info_test.dart', path_info_test.main); | 49 addGroup('path_info_test.dart', path_info_test.main); |
50 addGroup('utils_test.dart', utils_test.main); | 50 addGroup('utils_test.dart', utils_test.main); |
51 addGroup('watcher_test.dart', watcher_test.main); | 51 addGroup('watcher_test.dart', watcher_test.main); |
52 | 52 |
53 // TODO(jmesserly): should have listSync for scripting... | 53 // TODO(jmesserly): should have listSync for scripting... |
54 var lister = new Directory.fromPath(new Path('data/input')).list(); | 54 var lister = new Directory.fromPath(new Path('data/input')).list(); |
55 var cwd = new Path(new Directory.current().path); | 55 var cwd = new Path(new Directory.current().path); |
56 var inputDir = cwd.append('data/input'); | 56 var inputDir = cwd.append('data/input'); |
57 lister.onFile = (path) { | 57 lister.onFile = (path) { |
58 if (!path.endsWith('_test.html') || !pattern.hasMatch(path)) return; | 58 if (!path.endsWith('_test.html') || !pattern.hasMatch(path)) return; |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 Future _writeFile(String path, String text) { | 99 Future _writeFile(String path, String text) { |
100 return new File(path).open(FileMode.WRITE) | 100 return new File(path).open(FileMode.WRITE) |
101 .then((file) => file.writeString(text)) | 101 .then((file) => file.writeString(text)) |
102 .then((file) => file.close()); | 102 .then((file) => file.close()); |
103 } | 103 } |
104 | 104 |
105 Future<int> _diff(expectedPath, outputPath) { | 105 Future<int> _diff(expectedPath, outputPath) { |
106 return Process.run('diff', ['-q', expectedPath, outputPath]) | 106 return Process.run('diff', ['-q', expectedPath, outputPath]) |
107 .then((res) => res.exitCode); | 107 .then((res) => res.exitCode); |
108 } | 108 } |
OLD | NEW |