Some minor cleanup for the customer_testing shard (#49501)
* Allow projects that don't have tests on every platform. We don't really need to enforce that random projects have tests on every platform. * Add some text at the end of the shard so we know it's actually running all the tests.
This commit is contained in:
parent
bee45a646f
commit
74a505b195
@ -94,6 +94,7 @@ Future<bool> run(List<String> arguments) async {
|
|||||||
if (verbose)
|
if (verbose)
|
||||||
print('Starting run_tests.dart...');
|
print('Starting run_tests.dart...');
|
||||||
|
|
||||||
|
int testCount = 0;
|
||||||
int failures = 0;
|
int failures = 0;
|
||||||
|
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
@ -154,6 +155,7 @@ Future<bool> run(List<String> arguments) async {
|
|||||||
if (verbose && repeat > 1)
|
if (verbose && repeat > 1)
|
||||||
print('Round ${iteration + 1} of $repeat.');
|
print('Round ${iteration + 1} of $repeat.');
|
||||||
for (final String testCommand in instructions.tests) {
|
for (final String testCommand in instructions.tests) {
|
||||||
|
testCount += 1;
|
||||||
success = await shell(testCommand, tests, verbose: verbose);
|
success = await shell(testCommand, tests, verbose: verbose);
|
||||||
if (!success) {
|
if (!success) {
|
||||||
print('ERROR: One or more tests from ${path.basenameWithoutExtension(file.path)} failed.');
|
print('ERROR: One or more tests from ${path.basenameWithoutExtension(file.path)} failed.');
|
||||||
@ -187,9 +189,7 @@ Future<bool> run(List<String> arguments) async {
|
|||||||
print('$failures failure$s.');
|
print('$failures failure$s.');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (verbose) {
|
print('$testCount tests all passed!');
|
||||||
print('All tests passed!');
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -201,6 +201,7 @@ class TestFile {
|
|||||||
final List<String> fetch = <String>[];
|
final List<String> fetch = <String>[];
|
||||||
final List<Directory> update = <Directory>[];
|
final List<Directory> update = <Directory>[];
|
||||||
final List<String> test = <String>[];
|
final List<String> test = <String>[];
|
||||||
|
bool hasTests = false;
|
||||||
for (final String line in file.readAsLinesSync().map((String line) => line.trim())) {
|
for (final String line in file.readAsLinesSync().map((String line) => line.trim())) {
|
||||||
if (line.isEmpty) {
|
if (line.isEmpty) {
|
||||||
// blank line
|
// blank line
|
||||||
@ -213,17 +214,22 @@ class TestFile {
|
|||||||
} else if (line.startsWith('update=')) {
|
} else if (line.startsWith('update=')) {
|
||||||
update.add(Directory(line.substring(7)));
|
update.add(Directory(line.substring(7)));
|
||||||
} else if (line.startsWith('test=')) {
|
} else if (line.startsWith('test=')) {
|
||||||
|
hasTests = true;
|
||||||
test.add(line.substring(5));
|
test.add(line.substring(5));
|
||||||
} else if (line.startsWith('test.windows=')) {
|
} else if (line.startsWith('test.windows=')) {
|
||||||
|
hasTests = true;
|
||||||
if (Platform.isWindows)
|
if (Platform.isWindows)
|
||||||
test.add(line.substring(13));
|
test.add(line.substring(13));
|
||||||
} else if (line.startsWith('test.macos=')) {
|
} else if (line.startsWith('test.macos=')) {
|
||||||
|
hasTests = true;
|
||||||
if (Platform.isMacOS)
|
if (Platform.isMacOS)
|
||||||
test.add(line.substring(11));
|
test.add(line.substring(11));
|
||||||
} else if (line.startsWith('test.linux=')) {
|
} else if (line.startsWith('test.linux=')) {
|
||||||
|
hasTests = true;
|
||||||
if (Platform.isLinux)
|
if (Platform.isLinux)
|
||||||
test.add(line.substring(11));
|
test.add(line.substring(11));
|
||||||
} else if (line.startsWith('test.posix=')) {
|
} else if (line.startsWith('test.posix=')) {
|
||||||
|
hasTests = true;
|
||||||
if (Platform.isLinux || Platform.isMacOS)
|
if (Platform.isLinux || Platform.isMacOS)
|
||||||
test.add(line.substring(11));
|
test.add(line.substring(11));
|
||||||
} else {
|
} else {
|
||||||
@ -246,8 +252,8 @@ class TestFile {
|
|||||||
throw FormatException('${errorPrefix}Second "fetch" directive does not match expected pattern (expected "git -C tests checkout HASH").');
|
throw FormatException('${errorPrefix}Second "fetch" directive does not match expected pattern (expected "git -C tests checkout HASH").');
|
||||||
if (update.isEmpty)
|
if (update.isEmpty)
|
||||||
throw FormatException('${errorPrefix}No "update" directives specified. At least one directory must be specified. (It can be "." to just upgrade the root of the repository.)');
|
throw FormatException('${errorPrefix}No "update" directives specified. At least one directory must be specified. (It can be "." to just upgrade the root of the repository.)');
|
||||||
if (test.isEmpty)
|
if (!hasTests)
|
||||||
throw FormatException('${errorPrefix}No "test" directives specified for this platform. At least one command must be specified to run tests on each of Windows, MacOS, and Linux.');
|
throw FormatException('${errorPrefix}No "test" directives specified. At least one command must be specified to run tests.');
|
||||||
return TestFile._(
|
return TestFile._(
|
||||||
List<String>.unmodifiable(contacts),
|
List<String>.unmodifiable(contacts),
|
||||||
List<String>.unmodifiable(fetch),
|
List<String>.unmodifiable(fetch),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user