Add support for IOS_SIMULATOR_HOME environment variable in IOSSimulat… (#13236)
Add support for IOS_SIMULATOR_HOME environment variable in IOSSimulator.logFilePath flutter_tools can be run on environments where the user's HOME directory is not the root of the iOS simulators' configs. This change adds support for such environments by allowing the caller to set the simulator root directory via an environment variable.
This commit is contained in:
@@ -18,8 +18,29 @@ class MockProcessManager extends Mock implements ProcessManager {}
|
||||
class MockProcess extends Mock implements Process {}
|
||||
|
||||
void main() {
|
||||
final FakePlatform osx = new FakePlatform.fromPlatform(const LocalPlatform());
|
||||
osx.operatingSystem = 'macos';
|
||||
FakePlatform osx;
|
||||
|
||||
setUp(() {
|
||||
osx = new FakePlatform.fromPlatform(const LocalPlatform());
|
||||
osx.operatingSystem = 'macos';
|
||||
});
|
||||
|
||||
group('logFilePath', () {
|
||||
testUsingContext('defaults to rooted from HOME', () {
|
||||
osx.environment['HOME'] = '/foo/bar';
|
||||
expect(new IOSSimulator('123').logFilePath, '/foo/bar/Library/Logs/CoreSimulator/123/system.log');
|
||||
}, overrides: <Type, Generator>{
|
||||
Platform: () => osx,
|
||||
}, testOn: 'posix');
|
||||
|
||||
testUsingContext('respects IOS_SIMULATOR_LOG_FILE_PATH', () {
|
||||
osx.environment['HOME'] = '/foo/bar';
|
||||
osx.environment['IOS_SIMULATOR_LOG_FILE_PATH'] = '/baz/qux/%{id}/system.log';
|
||||
expect(new IOSSimulator('456').logFilePath, '/baz/qux/456/system.log');
|
||||
}, overrides: <Type, Generator>{
|
||||
Platform: () => osx,
|
||||
});
|
||||
});
|
||||
|
||||
group('compareIosVersions', () {
|
||||
test('compares correctly', () {
|
||||
|
||||
@@ -68,6 +68,7 @@ void testUsingContext(String description, dynamic testMethod(), {
|
||||
Timeout timeout,
|
||||
Map<Type, Generator> overrides: const <Type, Generator>{},
|
||||
ContextInitializer initializeContext: _defaultInitializeContext,
|
||||
String testOn,
|
||||
bool skip, // should default to `false`, but https://github.com/dart-lang/test/issues/545 doesn't allow this
|
||||
}) {
|
||||
|
||||
@@ -124,7 +125,7 @@ void testUsingContext(String description, dynamic testMethod(), {
|
||||
rethrow;
|
||||
}
|
||||
|
||||
}, timeout: timeout, skip: skip);
|
||||
}, timeout: timeout, testOn: testOn, skip: skip);
|
||||
}
|
||||
|
||||
void _printBufferedErrors(AppContext testContext) {
|
||||
|
||||
Reference in New Issue
Block a user