run tests under dev/tools as part of framework-misc and get them passing (#136501)

part of https://github.com/flutter/flutter/issues/136500

this should not affect any production code, it merely runs the tests on CI and makes the changes needed to get them passing.
This commit is contained in:
Christopher Fujino 2023-10-13 12:48:43 -06:00 committed by GitHub
parent 7d3b7d147e
commit c353e641ad
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 42 additions and 13 deletions

View file

@ -994,6 +994,7 @@ Future<void> _runFrameworkTests() async {
await _runFlutterTest(path.join(flutterRoot, 'dev', 'integration_tests', 'android_semantics_testing'), fatalWarnings: false);
await _runFlutterTest(path.join(flutterRoot, 'dev', 'integration_tests', 'ui'));
await _runFlutterTest(path.join(flutterRoot, 'dev', 'manual_tests'));
await _runFlutterTest(path.join(flutterRoot, 'dev', 'tools'));
await _runFlutterTest(path.join(flutterRoot, 'dev', 'tools', 'vitool'));
await _runFlutterTest(path.join(flutterRoot, 'dev', 'tools', 'gen_defaults'));
await _runFlutterTest(path.join(flutterRoot, 'dev', 'tools', 'gen_keycodes'));

View file

@ -44,6 +44,9 @@ void main() {
command: <Pattern>['flutter', '--version', '--machine'],
stdout: testVersionInfo,
));
fakeProcessManager.addCommand(const FakeCommand(
command: <Pattern>['git', 'rev-parse', 'HEAD'],
));
expect(
apidocs.FlutterInformation.instance.getBranchName(),
branchName,
@ -60,6 +63,9 @@ void main() {
command: <Pattern>['git', 'status', '-b', '--porcelain'],
stdout: '## $branchName',
));
fakeProcessManager.addCommand(const FakeCommand(
command: <Pattern>['git', 'rev-parse', 'HEAD'],
));
expect(
apidocs.FlutterInformation.instance.getBranchName(),
@ -82,6 +88,9 @@ void main() {
command: <Pattern>['git', 'status', '-b', '--porcelain'],
stdout: '## $branchName',
));
fakeProcessManager.addCommand(const FakeCommand(
command: <Pattern>['git', 'rev-parse', 'HEAD'],
));
expect(
apidocs.FlutterInformation.instance.getBranchName(),
@ -124,6 +133,9 @@ void main() {
command: <Pattern>['git', 'status', '-b', '--porcelain'],
stdout: '## $branchName',
));
fakeProcessManager.addCommand(const FakeCommand(
command: <Pattern>['git', 'rev-parse', 'HEAD'],
));
final Map<String, dynamic> info = flutterInformation.getFlutterInformation();
expect(fakeProcessManager, hasNoRemainingExpectations);
expect(info['frameworkVersion'], equals(Version.parse('2.5.0')));
@ -136,6 +148,9 @@ void main() {
command: <Pattern>['git', 'status', '-b', '--porcelain'],
stdout: '## $branchName',
));
fakeProcessManager.addCommand(const FakeCommand(
command: <Pattern>['git', 'rev-parse', 'HEAD'],
));
final Map<String, dynamic> info = flutterInformation.getFlutterInformation();
expect(fakeProcessManager, hasNoRemainingExpectations);
expect(info['frameworkVersion'], equals(Version.parse('2.5.0')));
@ -149,6 +164,9 @@ void main() {
command: <Pattern>['git', 'status', '-b', '--porcelain'],
stdout: '## $branchName',
));
fakeProcessManager.addCommand(const FakeCommand(
command: <Pattern>['git', 'rev-parse', 'HEAD'],
));
final Directory root = flutterInformation.getFlutterRoot();
expect(fakeProcessManager, hasNoRemainingExpectations);
expect(root.path, equals('/home/user/flutter'));
@ -161,10 +179,15 @@ void main() {
});
test('parses version properly', () async {
fakePlatform.environment['FLUTTER_VERSION'] = testVersionInfo;
fakeProcessManager.addCommand(const FakeCommand(
command: <Pattern>['git', 'status', '-b', '--porcelain'],
stdout: '## $branchName',
));
fakeProcessManager.addCommands(<FakeCommand>[
const FakeCommand(
command: <Pattern>['git', 'status', '-b', '--porcelain'],
stdout: '## $branchName',
),
const FakeCommand(
command: <String>['git', 'rev-parse', 'HEAD'],
),
]);
final Map<String, dynamic> info = flutterInformation.getFlutterInformation();
expect(info['frameworkVersion'], isNotNull);
expect(info['frameworkVersion'], equals(Version.parse('2.5.0')));
@ -182,14 +205,19 @@ void main() {
..createSync(recursive: true)
..writeAsStringSync('realm');
setUpWithEnvironment(<String, String>{'FLUTTER_ROOT': '/home/user/flutter'});
fakeProcessManager.addCommand(const FakeCommand(
command: <Pattern>['/home/user/flutter/bin/flutter', '--version', '--machine'],
stdout: testVersionInfo,
));
fakeProcessManager.addCommand(const FakeCommand(
command: <Pattern>['git', 'status', '-b', '--porcelain'],
stdout: '## $branchName',
));
fakeProcessManager.addCommands(<FakeCommand>[
const FakeCommand(
command: <Pattern>['/home/user/flutter/bin/flutter', '--version', '--machine'],
stdout: testVersionInfo,
),
const FakeCommand(
command: <Pattern>['git', 'status', '-b', '--porcelain'],
stdout: '## $branchName',
),
const FakeCommand(
command: <String>['git', 'rev-parse', 'HEAD'],
),
]);
final Map<String, dynamic> info = flutterInformation.getFlutterInformation();
expect(fakeProcessManager, hasNoRemainingExpectations);
expect(info['engineRealm'], equals('realm'));

View file

@ -41,7 +41,7 @@ void main() {
});
test('no double underscores', () {
expect(Icon(codepointsUnderscore.entries.first), 'abc_123');
expect(Icon(codepointsUnderscore.entries.first).usage, 'Icon(Icons.airplane_123),');
});
test('usage string is correct', () {