mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00
Migrate customer_testing to null safety (#80841)
This commit is contained in:
parent
78d931ea4f
commit
a84ac2ec2c
@ -15,7 +15,7 @@ Future<bool> runTests({
|
|||||||
bool verbose = false,
|
bool verbose = false,
|
||||||
int numberShards = 1,
|
int numberShards = 1,
|
||||||
int shardIndex = 0,
|
int shardIndex = 0,
|
||||||
List<File> files,
|
required List<File> files,
|
||||||
}) async {
|
}) async {
|
||||||
if (verbose)
|
if (verbose)
|
||||||
print('Starting run_tests.dart...');
|
print('Starting run_tests.dart...');
|
||||||
@ -66,7 +66,7 @@ Future<bool> runTests({
|
|||||||
if (verbose)
|
if (verbose)
|
||||||
print('Created temporary directory: ${checkout.path}');
|
print('Created temporary directory: ${checkout.path}');
|
||||||
try {
|
try {
|
||||||
bool success;
|
bool? success;
|
||||||
bool showContacts = false;
|
bool showContacts = false;
|
||||||
for (final String fetchCommand in instructions.fetch) {
|
for (final String fetchCommand in instructions.fetch) {
|
||||||
success = await shell(fetchCommand, checkout, verbose: verbose, silentFailure: skipOnFetchFailure);
|
success = await shell(fetchCommand, checkout, verbose: verbose, silentFailure: skipOnFetchFailure);
|
||||||
@ -86,7 +86,7 @@ Future<bool> runTests({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
assert(success != null);
|
assert(success != null);
|
||||||
if (success) {
|
if (success == true) {
|
||||||
if (verbose)
|
if (verbose)
|
||||||
print('Running tests...');
|
print('Running tests...');
|
||||||
final Directory tests = Directory(path.join(checkout.path, 'tests'));
|
final Directory tests = Directory(path.join(checkout.path, 'tests'));
|
||||||
@ -105,7 +105,7 @@ Future<bool> runTests({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (verbose && success)
|
if (verbose && success == true)
|
||||||
print('Tests finished.');
|
print('Tests finished.');
|
||||||
}
|
}
|
||||||
if (showContacts) {
|
if (showContacts) {
|
||||||
|
@ -2,7 +2,7 @@ name: customer_testing
|
|||||||
description: Tool to run the tests listed in the flutter/tests repository.
|
description: Tool to run the tests listed in the flutter/tests repository.
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: '>=2.9.0 <3.0.0'
|
sdk: '>=2.12.0 <3.0.0'
|
||||||
|
|
||||||
dependencies:
|
dependencies:
|
||||||
args: 2.0.0
|
args: 2.0.0
|
||||||
|
@ -78,13 +78,13 @@ Future<bool> run(List<String> arguments) async {
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
final int repeat = int.tryParse(parsedArguments['repeat'] as String);
|
final int? repeat = int.tryParse(parsedArguments['repeat'] as String);
|
||||||
final bool skipOnFetchFailure = parsedArguments['skip-on-fetch-failure'] as bool;
|
final bool skipOnFetchFailure = parsedArguments['skip-on-fetch-failure'] as bool;
|
||||||
final bool skipTemplate = parsedArguments['skip-template'] as bool;
|
final bool skipTemplate = parsedArguments['skip-template'] as bool;
|
||||||
final bool verbose = parsedArguments['verbose'] as bool;
|
final bool verbose = parsedArguments['verbose'] as bool;
|
||||||
final bool help = parsedArguments['help'] as bool;
|
final bool help = parsedArguments['help'] as bool;
|
||||||
final int numberShards = int.tryParse(parsedArguments['shards'] as String);
|
final int? numberShards = int.tryParse(parsedArguments['shards'] as String);
|
||||||
final int shardIndex = int.tryParse(parsedArguments['shard-index'] as String);
|
final int? shardIndex = int.tryParse(parsedArguments['shard-index'] as String);
|
||||||
final List<File> files = parsedArguments
|
final List<File> files = parsedArguments
|
||||||
.rest
|
.rest
|
||||||
.expand((String path) => Glob(path).listFileSystemSync(const LocalFileSystem()))
|
.expand((String path) => Glob(path).listFileSystemSync(const LocalFileSystem()))
|
||||||
@ -106,10 +106,10 @@ Future<bool> run(List<String> arguments) async {
|
|||||||
return help;
|
return help;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (files.length < shardIndex)
|
if (files.length < shardIndex!)
|
||||||
print('Warning: There are more shards than tests. Some shards will not run any tests.');
|
print('Warning: There are more shards than tests. Some shards will not run any tests.');
|
||||||
|
|
||||||
if (numberShards <= shardIndex) {
|
if (numberShards! <= shardIndex) {
|
||||||
print('Error: There are more shard indexes than shards.');
|
print('Error: There are more shard indexes than shards.');
|
||||||
return help;
|
return help;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user