Unverified Commit a84ac2ec authored by Abhishek Ghaskata's avatar Abhishek Ghaskata Committed by GitHub

Migrate customer_testing to null safety (#80841)

parent 78d931ea
......@@ -15,7 +15,7 @@ Future<bool> runTests({
bool verbose = false,
int numberShards = 1,
int shardIndex = 0,
List<File> files,
required List<File> files,
}) async {
if (verbose)
print('Starting run_tests.dart...');
......@@ -66,7 +66,7 @@ Future<bool> runTests({
if (verbose)
print('Created temporary directory: ${checkout.path}');
try {
bool success;
bool? success;
bool showContacts = false;
for (final String fetchCommand in instructions.fetch) {
success = await shell(fetchCommand, checkout, verbose: verbose, silentFailure: skipOnFetchFailure);
......@@ -86,7 +86,7 @@ Future<bool> runTests({
}
}
assert(success != null);
if (success) {
if (success == true) {
if (verbose)
print('Running 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.');
}
if (showContacts) {
......
......@@ -2,7 +2,7 @@ name: customer_testing
description: Tool to run the tests listed in the flutter/tests repository.
environment:
sdk: '>=2.9.0 <3.0.0'
sdk: '>=2.12.0 <3.0.0'
dependencies:
args: 2.0.0
......
......@@ -78,13 +78,13 @@ Future<bool> run(List<String> arguments) async {
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 skipTemplate = parsedArguments['skip-template'] as bool;
final bool verbose = parsedArguments['verbose'] as bool;
final bool help = parsedArguments['help'] as bool;
final int numberShards = int.tryParse(parsedArguments['shards'] as String);
final int shardIndex = int.tryParse(parsedArguments['shard-index'] as String);
final int? numberShards = int.tryParse(parsedArguments['shards'] as String);
final int? shardIndex = int.tryParse(parsedArguments['shard-index'] as String);
final List<File> files = parsedArguments
.rest
.expand((String path) => Glob(path).listFileSystemSync(const LocalFileSystem()))
......@@ -106,10 +106,10 @@ Future<bool> run(List<String> arguments) async {
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.');
if (numberShards <= shardIndex) {
if (numberShards! <= shardIndex) {
print('Error: There are more shard indexes than shards.');
return help;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment