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 import 'dart:async'; | 5 import 'dart:async'; |
6 import 'dart:io'; | 6 import 'dart:io'; |
7 | 7 |
8 import 'package:args/args.dart'; | 8 import 'package:args/args.dart'; |
9 import 'package:matcher/matcher.dart'; | 9 import 'package:matcher/matcher.dart'; |
10 import 'package:path/path.dart' as path; | 10 import 'package:path/path.dart' as path; |
11 | 11 |
12 import 'fuzz/server_manager.dart'; | 12 import 'fuzz/server_manager.dart'; |
13 | 13 |
14 /** | 14 /** |
15 * Start analysis server as a separate process and use the stdio to communicate | 15 * Start analysis server as a separate process and use the stdio to communicate |
16 * with the server. | 16 * with the server. |
17 */ | 17 */ |
18 void main(List<String> args) { | 18 void main(List<String> args) { |
19 new _FuzzTest().run(args); | 19 new _FuzzTest().run(args); |
20 } | 20 } |
21 | 21 |
22 /** | 22 /** |
23 * Instances of [_FuzzTest] launch and test an analysis server. | 23 * Instances of [_FuzzTest] launch and test an analysis server. |
24 * You must specify the location of the Dart SDK and the directory | 24 * You must specify the location of the Dart SDK and the directory |
25 * containing sources to be analyzed. | 25 * containing sources to be analyzed. |
26 */ | 26 */ |
27 class _FuzzTest { | 27 class _FuzzTest { |
| 28 /** |
| 29 * The name of the application that is used to start the fuzz tester. |
| 30 */ |
| 31 static const BINARY_NAME = 'fuzz'; |
28 | 32 |
29 //TODO (danrubel) extract common behavior for use in multiple test scenarios | 33 //TODO (danrubel) extract common behavior for use in multiple test scenarios |
30 //TODO (danrubel) cleanup test to use async/await for better readability | 34 //TODO (danrubel) cleanup test to use async/await for better readability |
31 // VM flag --enable_async | 35 // VM flag --enable_async |
32 | 36 |
33 static const String DART_SDK_OPTION = 'dart-sdk'; | 37 static const String DART_SDK_OPTION = 'dart-sdk'; |
34 static const String HELP_OPTION = 'help'; | 38 static const String HELP_OPTION = 'help'; |
35 | 39 |
36 File serverSnapshot; | 40 File serverSnapshot; |
37 Directory appDir; | 41 Directory appDir; |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 } | 155 } |
152 | 156 |
153 void _printAnalysisSummary(AnalysisResults results) { | 157 void _printAnalysisSummary(AnalysisResults results) { |
154 print( | 158 print( |
155 'Found ${results.errorCount} errors, ${results.warningCount} warnings,' | 159 'Found ${results.errorCount} errors, ${results.warningCount} warnings,' |
156 ' and ${results.hintCount} hints in $results.elapsed'); | 160 ' and ${results.hintCount} hints in $results.elapsed'); |
157 } | 161 } |
158 | 162 |
159 /// Print information about how to use the server. | 163 /// Print information about how to use the server. |
160 void _printUsage(ArgParser parser) { | 164 void _printUsage(ArgParser parser) { |
161 print('Usage: analyzer [flags] <application_directory>'); | 165 print('Usage: $BINARY_NAME [flags] <application_directory>'); |
162 print(''); | 166 print(''); |
163 print('Supported flags are:'); | 167 print('Supported flags are:'); |
164 print(parser.getUsage()); | 168 print(parser.usage); |
165 } | 169 } |
166 } | 170 } |
OLD | NEW |