Unverified Commit 7f235ea8 authored by Jonah Williams's avatar Jonah Williams Committed by GitHub

Mitigation for current tool test skips on CI (#46181)

parent ad20d368
...@@ -36,7 +36,9 @@ final String toolRoot = path.join(flutterRoot, 'packages', 'flutter_tools'); ...@@ -36,7 +36,9 @@ final String toolRoot = path.join(flutterRoot, 'packages', 'flutter_tools');
final List<String> flutterTestArgs = <String>[]; final List<String> flutterTestArgs = <String>[];
final bool useFlutterTestFormatter = Platform.environment['FLUTTER_TEST_FORMATTER'] == 'true'; final bool useFlutterTestFormatter = Platform.environment['FLUTTER_TEST_FORMATTER'] == 'true';
final bool canUseBuildRunner = Platform.environment['FLUTTER_TEST_NO_BUILD_RUNNER'] != 'true';
// This is disabled due to https://github.com/dart-lang/build/issues/2562
const bool canUseBuildRunner = false;
/// The number of Cirrus jobs that run host-only devicelab tests in parallel. /// The number of Cirrus jobs that run host-only devicelab tests in parallel.
/// ///
...@@ -260,9 +262,14 @@ Future<void> _runToolTests() async { ...@@ -260,9 +262,14 @@ Future<void> _runToolTests() async {
.map<String>((String name) => path.basenameWithoutExtension(name)), .map<String>((String name) => path.basenameWithoutExtension(name)),
// The `dynamic` on the next line is because Map.fromIterable isn't generic. // The `dynamic` on the next line is because Map.fromIterable isn't generic.
value: (dynamic subshard) => () async { value: (dynamic subshard) => () async {
// Due to https://github.com/flutter/flutter/issues/46180, skip the hermetic directory
// on Windows.
final String suffix = Platform.isWindows && subshard == 'commands'
? 'permeable'
: '';
await _pubRunTest( await _pubRunTest(
toolsPath, toolsPath,
testPath: path.join(kTest, '$subshard$kDotShard'), testPath: path.join(kTest, '$subshard$kDotShard', suffix),
useBuildRunner: canUseBuildRunner, useBuildRunner: canUseBuildRunner,
tableData: bigqueryApi?.tabledata, tableData: bigqueryApi?.tabledata,
enableFlutterToolAsserts: true, enableFlutterToolAsserts: true,
......
...@@ -15,6 +15,7 @@ import 'package:flutter_tools/src/cache.dart'; ...@@ -15,6 +15,7 @@ import 'package:flutter_tools/src/cache.dart';
import 'package:flutter_tools/src/commands/create.dart'; import 'package:flutter_tools/src/commands/create.dart';
import 'package:flutter_tools/src/dart/pub.dart'; import 'package:flutter_tools/src/dart/pub.dart';
import 'package:flutter_tools/src/dart/sdk.dart'; import 'package:flutter_tools/src/dart/sdk.dart';
import 'package:flutter_tools/src/features.dart';
import 'package:flutter_tools/src/project.dart'; import 'package:flutter_tools/src/project.dart';
import 'package:flutter_tools/src/version.dart'; import 'package:flutter_tools/src/version.dart';
...@@ -23,6 +24,7 @@ import 'package:process/process.dart'; ...@@ -23,6 +24,7 @@ import 'package:process/process.dart';
import '../../src/common.dart'; import '../../src/common.dart';
import '../../src/context.dart'; import '../../src/context.dart';
import '../../src/testbed.dart';
const String frameworkRevision = '12345678'; const String frameworkRevision = '12345678';
const String frameworkChannel = 'omega'; const String frameworkChannel = 'omega';
...@@ -404,7 +406,7 @@ void main() { ...@@ -404,7 +406,7 @@ void main() {
); );
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
Pub: () => const Pub(), Pub: () => const Pub(),
}); }, skip: true); // https://github.com/flutter/flutter/issues/46142
testUsingContext('module project with pub', () async { testUsingContext('module project with pub', () async {
return _createProject(projectDir, <String>[ return _createProject(projectDir, <String>[
...@@ -439,7 +441,7 @@ void main() { ...@@ -439,7 +441,7 @@ void main() {
]); ]);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
Pub: () => const Pub(), Pub: () => const Pub(),
}); }, skip: true); // https://github.com/flutter/flutter/issues/46142
testUsingContext('androidx is used by default in an app project', () async { testUsingContext('androidx is used by default in an app project', () async {
...@@ -568,9 +570,11 @@ void main() { ...@@ -568,9 +570,11 @@ void main() {
final CreateCommand command = CreateCommand(); final CreateCommand command = CreateCommand();
final CommandRunner<void> runner = createTestCommandRunner(command); final CommandRunner<void> runner = createTestCommandRunner(command);
await runner.run(<String>['create', '--no-pub', '--macos', projectDir.path]); await runner.run(<String>['create', '--no-pub', projectDir.path]);
expect(projectDir.childDirectory('macos').childDirectory('Runner.xcworkspace').existsSync(), true); expect(projectDir.childDirectory('macos').childDirectory('Runner.xcworkspace').existsSync(), true);
}, overrides: <Type, Generator>{
FeatureFlags: () => TestFeatureFlags(isMacOSEnabled: true),
}); });
testUsingContext('app does not include macOS by default', () async { testUsingContext('app does not include macOS by default', () async {
...@@ -584,6 +588,8 @@ void main() { ...@@ -584,6 +588,8 @@ void main() {
await runner.run(<String>['create', '--no-pub', projectDir.path]); await runner.run(<String>['create', '--no-pub', projectDir.path]);
expect(projectDir.childDirectory('macos').childDirectory('Runner.xcworkspace').existsSync(), false); expect(projectDir.childDirectory('macos').childDirectory('Runner.xcworkspace').existsSync(), false);
}, overrides: <Type, Generator>{
FeatureFlags: () => TestFeatureFlags(isMacOSEnabled: false),
}); });
testUsingContext('plugin supports macOS if requested', () async { testUsingContext('plugin supports macOS if requested', () async {
...@@ -594,9 +600,11 @@ void main() { ...@@ -594,9 +600,11 @@ void main() {
final CreateCommand command = CreateCommand(); final CreateCommand command = CreateCommand();
final CommandRunner<void> runner = createTestCommandRunner(command); final CommandRunner<void> runner = createTestCommandRunner(command);
await runner.run(<String>['create', '--no-pub', '--template=plugin', '--macos', projectDir.path]); await runner.run(<String>['create', '--no-pub', '--template=plugin', projectDir.path]);
expect(projectDir.childDirectory('macos').childFile('flutter_project.podspec').existsSync(), true); expect(projectDir.childDirectory('macos').childFile('flutter_project.podspec').existsSync(), true);
}, overrides: <Type, Generator>{
FeatureFlags: () => TestFeatureFlags(isMacOSEnabled: true),
}); });
testUsingContext('plugin does not include macOS by default', () async { testUsingContext('plugin does not include macOS by default', () async {
...@@ -610,6 +618,8 @@ void main() { ...@@ -610,6 +618,8 @@ void main() {
await runner.run(<String>['create', '--no-pub', '--template=plugin', projectDir.path]); await runner.run(<String>['create', '--no-pub', '--template=plugin', projectDir.path]);
expect(projectDir.childDirectory('macos').childFile('flutter_project.podspec').existsSync(), false); expect(projectDir.childDirectory('macos').childFile('flutter_project.podspec').existsSync(), false);
}, overrides: <Type, Generator>{
FeatureFlags: () => TestFeatureFlags(isMacOSEnabled: false),
}); });
testUsingContext('has correct content and formatting with module template', () async { testUsingContext('has correct content and formatting with module template', () async {
......
...@@ -31,7 +31,9 @@ void main() { ...@@ -31,7 +31,9 @@ void main() {
testUsingContext('report nice errors for exceptions thrown within testWidgets()', () async { testUsingContext('report nice errors for exceptions thrown within testWidgets()', () async {
Cache.flutterRoot = '../..'; Cache.flutterRoot = '../..';
return _testFile('exception_handling', automatedTestsDirectory, flutterTestDirectory); return _testFile('exception_handling', automatedTestsDirectory, flutterTestDirectory);
}, skip: io.Platform.isWindows); // TODO(chunhtai): Remove Skip https://github.com/flutter/flutter/issues/35425. }, skip: true); // https://github.com/flutter/flutter/issues/46142
// Note: was skip: skip: io.Platform.isWindows
// TODO(chunhtai): Remove Skip https://github.com/flutter/flutter/issues/35425.
testUsingContext('report a nice error when a guarded function was called without await', () async { testUsingContext('report a nice error when a guarded function was called without await', () async {
Cache.flutterRoot = '../..'; Cache.flutterRoot = '../..';
...@@ -75,7 +77,8 @@ void main() { ...@@ -75,7 +77,8 @@ void main() {
testUsingContext('can load assets within its own package', () async { testUsingContext('can load assets within its own package', () async {
Cache.flutterRoot = '../..'; Cache.flutterRoot = '../..';
return _testFile('package_assets', automatedTestsDirectory, flutterTestDirectory, exitCode: isZero); return _testFile('package_assets', automatedTestsDirectory, flutterTestDirectory, exitCode: isZero);
}, skip: io.Platform.isWindows); }, skip: true); // https://github.com/flutter/flutter/issues/46142
// Note, was skip: io.Platform.isWindows
testUsingContext('run a test when its name matches a regexp', () async { testUsingContext('run a test when its name matches a regexp', () async {
Cache.flutterRoot = '../..'; Cache.flutterRoot = '../..';
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'package:flutter_tools/runner.dart' as runner;
import 'package:flutter_tools/src/base/common.dart'; import 'package:flutter_tools/src/base/common.dart';
import 'package:flutter_tools/src/base/file_system.dart'; import 'package:flutter_tools/src/base/file_system.dart';
import 'package:flutter_tools/src/base/io.dart'; import 'package:flutter_tools/src/base/io.dart';
...@@ -10,6 +9,7 @@ import 'package:flutter_tools/src/base/platform.dart'; ...@@ -10,6 +9,7 @@ import 'package:flutter_tools/src/base/platform.dart';
import 'package:flutter_tools/src/base/os.dart'; import 'package:flutter_tools/src/base/os.dart';
import 'package:flutter_tools/src/cache.dart'; import 'package:flutter_tools/src/cache.dart';
import 'package:flutter_tools/src/commands/upgrade.dart'; import 'package:flutter_tools/src/commands/upgrade.dart';
import 'package:flutter_tools/src/convert.dart';
import 'package:flutter_tools/src/persistent_tool_state.dart'; import 'package:flutter_tools/src/persistent_tool_state.dart';
import 'package:flutter_tools/src/runner/flutter_command.dart'; import 'package:flutter_tools/src/runner/flutter_command.dart';
import 'package:flutter_tools/src/version.dart'; import 'package:flutter_tools/src/version.dart';
...@@ -214,12 +214,7 @@ void main() { ...@@ -214,12 +214,7 @@ void main() {
}); });
group('full command', () { group('full command', () {
final FakeProcessManager fakeProcessManager = FakeProcessManager.list(<FakeCommand>[ FakeProcessManager fakeProcessManager;
const FakeCommand(command: <String>[
'git', 'describe', '--match', 'v*.*.*', '--first-parent', '--long', '--tags',
]),
]);
Directory tempDir; Directory tempDir;
File flutterToolState; File flutterToolState;
...@@ -227,6 +222,14 @@ void main() { ...@@ -227,6 +222,14 @@ void main() {
setUp(() { setUp(() {
Cache.disableLocking(); Cache.disableLocking();
fakeProcessManager = FakeProcessManager.list(<FakeCommand>[
const FakeCommand(
command: <String>[
'git', 'describe', '--match', 'v*.*.*', '--first-parent', '--long', '--tags',
],
stdout: 'v1.12.16-19-gb45b676af',
),
]);
tempDir = fs.systemTempDirectory.createTempSync('flutter_upgrade_test.'); tempDir = fs.systemTempDirectory.createTempSync('flutter_upgrade_test.');
flutterToolState = tempDir.childFile('.flutter_tool_state'); flutterToolState = tempDir.childFile('.flutter_tool_state');
mockFlutterVersion = MockFlutterVersion(isStable: true); mockFlutterVersion = MockFlutterVersion(isStable: true);
...@@ -239,16 +242,17 @@ void main() { ...@@ -239,16 +242,17 @@ void main() {
testUsingContext('upgrade continue prints welcome message', () async { testUsingContext('upgrade continue prints welcome message', () async {
final UpgradeCommand upgradeCommand = UpgradeCommand(fakeCommandRunner); final UpgradeCommand upgradeCommand = UpgradeCommand(fakeCommandRunner);
await runner.run( applyMocksToCommand(upgradeCommand);
await createTestCommandRunner(upgradeCommand).run(
<String>[ <String>[
'upgrade', 'upgrade',
'--continue', '--continue',
], ],
<FlutterCommand>[
upgradeCommand,
],
); );
expect(testLogger.statusText, contains('Welcome to Flutter!'));
expect(json.decode(flutterToolState.readAsStringSync()),
containsPair('redisplay-welcome-message', true));
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FlutterVersion: () => mockFlutterVersion, FlutterVersion: () => mockFlutterVersion,
ProcessManager: () => fakeProcessManager, ProcessManager: () => fakeProcessManager,
......
...@@ -198,9 +198,9 @@ abstract class FakeProcessManager implements ProcessManager { ...@@ -198,9 +198,9 @@ abstract class FakeProcessManager implements ProcessManager {
fakeCommand.duration, fakeCommand.duration,
fakeCommand.onRun, fakeCommand.onRun,
_pid, _pid,
fakeCommand.stdout,
null, // stdin
fakeCommand.stderr, fakeCommand.stderr,
null, // stdin
fakeCommand.stdout,
); );
} }
......
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