Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion lib/web_ui/dev/felt.dart
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,18 @@ void main(List<String> args) async {
} on ToolException catch (e) {
io.stderr.writeln(e.message);
exitCode = 1;
} on ProcessException catch (e) {
io.stderr.writeln('description: ${e.description}'
'executable: ${e.executable} '
'arguments: ${e.arguments} '
'exit code: ${e.exitCode}');
exitCode = e.exitCode;
} catch (e) {
rethrow;
} finally {
await cleanup();
// The exit code is changed by one of the branches.
if(exitCode != -1) {
if (exitCode != -1) {
io.exit(exitCode);
}
}
Expand Down
70 changes: 70 additions & 0 deletions lib/web_ui/dev/macos_info.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
// Copyright 2013 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.
import 'dart:convert';

import 'utils.dart';

class MacOSInfo {
/// Print information collected from the operating system.
///
/// Built in tools such as `system_profiler` and `defaults` are utilized.
Future<void> printInformation() async {
try {
await _printSafariApplications();
} catch (error) {
print('Error thrown while getting Safari Applications: $error');
}

try {
await _printSafariDefaults();
} catch (error) {
print('Error thrown while getting Safari defaults: $error');
}

try {
await _printUserLimits();
} catch (error) {
print('Error thrown while getting user limits defaults: $error');
}
}

/// Print information on applications in the system that contains string
/// `Safari`.
Future<void> _printSafariApplications() async {
final String systemProfileJson = await evalProcess(
'system_profiler', ['SPApplicationsDataType', '-json']);

final Map<String, dynamic> json =
jsonDecode(systemProfileJson) as Map<String, dynamic>;
final List<dynamic> systemProfile = json.values.first as List<dynamic>;
for (int i = 0; i < systemProfile.length; i++) {
final Map<String, dynamic> application =
systemProfile[i] as Map<String, dynamic>;
final String applicationName = application['_name'] as String;
if (applicationName.contains('Safari')) {
print('application: $applicationName '
'fullInfo: ${application.toString()}');
}
}
}

/// Print all the defaults in the system related to Safari.
Future<void> _printSafariDefaults() async {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mdebbar I added this part too. I thought some defaults such as DefaultBrowserPromptingState might be related to test flakes. Therefore it would be valuable information once we start running the tests.

final String defaults =
await evalProcess('/usr/bin/defaults', ['find', 'Safari']);

print('Safari related defaults:\n $defaults');
}

/// Print user limits (file and process).
Future<void> _printUserLimits() async {
final String fileLimit = await evalProcess('ulimit', ['-n']);

print('MacOS file limit: $fileLimit');

final String processLimit = await evalProcess('ulimit', ['-u']);

print('MacOS process limit: $processLimit');
}
}
12 changes: 12 additions & 0 deletions lib/web_ui/dev/test_runner.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@ import 'package:test_core/src/executable.dart'
as test; // ignore: implementation_imports
import 'package:simulators/simulator_manager.dart';

import 'common.dart';
import 'environment.dart';
import 'exceptions.dart';
import 'integration_tests_manager.dart';
import 'macos_info.dart';
import 'safari_installation.dart';
import 'supported_browsers.dart';
import 'test_platform.dart';
Expand Down Expand Up @@ -124,6 +126,16 @@ class TestCommand extends Command<bool> with ArgUtils {
// Check the flags to see what type of integration tests are requested.
testTypesRequested = findTestType();

if (isSafariOnMacOS) {
/// Collect information on the bot.
final MacOSInfo macOsInfo = new MacOSInfo();
await macOsInfo.printInformation();
/// Tests may fail on the CI, therefore exit test_runner.
if (isLuci) {
return true;
}
}

switch (testTypesRequested) {
case TestTypesRequested.unit:
return runUnitTests();
Expand Down