mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00
rename two unit tests that were not actually being run on CI (#98299)
This commit is contained in:
parent
1ae5dd194c
commit
87fe3fe031
@ -88,6 +88,9 @@ Future<void> run(List<String> arguments) async {
|
|||||||
exitWithError(<String>['The analyze.dart script must be run with --enable-asserts.']);
|
exitWithError(<String>['The analyze.dart script must be run with --enable-asserts.']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
print('$clock All tool test files end in _test.dart...');
|
||||||
|
await verifyToolTestsEndInTestDart(flutterRoot);
|
||||||
|
|
||||||
print('$clock No sync*/async*');
|
print('$clock No sync*/async*');
|
||||||
await verifyNoSyncAsyncStar(flutterPackages);
|
await verifyNoSyncAsyncStar(flutterPackages);
|
||||||
await verifyNoSyncAsyncStar(flutterExamples, minimumMatches: 200);
|
await verifyNoSyncAsyncStar(flutterExamples, minimumMatches: 200);
|
||||||
@ -197,6 +200,53 @@ Future<void> run(List<String> arguments) async {
|
|||||||
|
|
||||||
// TESTS
|
// TESTS
|
||||||
|
|
||||||
|
/// Verify tool test files end in `_test.dart`.
|
||||||
|
///
|
||||||
|
/// The test runner will only recognize files ending in `_test.dart` as tests to
|
||||||
|
/// be run: https://github.com/dart-lang/test/tree/master/pkgs/test#running-tests
|
||||||
|
Future<void> verifyToolTestsEndInTestDart(String workingDirectory) async {
|
||||||
|
final String toolsTestPath = path.join(
|
||||||
|
workingDirectory,
|
||||||
|
'packages',
|
||||||
|
'flutter_tools',
|
||||||
|
'test',
|
||||||
|
);
|
||||||
|
final List<String> violations = <String>[];
|
||||||
|
|
||||||
|
// detect files that contains calls to test(), testUsingContext(), and testWithoutContext()
|
||||||
|
final RegExp callsTestFunctionPattern = RegExp(r'(test\(.*\)|testUsingContext\(.*\)|testWithoutContext\(.*\))');
|
||||||
|
|
||||||
|
await for (final File file in _allFiles(toolsTestPath, 'dart', minimumMatches: 300)) {
|
||||||
|
final bool isValidTestFile = file.path.endsWith('_test.dart');
|
||||||
|
if (isValidTestFile) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
final bool isTestData = file.path.contains(r'test_data');
|
||||||
|
if (isTestData) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
final bool isInTestShard = file.path.contains(r'.shard/');
|
||||||
|
if (!isInTestShard) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
final bool callsTestFunction = file.readAsStringSync().contains(callsTestFunctionPattern);
|
||||||
|
if (!callsTestFunction) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
violations.add(file.path);
|
||||||
|
}
|
||||||
|
if (violations.isNotEmpty) {
|
||||||
|
exitWithError(<String>[
|
||||||
|
'${bold}Found flutter_tools tests that do not end in `_test.dart`; these will not be run by the test runner$reset',
|
||||||
|
...violations,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Future<void> verifyNoSyncAsyncStar(String workingDirectory, {int minimumMatches = 2000 }) async {
|
Future<void> verifyNoSyncAsyncStar(String workingDirectory, {int minimumMatches = 2000 }) async {
|
||||||
final RegExp syncPattern = RegExp(r'\s*?a?sync\*\s*?{');
|
final RegExp syncPattern = RegExp(r'\s*?a?sync\*\s*?{');
|
||||||
final RegExp ignorePattern = RegExp(r'^\s*?// The following uses a?sync\* because:? ');
|
final RegExp ignorePattern = RegExp(r'^\s*?// The following uses a?sync\* because:? ');
|
||||||
|
@ -503,440 +503,6 @@ void main() {
|
|||||||
);
|
);
|
||||||
|
|
||||||
// test add command
|
// test add command
|
||||||
testUsingContext(
|
|
||||||
'custom-devices add command correctly adds ssh device config on linux',
|
|
||||||
() async {
|
|
||||||
final MemoryFileSystem fs = MemoryFileSystem.test();
|
|
||||||
|
|
||||||
final CommandRunner<void> runner = createCustomDevicesCommandRunner(
|
|
||||||
terminal: (Platform platform) => createFakeTerminalForAddingSshDevice(
|
|
||||||
platform: platform,
|
|
||||||
id: 'testid',
|
|
||||||
label: 'testlabel',
|
|
||||||
sdkNameAndVersion: 'testsdknameandversion',
|
|
||||||
enabled: 'y',
|
|
||||||
hostname: 'testhostname',
|
|
||||||
username: 'testuser',
|
|
||||||
runDebug: 'testrundebug',
|
|
||||||
usePortForwarding: 'y',
|
|
||||||
screenshot: 'testscreenshot',
|
|
||||||
apply: 'y'
|
|
||||||
),
|
|
||||||
fileSystem: fs,
|
|
||||||
processManager: FakeProcessManager.any(),
|
|
||||||
featureEnabled: true
|
|
||||||
);
|
|
||||||
|
|
||||||
await expectLater(
|
|
||||||
runner.run(const <String>['custom-devices', 'add', '--no-check']),
|
|
||||||
completes
|
|
||||||
);
|
|
||||||
|
|
||||||
final CustomDevicesConfig config = CustomDevicesConfig.test(
|
|
||||||
fileSystem: fs,
|
|
||||||
directory: fs.directory('/'),
|
|
||||||
logger: BufferLogger.test()
|
|
||||||
);
|
|
||||||
|
|
||||||
expect(
|
|
||||||
config.devices,
|
|
||||||
contains(
|
|
||||||
CustomDeviceConfig(
|
|
||||||
id: 'testid',
|
|
||||||
label: 'testlabel',
|
|
||||||
sdkNameAndVersion: 'testsdknameandversion',
|
|
||||||
enabled: true,
|
|
||||||
pingCommand: const <String>[
|
|
||||||
'ping',
|
|
||||||
'-c', '1',
|
|
||||||
'-w', '1',
|
|
||||||
'testhostname'
|
|
||||||
],
|
|
||||||
postBuildCommand: const <String>[],
|
|
||||||
installCommand: const <String>[
|
|
||||||
'scp',
|
|
||||||
'-r',
|
|
||||||
'-o', 'BatchMode=yes',
|
|
||||||
r'${localPath}',
|
|
||||||
r'testuser@testhostname:/tmp/${appName}'
|
|
||||||
],
|
|
||||||
uninstallCommand: const <String>[
|
|
||||||
'ssh',
|
|
||||||
'-o', 'BatchMode=yes',
|
|
||||||
'testuser@testhostname',
|
|
||||||
r'rm -rf "/tmp/${appName}"'
|
|
||||||
],
|
|
||||||
runDebugCommand: const <String>[
|
|
||||||
'ssh',
|
|
||||||
'-o', 'BatchMode=yes',
|
|
||||||
'testuser@testhostname',
|
|
||||||
'testrundebug'
|
|
||||||
],
|
|
||||||
forwardPortCommand: const <String>[
|
|
||||||
'ssh',
|
|
||||||
'-o', 'BatchMode=yes',
|
|
||||||
'-o', 'ExitOnForwardFailure=yes',
|
|
||||||
'-L', r'127.0.0.1:${hostPort}:127.0.0.1:${devicePort}',
|
|
||||||
'testuser@testhostname'
|
|
||||||
],
|
|
||||||
forwardPortSuccessRegex: RegExp('Linux'),
|
|
||||||
screenshotCommand: const <String>[
|
|
||||||
'ssh',
|
|
||||||
'-o', 'BatchMode=yes',
|
|
||||||
'testuser@testhostname',
|
|
||||||
'testscreenshot'
|
|
||||||
],
|
|
||||||
)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
testUsingContext(
|
|
||||||
'custom-devices add command correctly adds ipv4 ssh device config',
|
|
||||||
() async {
|
|
||||||
final MemoryFileSystem fs = MemoryFileSystem.test();
|
|
||||||
|
|
||||||
final CommandRunner<void> runner = createCustomDevicesCommandRunner(
|
|
||||||
terminal: (Platform platform) => createFakeTerminalForAddingSshDevice(
|
|
||||||
platform: platform,
|
|
||||||
id: 'testid',
|
|
||||||
label: 'testlabel',
|
|
||||||
sdkNameAndVersion: 'testsdknameandversion',
|
|
||||||
enabled: 'y',
|
|
||||||
hostname: '192.168.178.1',
|
|
||||||
username: 'testuser',
|
|
||||||
runDebug: 'testrundebug',
|
|
||||||
usePortForwarding: 'y',
|
|
||||||
screenshot: 'testscreenshot',
|
|
||||||
apply: 'y',
|
|
||||||
),
|
|
||||||
processManager: FakeProcessManager.any(),
|
|
||||||
fileSystem: fs,
|
|
||||||
featureEnabled: true
|
|
||||||
);
|
|
||||||
|
|
||||||
await expectLater(
|
|
||||||
runner.run(const <String>['custom-devices', 'add', '--no-check']),
|
|
||||||
completes
|
|
||||||
);
|
|
||||||
|
|
||||||
final CustomDevicesConfig config = CustomDevicesConfig.test(
|
|
||||||
fileSystem: fs,
|
|
||||||
directory: fs.directory('/'),
|
|
||||||
logger: BufferLogger.test()
|
|
||||||
);
|
|
||||||
|
|
||||||
expect(
|
|
||||||
config.devices,
|
|
||||||
contains(
|
|
||||||
CustomDeviceConfig(
|
|
||||||
id: 'testid',
|
|
||||||
label: 'testlabel',
|
|
||||||
sdkNameAndVersion: 'testsdknameandversion',
|
|
||||||
enabled: true,
|
|
||||||
pingCommand: const <String>[
|
|
||||||
'ping',
|
|
||||||
'-c', '1',
|
|
||||||
'-w', '1',
|
|
||||||
'192.168.178.1'
|
|
||||||
],
|
|
||||||
postBuildCommand: const <String>[],
|
|
||||||
installCommand: const <String>[
|
|
||||||
'scp',
|
|
||||||
'-r',
|
|
||||||
'-o', 'BatchMode=yes',
|
|
||||||
r'${localPath}',
|
|
||||||
r'testuser@192.168.178.1:/tmp/${appName}'
|
|
||||||
],
|
|
||||||
uninstallCommand: const <String>[
|
|
||||||
'ssh',
|
|
||||||
'-o', 'BatchMode=yes',
|
|
||||||
'testuser@192.168.178.1',
|
|
||||||
r'rm -rf "/tmp/${appName}"'
|
|
||||||
],
|
|
||||||
runDebugCommand: const <String>[
|
|
||||||
'ssh',
|
|
||||||
'-o', 'BatchMode=yes',
|
|
||||||
'testuser@192.168.178.1',
|
|
||||||
'testrundebug'
|
|
||||||
],
|
|
||||||
forwardPortCommand: const <String>[
|
|
||||||
'ssh',
|
|
||||||
'-o', 'BatchMode=yes',
|
|
||||||
'-o', 'ExitOnForwardFailure=yes',
|
|
||||||
'-L', r'127.0.0.1:${hostPort}:127.0.0.1:${devicePort}',
|
|
||||||
'testuser@192.168.178.1'
|
|
||||||
],
|
|
||||||
forwardPortSuccessRegex: RegExp('Linux'),
|
|
||||||
screenshotCommand: const <String>[
|
|
||||||
'ssh',
|
|
||||||
'-o', 'BatchMode=yes',
|
|
||||||
'testuser@192.168.178.1',
|
|
||||||
'testscreenshot'
|
|
||||||
]
|
|
||||||
)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
testUsingContext(
|
|
||||||
'custom-devices add command correctly adds ipv6 ssh device config',
|
|
||||||
() async {
|
|
||||||
final MemoryFileSystem fs = MemoryFileSystem.test();
|
|
||||||
|
|
||||||
final CommandRunner<void> runner = createCustomDevicesCommandRunner(
|
|
||||||
terminal: (Platform platform) => createFakeTerminalForAddingSshDevice(
|
|
||||||
platform: platform,
|
|
||||||
id: 'testid',
|
|
||||||
label: 'testlabel',
|
|
||||||
sdkNameAndVersion: 'testsdknameandversion',
|
|
||||||
enabled: 'y',
|
|
||||||
hostname: '::1',
|
|
||||||
username: 'testuser',
|
|
||||||
runDebug: 'testrundebug',
|
|
||||||
usePortForwarding: 'y',
|
|
||||||
screenshot: 'testscreenshot',
|
|
||||||
apply: 'y',
|
|
||||||
),
|
|
||||||
fileSystem: fs,
|
|
||||||
featureEnabled: true
|
|
||||||
);
|
|
||||||
|
|
||||||
await expectLater(
|
|
||||||
runner.run(const <String>['custom-devices', 'add', '--no-check']),
|
|
||||||
completes
|
|
||||||
);
|
|
||||||
|
|
||||||
final CustomDevicesConfig config = CustomDevicesConfig.test(
|
|
||||||
fileSystem: fs,
|
|
||||||
directory: fs.directory('/'),
|
|
||||||
logger: BufferLogger.test()
|
|
||||||
);
|
|
||||||
|
|
||||||
expect(
|
|
||||||
config.devices,
|
|
||||||
contains(
|
|
||||||
CustomDeviceConfig(
|
|
||||||
id: 'testid',
|
|
||||||
label: 'testlabel',
|
|
||||||
sdkNameAndVersion: 'testsdknameandversion',
|
|
||||||
enabled: true,
|
|
||||||
pingCommand: const <String>[
|
|
||||||
'ping',
|
|
||||||
'-6',
|
|
||||||
'-c', '1',
|
|
||||||
'-w', '1',
|
|
||||||
'::1'
|
|
||||||
],
|
|
||||||
postBuildCommand: const <String>[],
|
|
||||||
installCommand: const <String>[
|
|
||||||
'scp',
|
|
||||||
'-r',
|
|
||||||
'-o', 'BatchMode=yes',
|
|
||||||
'-6',
|
|
||||||
r'${localPath}',
|
|
||||||
r'testuser@[::1]:/tmp/${appName}'
|
|
||||||
],
|
|
||||||
uninstallCommand: const <String>[
|
|
||||||
'ssh',
|
|
||||||
'-o', 'BatchMode=yes',
|
|
||||||
'-6',
|
|
||||||
'testuser@[::1]',
|
|
||||||
r'rm -rf "/tmp/${appName}"'
|
|
||||||
],
|
|
||||||
runDebugCommand: const <String>[
|
|
||||||
'ssh',
|
|
||||||
'-o', 'BatchMode=yes',
|
|
||||||
'-6',
|
|
||||||
'testuser@[::1]',
|
|
||||||
'testrundebug'
|
|
||||||
],
|
|
||||||
forwardPortCommand: const <String>[
|
|
||||||
'ssh',
|
|
||||||
'-o', 'BatchMode=yes',
|
|
||||||
'-o', 'ExitOnForwardFailure=yes',
|
|
||||||
'-6',
|
|
||||||
'-L', r'[::1]:${hostPort}:[::1]:${devicePort}',
|
|
||||||
'testuser@[::1]'
|
|
||||||
],
|
|
||||||
forwardPortSuccessRegex: RegExp('Linux'),
|
|
||||||
screenshotCommand: const <String>[
|
|
||||||
'ssh',
|
|
||||||
'-o', 'BatchMode=yes',
|
|
||||||
'-6',
|
|
||||||
'testuser@[::1]',
|
|
||||||
'testscreenshot'
|
|
||||||
]
|
|
||||||
)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
testUsingContext(
|
|
||||||
'custom-devices add command correctly adds non-forwarding ssh device config',
|
|
||||||
() async {
|
|
||||||
final MemoryFileSystem fs = MemoryFileSystem.test();
|
|
||||||
|
|
||||||
final CommandRunner<void> runner = createCustomDevicesCommandRunner(
|
|
||||||
terminal: (Platform platform) => createFakeTerminalForAddingSshDevice(
|
|
||||||
platform: platform,
|
|
||||||
id: 'testid',
|
|
||||||
label: 'testlabel',
|
|
||||||
sdkNameAndVersion: 'testsdknameandversion',
|
|
||||||
enabled: 'y',
|
|
||||||
hostname: 'testhostname',
|
|
||||||
username: 'testuser',
|
|
||||||
runDebug: 'testrundebug',
|
|
||||||
usePortForwarding: 'n',
|
|
||||||
screenshot: 'testscreenshot',
|
|
||||||
apply: 'y',
|
|
||||||
),
|
|
||||||
fileSystem: fs,
|
|
||||||
featureEnabled: true
|
|
||||||
);
|
|
||||||
|
|
||||||
await expectLater(
|
|
||||||
runner.run(const <String>['custom-devices', 'add', '--no-check']),
|
|
||||||
completes
|
|
||||||
);
|
|
||||||
|
|
||||||
final CustomDevicesConfig config = CustomDevicesConfig.test(
|
|
||||||
fileSystem: fs,
|
|
||||||
directory: fs.directory('/'),
|
|
||||||
logger: BufferLogger.test()
|
|
||||||
);
|
|
||||||
|
|
||||||
expect(
|
|
||||||
config.devices,
|
|
||||||
contains(
|
|
||||||
const CustomDeviceConfig(
|
|
||||||
id: 'testid',
|
|
||||||
label: 'testlabel',
|
|
||||||
sdkNameAndVersion: 'testsdknameandversion',
|
|
||||||
enabled: true,
|
|
||||||
pingCommand: <String>[
|
|
||||||
'ping',
|
|
||||||
'-c', '1',
|
|
||||||
'-w', '1',
|
|
||||||
'testhostname'
|
|
||||||
],
|
|
||||||
postBuildCommand: <String>[],
|
|
||||||
installCommand: <String>[
|
|
||||||
'scp',
|
|
||||||
'-r',
|
|
||||||
'-o', 'BatchMode=yes',
|
|
||||||
r'${localPath}',
|
|
||||||
r'testuser@testhostname:/tmp/${appName}'
|
|
||||||
],
|
|
||||||
uninstallCommand: <String>[
|
|
||||||
'ssh',
|
|
||||||
'-o', 'BatchMode=yes',
|
|
||||||
'testuser@testhostname',
|
|
||||||
r'rm -rf "/tmp/${appName}"'
|
|
||||||
],
|
|
||||||
runDebugCommand: <String>[
|
|
||||||
'ssh',
|
|
||||||
'-o', 'BatchMode=yes',
|
|
||||||
'testuser@testhostname',
|
|
||||||
'testrundebug'
|
|
||||||
],
|
|
||||||
screenshotCommand: <String>[
|
|
||||||
'ssh',
|
|
||||||
'-o', 'BatchMode=yes',
|
|
||||||
'testuser@testhostname',
|
|
||||||
'testscreenshot'
|
|
||||||
]
|
|
||||||
)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
testUsingContext(
|
|
||||||
'custom-devices add command correctly adds non-screenshotting ssh device config',
|
|
||||||
() async {
|
|
||||||
final MemoryFileSystem fs = MemoryFileSystem.test();
|
|
||||||
|
|
||||||
final CommandRunner<void> runner = createCustomDevicesCommandRunner(
|
|
||||||
terminal: (Platform platform) => createFakeTerminalForAddingSshDevice(
|
|
||||||
platform: platform,
|
|
||||||
id: 'testid',
|
|
||||||
label: 'testlabel',
|
|
||||||
sdkNameAndVersion: 'testsdknameandversion',
|
|
||||||
enabled: 'y',
|
|
||||||
hostname: 'testhostname',
|
|
||||||
username: 'testuser',
|
|
||||||
runDebug: 'testrundebug',
|
|
||||||
usePortForwarding: 'y',
|
|
||||||
screenshot: '',
|
|
||||||
apply: 'y',
|
|
||||||
),
|
|
||||||
fileSystem: fs,
|
|
||||||
featureEnabled: true
|
|
||||||
);
|
|
||||||
|
|
||||||
await expectLater(
|
|
||||||
runner.run(const <String>['custom-devices', 'add', '--no-check']),
|
|
||||||
completes
|
|
||||||
);
|
|
||||||
|
|
||||||
final CustomDevicesConfig config = CustomDevicesConfig.test(
|
|
||||||
fileSystem: fs,
|
|
||||||
directory: fs.directory('/'),
|
|
||||||
logger: BufferLogger.test()
|
|
||||||
);
|
|
||||||
|
|
||||||
expect(
|
|
||||||
config.devices,
|
|
||||||
contains(
|
|
||||||
CustomDeviceConfig(
|
|
||||||
id: 'testid',
|
|
||||||
label: 'testlabel',
|
|
||||||
sdkNameAndVersion: 'testsdknameandversion',
|
|
||||||
enabled: true,
|
|
||||||
pingCommand: const <String>[
|
|
||||||
'ping',
|
|
||||||
'-c', '1',
|
|
||||||
'-w', '1',
|
|
||||||
'testhostname'
|
|
||||||
],
|
|
||||||
postBuildCommand: const <String>[],
|
|
||||||
installCommand: const <String>[
|
|
||||||
'scp',
|
|
||||||
'-r',
|
|
||||||
'-o', 'BatchMode=yes',
|
|
||||||
r'${localPath}',
|
|
||||||
r'testuser@testhostname:/tmp/${appName}'
|
|
||||||
],
|
|
||||||
uninstallCommand: const <String>[
|
|
||||||
'ssh',
|
|
||||||
'-o', 'BatchMode=yes',
|
|
||||||
'testuser@testhostname',
|
|
||||||
r'rm -rf "/tmp/${appName}"'
|
|
||||||
],
|
|
||||||
runDebugCommand: const <String>[
|
|
||||||
'ssh',
|
|
||||||
'-o', 'BatchMode=yes',
|
|
||||||
'testuser@testhostname',
|
|
||||||
'testrundebug'
|
|
||||||
],
|
|
||||||
forwardPortCommand: const <String>[
|
|
||||||
'ssh',
|
|
||||||
'-o', 'BatchMode=yes',
|
|
||||||
'-o', 'ExitOnForwardFailure=yes',
|
|
||||||
'-L', r'127.0.0.1:${hostPort}:127.0.0.1:${devicePort}',
|
|
||||||
'testuser@testhostname'
|
|
||||||
],
|
|
||||||
forwardPortSuccessRegex: RegExp('Linux'),
|
|
||||||
)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
testUsingContext(
|
testUsingContext(
|
||||||
'custom-devices delete command deletes device and creates backup',
|
'custom-devices delete command deletes device and creates backup',
|
||||||
() async {
|
() async {
|
||||||
@ -1171,100 +737,4 @@ void main() {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
group('windows', () {
|
|
||||||
setUp(() {
|
|
||||||
Cache.flutterRoot = windowsFlutterRoot;
|
|
||||||
});
|
|
||||||
|
|
||||||
testUsingContext(
|
|
||||||
'custom-devices add command correctly adds ssh device config on windows',
|
|
||||||
() async {
|
|
||||||
final MemoryFileSystem fs = MemoryFileSystem.test(style: FileSystemStyle.windows);
|
|
||||||
|
|
||||||
final CommandRunner<void> runner = createCustomDevicesCommandRunner(
|
|
||||||
terminal: (Platform platform) => createFakeTerminalForAddingSshDevice(
|
|
||||||
platform: platform,
|
|
||||||
id: 'testid',
|
|
||||||
label: 'testlabel',
|
|
||||||
sdkNameAndVersion: 'testsdknameandversion',
|
|
||||||
enabled: 'y',
|
|
||||||
hostname: 'testhostname',
|
|
||||||
username: 'testuser',
|
|
||||||
runDebug: 'testrundebug',
|
|
||||||
usePortForwarding: 'y',
|
|
||||||
screenshot: 'testscreenshot',
|
|
||||||
apply: 'y',
|
|
||||||
),
|
|
||||||
fileSystem: fs,
|
|
||||||
platform: windowsPlatform,
|
|
||||||
featureEnabled: true
|
|
||||||
);
|
|
||||||
|
|
||||||
await expectLater(
|
|
||||||
runner.run(const <String>['custom-devices', 'add', '--no-check']),
|
|
||||||
completes
|
|
||||||
);
|
|
||||||
|
|
||||||
final CustomDevicesConfig config = CustomDevicesConfig.test(
|
|
||||||
fileSystem: fs,
|
|
||||||
directory: fs.directory('/'),
|
|
||||||
logger: BufferLogger.test()
|
|
||||||
);
|
|
||||||
|
|
||||||
expect(
|
|
||||||
config.devices,
|
|
||||||
contains(
|
|
||||||
CustomDeviceConfig(
|
|
||||||
id: 'testid',
|
|
||||||
label: 'testlabel',
|
|
||||||
sdkNameAndVersion: 'testsdknameandversion',
|
|
||||||
enabled: true,
|
|
||||||
pingCommand: const <String>[
|
|
||||||
'ping',
|
|
||||||
'-n', '1',
|
|
||||||
'-w', '500',
|
|
||||||
'testhostname'
|
|
||||||
],
|
|
||||||
pingSuccessRegex: RegExp(r'[<=]\d+ms'),
|
|
||||||
postBuildCommand: const <String>[],
|
|
||||||
installCommand: const <String>[
|
|
||||||
'scp',
|
|
||||||
'-r',
|
|
||||||
'-o', 'BatchMode=yes',
|
|
||||||
r'${localPath}',
|
|
||||||
r'testuser@testhostname:/tmp/${appName}'
|
|
||||||
],
|
|
||||||
uninstallCommand: const <String>[
|
|
||||||
'ssh',
|
|
||||||
'-o', 'BatchMode=yes',
|
|
||||||
'testuser@testhostname',
|
|
||||||
r'rm -rf "/tmp/${appName}"'
|
|
||||||
],
|
|
||||||
runDebugCommand: const <String>[
|
|
||||||
'ssh',
|
|
||||||
'-o', 'BatchMode=yes',
|
|
||||||
'testuser@testhostname',
|
|
||||||
'testrundebug'
|
|
||||||
],
|
|
||||||
forwardPortCommand: const <String>[
|
|
||||||
'ssh',
|
|
||||||
'-o', 'BatchMode=yes',
|
|
||||||
'-o', 'ExitOnForwardFailure=yes',
|
|
||||||
'-L', r'127.0.0.1:${hostPort}:127.0.0.1:${devicePort}',
|
|
||||||
'testuser@testhostname'
|
|
||||||
],
|
|
||||||
forwardPortSuccessRegex: RegExp('Linux'),
|
|
||||||
screenshotCommand: const <String>[
|
|
||||||
'ssh',
|
|
||||||
'-o', 'BatchMode=yes',
|
|
||||||
'testuser@testhostname',
|
|
||||||
'testscreenshot'
|
|
||||||
]
|
|
||||||
)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
}
|
@ -1,60 +0,0 @@
|
|||||||
// Copyright 2014 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.
|
|
||||||
|
|
||||||
// @dart = 2.8
|
|
||||||
|
|
||||||
import 'package:flutter_tools/src/doctor.dart';
|
|
||||||
import 'package:flutter_tools/src/features.dart';
|
|
||||||
import 'package:flutter_tools/src/linux/linux_doctor.dart';
|
|
||||||
import 'package:flutter_tools/src/web/web_validator.dart';
|
|
||||||
import 'package:flutter_tools/src/windows/visual_studio_validator.dart';
|
|
||||||
|
|
||||||
import '../src/common.dart';
|
|
||||||
import '../src/fakes.dart';
|
|
||||||
import '../src/testbed.dart';
|
|
||||||
|
|
||||||
void main() {
|
|
||||||
Testbed testbed;
|
|
||||||
|
|
||||||
setUp(() {
|
|
||||||
testbed = Testbed();
|
|
||||||
});
|
|
||||||
|
|
||||||
test('doctor validators includes desktop when features are enabled', () => testbed.run(() {
|
|
||||||
expect(DoctorValidatorsProvider.defaultInstance.validators,
|
|
||||||
contains(isA<LinuxDoctorValidator>()));
|
|
||||||
expect(DoctorValidatorsProvider.defaultInstance.validators,
|
|
||||||
contains(isA<VisualStudioValidator>()));
|
|
||||||
}, overrides: <Type, Generator>{
|
|
||||||
FeatureFlags: () => TestFeatureFlags(
|
|
||||||
isLinuxEnabled: true,
|
|
||||||
isWindowsEnabled: true,
|
|
||||||
),
|
|
||||||
}));
|
|
||||||
|
|
||||||
test('doctor validators does not include desktop when features are enabled', () => testbed.run(() {
|
|
||||||
expect(DoctorValidatorsProvider.defaultInstance.validators,
|
|
||||||
isNot(contains(isA<LinuxDoctorValidator>())));
|
|
||||||
expect(DoctorValidatorsProvider.defaultInstance.validators,
|
|
||||||
isNot(contains(isA<VisualStudioValidator>())));
|
|
||||||
}, overrides: <Type, Generator>{
|
|
||||||
FeatureFlags: () => TestFeatureFlags(),
|
|
||||||
}));
|
|
||||||
|
|
||||||
test('doctor validators includes web when feature is enabled', () => testbed.run(() {
|
|
||||||
expect(DoctorValidatorsProvider.defaultInstance.validators,
|
|
||||||
contains(isA<ChromiumValidator>()));
|
|
||||||
}, overrides: <Type, Generator>{
|
|
||||||
FeatureFlags: () => TestFeatureFlags(
|
|
||||||
isWebEnabled: true,
|
|
||||||
),
|
|
||||||
}));
|
|
||||||
|
|
||||||
test('doctor validators does not include web when feature is disabled', () => testbed.run(() {
|
|
||||||
expect(DoctorValidatorsProvider.defaultInstance.validators,
|
|
||||||
isNot(contains(isA<ChromiumValidator>())));
|
|
||||||
}, overrides: <Type, Generator>{
|
|
||||||
FeatureFlags: () => TestFeatureFlags(),
|
|
||||||
}));
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user