From c353e641adadffc0c6c0686d5e62526051dbcf65 Mon Sep 17 00:00:00 2001 From: Christopher Fujino Date: Fri, 13 Oct 2023 12:48:43 -0600 Subject: [PATCH] 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. --- dev/bots/test.dart | 1 + dev/tools/test/create_api_docs_test.dart | 52 ++++++++++++++++++------ dev/tools/test/update_icons_test.dart | 2 +- 3 files changed, 42 insertions(+), 13 deletions(-) diff --git a/dev/bots/test.dart b/dev/bots/test.dart index 30618d6279..d624a853f5 100644 --- a/dev/bots/test.dart +++ b/dev/bots/test.dart @@ -994,6 +994,7 @@ Future _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')); diff --git a/dev/tools/test/create_api_docs_test.dart b/dev/tools/test/create_api_docs_test.dart index 6f98d1fae7..6d6b1e804d 100644 --- a/dev/tools/test/create_api_docs_test.dart +++ b/dev/tools/test/create_api_docs_test.dart @@ -44,6 +44,9 @@ void main() { command: ['flutter', '--version', '--machine'], stdout: testVersionInfo, )); + fakeProcessManager.addCommand(const FakeCommand( + command: ['git', 'rev-parse', 'HEAD'], + )); expect( apidocs.FlutterInformation.instance.getBranchName(), branchName, @@ -60,6 +63,9 @@ void main() { command: ['git', 'status', '-b', '--porcelain'], stdout: '## $branchName', )); + fakeProcessManager.addCommand(const FakeCommand( + command: ['git', 'rev-parse', 'HEAD'], + )); expect( apidocs.FlutterInformation.instance.getBranchName(), @@ -82,6 +88,9 @@ void main() { command: ['git', 'status', '-b', '--porcelain'], stdout: '## $branchName', )); + fakeProcessManager.addCommand(const FakeCommand( + command: ['git', 'rev-parse', 'HEAD'], + )); expect( apidocs.FlutterInformation.instance.getBranchName(), @@ -124,6 +133,9 @@ void main() { command: ['git', 'status', '-b', '--porcelain'], stdout: '## $branchName', )); + fakeProcessManager.addCommand(const FakeCommand( + command: ['git', 'rev-parse', 'HEAD'], + )); final Map info = flutterInformation.getFlutterInformation(); expect(fakeProcessManager, hasNoRemainingExpectations); expect(info['frameworkVersion'], equals(Version.parse('2.5.0'))); @@ -136,6 +148,9 @@ void main() { command: ['git', 'status', '-b', '--porcelain'], stdout: '## $branchName', )); + fakeProcessManager.addCommand(const FakeCommand( + command: ['git', 'rev-parse', 'HEAD'], + )); final Map info = flutterInformation.getFlutterInformation(); expect(fakeProcessManager, hasNoRemainingExpectations); expect(info['frameworkVersion'], equals(Version.parse('2.5.0'))); @@ -149,6 +164,9 @@ void main() { command: ['git', 'status', '-b', '--porcelain'], stdout: '## $branchName', )); + fakeProcessManager.addCommand(const FakeCommand( + command: ['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: ['git', 'status', '-b', '--porcelain'], - stdout: '## $branchName', - )); + fakeProcessManager.addCommands([ + const FakeCommand( + command: ['git', 'status', '-b', '--porcelain'], + stdout: '## $branchName', + ), + const FakeCommand( + command: ['git', 'rev-parse', 'HEAD'], + ), + ]); final Map 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({'FLUTTER_ROOT': '/home/user/flutter'}); - fakeProcessManager.addCommand(const FakeCommand( - command: ['/home/user/flutter/bin/flutter', '--version', '--machine'], - stdout: testVersionInfo, - )); - fakeProcessManager.addCommand(const FakeCommand( - command: ['git', 'status', '-b', '--porcelain'], - stdout: '## $branchName', - )); + fakeProcessManager.addCommands([ + const FakeCommand( + command: ['/home/user/flutter/bin/flutter', '--version', '--machine'], + stdout: testVersionInfo, + ), + const FakeCommand( + command: ['git', 'status', '-b', '--porcelain'], + stdout: '## $branchName', + ), + const FakeCommand( + command: ['git', 'rev-parse', 'HEAD'], + ), + ]); final Map info = flutterInformation.getFlutterInformation(); expect(fakeProcessManager, hasNoRemainingExpectations); expect(info['engineRealm'], equals('realm')); diff --git a/dev/tools/test/update_icons_test.dart b/dev/tools/test/update_icons_test.dart index 6b1fbe4362..3d361d9fc6 100644 --- a/dev/tools/test/update_icons_test.dart +++ b/dev/tools/test/update_icons_test.dart @@ -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', () {