Be clearer about errors in customer testing script (#36098)
This commit is contained in:
parent
bade97c405
commit
aa6cc07164
@ -47,7 +47,23 @@ Future<bool> run(List<String> arguments) async {
|
|||||||
help: 'Print this help message.',
|
help: 'Print this help message.',
|
||||||
);
|
);
|
||||||
|
|
||||||
final ArgResults parsedArguments = argParser.parse(arguments);
|
void printHelp() {
|
||||||
|
print('run_tests.dart [options...] path/to/file1.test path/to/file2.test...');
|
||||||
|
print('For details on the test registry format, see:');
|
||||||
|
print(' https://github.com/flutter/tests/blob/master/registry/template.test');
|
||||||
|
print('');
|
||||||
|
print(argParser.usage);
|
||||||
|
print('');
|
||||||
|
}
|
||||||
|
|
||||||
|
ArgResults parsedArguments;
|
||||||
|
try {
|
||||||
|
parsedArguments = argParser.parse(arguments);
|
||||||
|
} on ArgParserException catch (error) {
|
||||||
|
printHelp();
|
||||||
|
print('Error: ${error.message} Use --help for usage information.');
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
final int repeat = int.tryParse(parsedArguments['repeat']);
|
final int repeat = int.tryParse(parsedArguments['repeat']);
|
||||||
final bool skipOnFetchFailure = parsedArguments['skip-on-fetch-failure'];
|
final bool skipOnFetchFailure = parsedArguments['skip-on-fetch-failure'];
|
||||||
@ -62,12 +78,16 @@ Future<bool> run(List<String> arguments) async {
|
|||||||
.toList();
|
.toList();
|
||||||
|
|
||||||
if (help || repeat == null || files.isEmpty) {
|
if (help || repeat == null || files.isEmpty) {
|
||||||
print('run_tests.dart [options...] path/to/file1.test path/to/file2.test...');
|
printHelp();
|
||||||
print('For details on the test registry format, see:');
|
if (verbose) {
|
||||||
print(' https://github.com/flutter/tests/blob/master/registry/template.test');
|
if (repeat == null)
|
||||||
print('');
|
print('Error: Could not parse repeat count ("${parsedArguments['repeat']}")');
|
||||||
print(argParser.usage);
|
if (parsedArguments.rest.isEmpty) {
|
||||||
print('');
|
print('Error: No file arguments specified.');
|
||||||
|
} else if (files.isEmpty) {
|
||||||
|
print('Error: File arguments ("${parsedArguments.rest.join("\", \"")}") did not identify any real files.');
|
||||||
|
}
|
||||||
|
}
|
||||||
return help;
|
return help;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user