Support platform-specific test lines (#43458)

This commit is contained in:
Ian Hickson 2019-10-28 15:51:22 -07:00 committed by GitHub
parent 4ac2daf337
commit 7de800c44a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -210,6 +210,18 @@ class TestFile {
update.add(Directory(line.substring(7))); update.add(Directory(line.substring(7)));
} else if (line.startsWith('test=')) { } else if (line.startsWith('test=')) {
test.add(line.substring(5)); test.add(line.substring(5));
} else if (line.startsWith('test.windows=')) {
if (Platform.isWindows)
test.add(line.substring(5));
} else if (line.startsWith('test.macos=')) {
if (Platform.isMacOS)
test.add(line.substring(5));
} else if (line.startsWith('test.linux=')) {
if (Platform.isLinux)
test.add(line.substring(5));
} else if (line.startsWith('test.posix=')) {
if (Platform.isLinux || Platform.isMacOS)
test.add(line.substring(5));
} else { } else {
throw FormatException('${errorPrefix}Unexpected directive:\n$line'); throw FormatException('${errorPrefix}Unexpected directive:\n$line');
} }
@ -231,7 +243,7 @@ class TestFile {
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 (test.isEmpty)
throw FormatException('${errorPrefix}No "test" directives specified. At least one command must be specified to run tests.'); 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.');
return TestFile._( return TestFile._(
List<String>.unmodifiable(contacts), List<String>.unmodifiable(contacts),
List<String>.unmodifiable(fetch), List<String>.unmodifiable(fetch),