[ Tool ] Add logging to test_adapter_test.dart (#174073)

Will hopefully help gather some details about why `widget tests can run
in debug mode` is sometimes timing out.

Related issue: https://github.com/flutter/flutter/issues/172636
This commit is contained in:
Ben Konyi 2025-08-19 17:49:10 -04:00 committed by GitHub
parent 3fb62e6450
commit 8d937c05b1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 26 additions and 3 deletions

View File

@ -2,6 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// TODO(bkonyi): remove and cleanup prints once https://github.com/flutter/flutter/issues/172636
// is resolved.
// ignore_for_file: avoid_print
import 'dart:async';
import 'package:dds/dap.dart';
@ -129,6 +133,7 @@ class DapTestClient {
bool? supportsRunInTerminalRequest,
bool? supportsProgressReporting,
}) async {
print('DapTestClient.initialize: wait for responses');
final List<ProtocolMessage> responses = await Future.wait(<Future<ProtocolMessage>>[
event('initialized'),
sendRequest(
@ -140,6 +145,7 @@ class DapTestClient {
),
sendRequest(SetExceptionBreakpointsArguments(filters: <String>[exceptionPauseMode])),
]);
print('DapTestClient.initialize: got responses, sending config done');
await sendRequest(ConfigurationDoneArguments());
return responses[1] as Response; // Return the initialize response.
}
@ -261,8 +267,12 @@ class DapTestClient {
Future<Object?> Function()? launch,
}) {
return Future.wait(<Future<Object?>>[
initialize(exceptionPauseMode: exceptionPauseMode),
launch?.call() ?? this.launch(program: program, cwd: cwd),
initialize(
exceptionPauseMode: exceptionPauseMode,
).then((_) => print('DapTestClient.initialize: completed')),
(launch?.call() ?? this.launch(program: program, cwd: cwd)).then(
(_) => print('DapTestClient.launch: completed'),
),
], eagerError: true);
}
@ -398,11 +408,20 @@ extension DapTestClientExtension on DapTestClient {
final Future<List<Map<String, Object?>>> testNotificationEventsFuture = testNotificationEvents
.toList();
print('DapTestClient.start: started');
if (start != null) {
await start();
} else {
await this.start(program: program, cwd: cwd, launch: launch);
}
print('DapTestClient.start: completed');
unawaited(outputEventsFuture.then((_) => print('DapTestClient.outputEventsFuture: completed')));
unawaited(
testNotificationEventsFuture.then(
(_) => print('DapTestClient.testNotificationEventsFuture: completed'),
),
);
return TestEvents(
output: await outputEventsFuture,

View File

@ -29,7 +29,11 @@ final useInProcessDap = Platform.environment['DAP_TEST_INTERNAL'] == 'true';
/// This is useful for debugging locally or on the bots and will include both
/// DAP traffic (between the test DAP client and the DAP server) and the VM
/// Service traffic (wrapped in a custom 'dart.log' event).
final verboseLogging = Platform.environment['DAP_TEST_VERBOSE'] == 'true';
final bool verboseLogging =
Platform.environment['DAP_TEST_VERBOSE'] == 'true' ||
// Enable verbose logging on CI bots.
// TODO(bkonyi): remove this once https://github.com/flutter/flutter/issues/172636 is resolved.
Platform.environment.containsKey('SWARMING_TASK_ID');
const endOfErrorOutputMarker =
'════════════════════════════════════════════════════════════════════════════════';