forked from flutter/packages
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathrun_tests.dart
More file actions
105 lines (96 loc) · 3.48 KB
/
run_tests.dart
File metadata and controls
105 lines (96 loc) · 3.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// ignore_for_file: avoid_print
////////////////////////////////////////////////////////////////////////////////
/// CI entrypoint for running Pigeon tests.
///
/// For any use other than CI, use test.dart instead.
////////////////////////////////////////////////////////////////////////////////
import 'dart:io' show Platform, exit;
import 'shared/test_runner.dart';
import 'shared/test_suites.dart';
/// Exits with failure if any tests in [testSuites] are not included in any of
/// the given test [shards].
void _validateTestCoverage(List<List<String>> shards) {
final Set<String> missing = testSuites.keys.toSet();
shards.forEach(missing.removeAll);
if (missing.isNotEmpty) {
print('The following test suites are not being run on any host:');
for (final String suite in missing) {
print(' $suite');
}
exit(1);
}
}
Future<void> main(List<String> args) async {
// Run most tests on Linux, since Linux tends to be the easiest and cheapest.
const List<String> linuxHostTests = <String>[
dartUnitTests,
flutterUnitTests,
mockHandlerTests,
commandLineTests,
androidJavaUnitTests,
androidKotlinUnitTests,
// TODO(stuartmorgan): Include these once CI supports running simulator
// tests. Currently these tests aren't run in CI.
// See https://github.com/flutter/flutter/issues/111505.
// androidJavaIntegrationTests,
// androidKotlinIntegrationTests,
];
// Run macOS and iOS tests on macOS, since that's the only place they can run.
// TODO(stuartmorgan): Move everything to LUCI, and eliminate the LUCI/Cirrus
// separation. See https://github.com/flutter/flutter/issues/120231.
const List<String> macOSHostLuciTests = <String>[
iOSObjCUnitTests,
// TODO(stuartmorgan): Enable by default once CI issues are solved; see
// https://github.com/flutter/packages/pull/2816.
//iOSObjCIntegrationTests,
// Currently these are testing exactly the same thing as
// macOSSwiftIntegrationTests, so we don't need to run both by default. This
// should be enabled if any iOS-only tests are added (e.g., for a feature
// not supported by macOS).
// iOSSwiftIntegrationTests,
];
const List<String> macOSHostCirrusTests = <String>[
iOSSwiftUnitTests,
macOSSwiftUnitTests,
macOSSwiftIntegrationTests,
];
// Run Windows tests on Windows, since that's the only place they can run.
const List<String> windowsHostTests = <String>[
windowsUnitTests,
windowsIntegrationTests,
];
_validateTestCoverage(<List<String>>[
linuxHostTests,
macOSHostLuciTests,
macOSHostCirrusTests,
windowsHostTests,
// Tests that are deliberately not included in CI:
<String>[
// See comment in linuxHostTests:
androidJavaIntegrationTests,
androidKotlinIntegrationTests,
// See comments in macOSHostTests:
iOSObjCIntegrationTests,
iOSSwiftIntegrationTests,
],
]);
final List<String> testsToRun;
if (Platform.isMacOS) {
if (Platform.environment['LUCI_CI'] != null) {
testsToRun = macOSHostLuciTests;
} else {
testsToRun = macOSHostCirrusTests;
}
} else if (Platform.isWindows) {
testsToRun = windowsHostTests;
} else if (Platform.isLinux) {
testsToRun = linuxHostTests;
} else {
print('Unsupported host platform.');
exit(2);
}
await runTests(testsToRun);
}