Audit devicelab log streaming for nullability (#84820)
This commit is contained in:
parent
15301a6f44
commit
03034e9e4a
@ -8,7 +8,6 @@ import 'dart:io';
|
||||
|
||||
import 'package:flutter_devicelab/framework/devices.dart';
|
||||
import 'package:flutter_devicelab/framework/framework.dart';
|
||||
import 'package:flutter_devicelab/framework/host_agent.dart';
|
||||
import 'package:flutter_devicelab/framework/task_result.dart';
|
||||
import 'package:flutter_devicelab/framework/utils.dart';
|
||||
import 'package:path/path.dart' as p;
|
||||
@ -34,8 +33,6 @@ void main() {
|
||||
p.join(complexLayoutPath, 'test_driver', 'semantics_perf.dart'),
|
||||
'-d',
|
||||
deviceId,
|
||||
'--screenshot',
|
||||
hostAgent.dumpDirectory.path,
|
||||
]);
|
||||
});
|
||||
|
||||
|
@ -6,7 +6,6 @@
|
||||
|
||||
import 'package:flutter_devicelab/framework/devices.dart';
|
||||
import 'package:flutter_devicelab/framework/framework.dart';
|
||||
import 'package:flutter_devicelab/framework/host_agent.dart';
|
||||
import 'package:flutter_devicelab/framework/task_result.dart';
|
||||
import 'package:flutter_devicelab/framework/utils.dart';
|
||||
|
||||
@ -18,8 +17,6 @@ Future<String> _runWithMode(String mode, String deviceId) async {
|
||||
'test_driver/scroll_perf.dart',
|
||||
'-d',
|
||||
deviceId,
|
||||
'--screenshot',
|
||||
hostAgent.dumpDirectory.path,
|
||||
]);
|
||||
return stderr.toString();
|
||||
}
|
||||
|
@ -360,9 +360,11 @@ Future<void> main() async {
|
||||
);
|
||||
|
||||
if (testResultExit != 0) {
|
||||
final Directory dumpDirectory = hostAgent.dumpDirectory;
|
||||
if (dumpDirectory != null) {
|
||||
// Zip the test results to the artifacts directory for upload.
|
||||
await inDirectory(resultBundleTemp, () {
|
||||
final String zipPath = path.join(hostAgent.dumpDirectory.path,
|
||||
final String zipPath = path.join(dumpDirectory.path,
|
||||
'module_test_ios-objc-${DateTime.now().toLocal().toIso8601String()}.zip');
|
||||
return exec(
|
||||
'zip',
|
||||
@ -375,6 +377,7 @@ Future<void> main() async {
|
||||
canFail: true, // Best effort to get the logs.
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
throw TaskResult.failure('Platform unit tests failed');
|
||||
}
|
||||
|
@ -74,8 +74,10 @@ Future<void> main() async {
|
||||
);
|
||||
|
||||
if (testResultExit != 0) {
|
||||
final Directory dumpDirectory = hostAgent.dumpDirectory;
|
||||
if (dumpDirectory != null) {
|
||||
// Zip the test results to the artifacts directory for upload.
|
||||
final String zipPath = path.join(hostAgent.dumpDirectory.path,
|
||||
final String zipPath = path.join(dumpDirectory.path,
|
||||
'native_ui_tests_ios32-${DateTime.now().toLocal().toIso8601String()}.zip');
|
||||
await exec(
|
||||
'zip',
|
||||
@ -88,6 +90,7 @@ Future<void> main() async {
|
||||
workingDirectory: resultBundleTemp,
|
||||
canFail: true, // Best effort to get the logs.
|
||||
);
|
||||
}
|
||||
|
||||
return TaskResult.failure('Platform unit tests failed');
|
||||
}
|
||||
|
@ -11,7 +11,6 @@ import 'dart:io';
|
||||
import 'package:flutter_devicelab/common.dart';
|
||||
import 'package:flutter_devicelab/framework/devices.dart';
|
||||
import 'package:flutter_devicelab/framework/framework.dart';
|
||||
import 'package:flutter_devicelab/framework/host_agent.dart';
|
||||
import 'package:flutter_devicelab/framework/task_result.dart';
|
||||
import 'package:flutter_devicelab/framework/utils.dart';
|
||||
import 'package:path/path.dart' as path;
|
||||
@ -31,8 +30,6 @@ void main() {
|
||||
'--verbose',
|
||||
'-d',
|
||||
device.deviceId,
|
||||
'--screenshot',
|
||||
hostAgent.dumpDirectory.path,
|
||||
'--route',
|
||||
'/smuggle-it',
|
||||
'lib/route.dart',
|
||||
|
@ -615,11 +615,12 @@ class AndroidDevice extends Device {
|
||||
|
||||
@override
|
||||
Future<void> stopLoggingToSink() async {
|
||||
assert(_loggingProcess != null);
|
||||
if (_loggingProcess != null) {
|
||||
_abortedLogging = true;
|
||||
_loggingProcess.kill();
|
||||
await _loggingProcess.exitCode;
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Stream<String> get logcat {
|
||||
@ -877,11 +878,12 @@ class IosDevice extends Device {
|
||||
|
||||
@override
|
||||
Future<void> stopLoggingToSink() async {
|
||||
assert(_loggingProcess != null);
|
||||
if (_loggingProcess != null) {
|
||||
_abortedLogging = true;
|
||||
_loggingProcess.kill();
|
||||
await _loggingProcess.exitCode;
|
||||
}
|
||||
}
|
||||
|
||||
// The methods below are stubs for now. They will need to be expanded.
|
||||
// We currently do not have a way to lock/unlock iOS devices. So we assume the
|
||||
|
@ -161,9 +161,8 @@ class _TaskRunner {
|
||||
result = await futureResult;
|
||||
} finally {
|
||||
if (device != null && device.canStreamLogs) {
|
||||
assert(sink != null);
|
||||
await device.stopLoggingToSink();
|
||||
await sink.close();
|
||||
await sink?.close();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -16,6 +16,7 @@ import 'package:path/path.dart' as path;
|
||||
import 'package:process/process.dart';
|
||||
import 'package:stack_trace/stack_trace.dart';
|
||||
|
||||
import 'host_agent.dart';
|
||||
import 'task_result.dart';
|
||||
|
||||
/// Virtual current working directory, which affect functions, such as [exec].
|
||||
@ -453,6 +454,11 @@ List<String> flutterCommandArgs(String command, List<String> options) {
|
||||
'--device-timeout',
|
||||
'5',
|
||||
],
|
||||
|
||||
if (command == 'drive' && hostAgent.dumpDirectory != null) ...<String>[
|
||||
'--screenshot',
|
||||
hostAgent.dumpDirectory.path,
|
||||
],
|
||||
if (localEngine != null) ...<String>['--local-engine', localEngine],
|
||||
if (localEngineSrcPath != null) ...<String>['--local-engine-src-path', localEngineSrcPath],
|
||||
...options,
|
||||
|
@ -10,7 +10,6 @@ import 'dart:math' as math;
|
||||
|
||||
import '../framework/devices.dart';
|
||||
import '../framework/framework.dart';
|
||||
import '../framework/host_agent.dart';
|
||||
import '../framework/task_result.dart';
|
||||
import '../framework/utils.dart';
|
||||
|
||||
@ -104,8 +103,6 @@ class GalleryTransitionTest {
|
||||
'test_driver/$testDriver.dart',
|
||||
'-d',
|
||||
deviceId,
|
||||
'--screenshot',
|
||||
hostAgent.dumpDirectory.path,
|
||||
]);
|
||||
});
|
||||
|
||||
|
@ -6,7 +6,6 @@
|
||||
|
||||
import '../framework/devices.dart';
|
||||
import '../framework/framework.dart';
|
||||
import '../framework/host_agent.dart';
|
||||
import '../framework/task_result.dart';
|
||||
import '../framework/utils.dart';
|
||||
|
||||
@ -161,8 +160,6 @@ class DriverTest {
|
||||
testTarget,
|
||||
'-d',
|
||||
deviceId,
|
||||
'--screenshot',
|
||||
hostAgent.dumpDirectory.path,
|
||||
...extraOptions,
|
||||
];
|
||||
await flutter('drive', options: options, environment: Map<String, String>.from(environment));
|
||||
|
@ -314,8 +314,6 @@ TaskFunction createStackSizeTest() {
|
||||
'--driver', testDriver,
|
||||
'-d',
|
||||
deviceId,
|
||||
'--screenshot',
|
||||
hostAgent.dumpDirectory.path,
|
||||
]);
|
||||
final Map<String, dynamic> data = json.decode(
|
||||
file('${_testOutputDirectory(testDirectory)}/stack_size.json').readAsStringSync(),
|
||||
@ -411,8 +409,6 @@ TaskFunction createsScrollSmoothnessPerfTest() {
|
||||
'-t', testTarget,
|
||||
'-d',
|
||||
deviceId,
|
||||
'--screenshot',
|
||||
hostAgent.dumpDirectory.path,
|
||||
]);
|
||||
final Map<String, dynamic> data = json.decode(
|
||||
file('${_testOutputDirectory(testDirectory)}/scroll_smoothness_test.json').readAsStringSync(),
|
||||
@ -464,8 +460,6 @@ TaskFunction createFramePolicyIntegrationTest() {
|
||||
'-t', testTarget,
|
||||
'-d',
|
||||
deviceId,
|
||||
'--screenshot',
|
||||
hostAgent.dumpDirectory.path,
|
||||
]);
|
||||
final Map<String, dynamic> data = json.decode(
|
||||
file('${_testOutputDirectory(testDirectory)}/frame_policy_event_delay.json').readAsStringSync(),
|
||||
@ -585,16 +579,20 @@ class StartupTest {
|
||||
results.add(data);
|
||||
} else {
|
||||
currentFailures += 1;
|
||||
if (hostAgent.dumpDirectory != null) {
|
||||
await flutter(
|
||||
'screenshot',
|
||||
options: <String>[
|
||||
'-d',
|
||||
device.deviceId,
|
||||
'--out',
|
||||
hostAgent.dumpDirectory.childFile('screenshot_startup_failure_$currentFailures.png').path,
|
||||
hostAgent.dumpDirectory
|
||||
.childFile('screenshot_startup_failure_$currentFailures.png')
|
||||
.path,
|
||||
],
|
||||
canFail: true,
|
||||
);
|
||||
}
|
||||
i -= 1;
|
||||
if (currentFailures == maxFailures) {
|
||||
return TaskResult.failure('Application failed to start $maxFailures times');
|
||||
@ -830,8 +828,6 @@ class PerfTest {
|
||||
...<String>['--dart-define', dartDefine],
|
||||
'-d',
|
||||
deviceId,
|
||||
'--screenshot',
|
||||
hostAgent.dumpDirectory.path,
|
||||
]);
|
||||
final Map<String, dynamic> data = json.decode(
|
||||
file('${_testOutputDirectory(testDirectory)}/$resultFilename.json').readAsStringSync(),
|
||||
@ -1461,8 +1457,6 @@ class DevToolsMemoryTest {
|
||||
'drive',
|
||||
options: <String>[
|
||||
'-d', _device.deviceId,
|
||||
'--screenshot',
|
||||
hostAgent.dumpDirectory.path,
|
||||
'--profile',
|
||||
'--profile-memory', _kJsonFileName,
|
||||
'--no-publish-port',
|
||||
|
Loading…
x
Reference in New Issue
Block a user