Skip to content

Commit bc0ec85

Browse files
authored
Only run test harness tests once instead of every shard (#101218)
1 parent 23b9d4f commit bc0ec85

File tree

2 files changed

+12
-18
lines changed

2 files changed

+12
-18
lines changed

dev/bots/test.dart

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ const Map<String, List<String>> kWebTestFileKnownFailures = <String, List<String
137137
],
138138
};
139139

140-
const String kSmokeTestShardName = 'smoke_tests';
140+
const String kTestHarnessShardName = 'test_harness_tests';
141141
const List<String> _kAllBuildModes = <String>['debug', 'profile', 'release'];
142142

143143
// The seed used to shuffle tests. If not passed with
@@ -171,7 +171,6 @@ Future<void> main(List<String> args) async {
171171
try {
172172
flutterTestArgs.addAll(args);
173173
final Set<String> removeArgs = <String>{};
174-
bool runSmokeTests = true;
175174
for (final String arg in args) {
176175
if (arg.startsWith('--local-engine=')) {
177176
localEngineEnv['FLUTTER_LOCAL_ENGINE'] = arg.substring('--local-engine='.length);
@@ -184,18 +183,14 @@ Future<void> main(List<String> args) async {
184183
removeArgs.add(arg);
185184
}
186185
if (arg == '--no-smoke-tests') {
187-
runSmokeTests = false;
186+
// This flag is deprecated, ignore it.
188187
removeArgs.add(arg);
189188
}
190189
}
191190
flutterTestArgs.removeWhere((String arg) => removeArgs.contains(arg));
192191
if (Platform.environment.containsKey(CIRRUS_TASK_NAME))
193192
print('Running task: ${Platform.environment[CIRRUS_TASK_NAME]}');
194193
print('═' * 80);
195-
if (runSmokeTests) {
196-
await _runSmokeTests();
197-
}
198-
print('═' * 80);
199194
await selectShard(<String, ShardRunner>{
200195
'add_to_app_life_cycle_tests': _runAddToAppLifeCycleTests,
201196
'build_tests': _runBuildTests,
@@ -213,7 +208,7 @@ Future<void> main(List<String> args) async {
213208
'web_long_running_tests': _runWebLongRunningTests,
214209
'flutter_plugins': _runFlutterPluginsTests,
215210
'skp_generator': _runSkpGeneratorTests,
216-
kSmokeTestShardName: () async {}, // No-op, the smoke tests already ran. Used for testing this script.
211+
kTestHarnessShardName: _runTestHarnessTests, // Used for testing this script.
217212
});
218213
} on ExitException catch (error) {
219214
error.apply();
@@ -248,16 +243,16 @@ Future<void> _validateEngineHash() async {
248243
}
249244
}
250245

251-
Future<void> _runSmokeTests() async {
252-
print('${green}Running smoketests...$reset');
246+
Future<void> _runTestHarnessTests() async {
247+
print('${green}Running test harness tests...$reset');
253248

254249
await _validateEngineHash();
255250

256251
// Verify that the tests actually return failure on failure and success on
257252
// success.
258253
final String automatedTests = path.join(flutterRoot, 'dev', 'automated_tests');
259254

260-
// We want to run the smoketests in parallel, because they each take some time
255+
// We want to run these tests in parallel, because they each take some time
261256
// to run (e.g. compiling), so we don't want to run them in series, especially
262257
// on 20-core machines. However, we have a race condition, so for now...
263258
// Race condition issue: https://github.com/flutter/flutter/issues/90026
@@ -319,11 +314,9 @@ Future<void> _runSmokeTests() async {
319314

320315
List<ShardRunner> testsToRun;
321316

322-
// Smoke tests are special and run first for all test shards.
323-
// Run all smoke tests for other shards.
324-
// Only shard smoke tests when explicitly specified.
317+
// Run all tests unless sharding is explicitly specified.
325318
final String? shardName = Platform.environment[kShardKey];
326-
if (shardName == kSmokeTestShardName) {
319+
if (shardName == kTestHarnessShardName) {
327320
testsToRun = _selectIndexOfTotalSubshard<ShardRunner>(tests);
328321
} else {
329322
testsToRun = tests;
@@ -871,6 +864,7 @@ Future<void> _runFrameworkTests() async {
871864

872865
Future<void> runMisc() async {
873866
print('${green}Running package tests$reset for directories other than packages/flutter');
867+
await _runTestHarnessTests();
874868
await runExampleTests();
875869
await _dartRunTest(path.join(flutterRoot, 'dev', 'bots'));
876870
await _dartRunTest(path.join(flutterRoot, 'dev', 'devicelab'), ensurePrecompiledTool: false); // See https://github.com/flutter/flutter/issues/86209

dev/bots/test/test_test.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,21 +112,21 @@ void main() {
112112
// When updating this test, try to pick shard numbers that ensure we're checking
113113
// that unequal test distributions don't miss tests.
114114
ProcessResult result = await runScript(
115-
<String, String>{'SHARD': 'smoke_tests', 'SUBSHARD': '1_3'},
115+
<String, String>{'SHARD': 'test_harness_tests', 'SUBSHARD': '1_3'},
116116
);
117117
expectExitCode(result, 0);
118118
expect(result.stdout, contains('Selecting subshard 1 of 3 (range 1-3 of 8)'));
119119

120120
result = await runScript(
121-
<String, String>{'SHARD': 'smoke_tests', 'SUBSHARD': '3_3'},
121+
<String, String>{'SHARD': 'test_harness_tests', 'SUBSHARD': '3_3'},
122122
);
123123
expectExitCode(result, 0);
124124
expect(result.stdout, contains('Selecting subshard 3 of 3 (range 7-8 of 8)'));
125125
});
126126

127127
test('exits with code 1 when SUBSHARD index greater than total', () async {
128128
final ProcessResult result = await runScript(
129-
<String, String>{'SHARD': 'smoke_tests', 'SUBSHARD': '100_99'},
129+
<String, String>{'SHARD': 'test_harness_tests', 'SUBSHARD': '100_99'},
130130
);
131131
expectExitCode(result, 1);
132132
expect(result.stdout, contains('Invalid subshard name'));

0 commit comments

Comments
 (0)