73a059d406
Also add functionality for the tool to do offsets. Finally run in on the pkg/vm_service/test/ folder. Change-Id: Ifa4ca60ed0707e6211baf4b9df140802d5cecf6f Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/404881 Commit-Queue: Jens Johansen <jensj@google.com> Reviewed-by: Slava Egorov <vegorov@google.com>
79 lines
1.8 KiB
Dart
79 lines
1.8 KiB
Dart
// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file
|
|
// for details. 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:async';
|
|
|
|
import 'common/service_test_common.dart';
|
|
import 'common/test_helper.dart';
|
|
|
|
// AUTOGENERATED START
|
|
//
|
|
// Update these constants by running:
|
|
//
|
|
// dart pkg/vm_service/test/update_line_numbers.dart pkg/vm_service/test/regress_28980_test.dart
|
|
//
|
|
const LINE_A = 26;
|
|
const LINE_B = 44;
|
|
// AUTOGENERATED END
|
|
|
|
late A _lock;
|
|
bool _lockEnabled = true;
|
|
|
|
String flutterRoot = 'abc';
|
|
|
|
A foo(String a, String b, String c, String d) {
|
|
return A(); // LINE_A
|
|
}
|
|
|
|
class A {
|
|
Future lock() => Future.microtask(() => print('lock'));
|
|
final path = 'path';
|
|
}
|
|
|
|
class FileSystemException {}
|
|
|
|
Future<void> testCode() async {
|
|
if (!_lockEnabled) return;
|
|
_lock = foo(flutterRoot, 'bin', 'cache', 'lockfile');
|
|
bool locked = false;
|
|
bool printed = false;
|
|
while (!locked) {
|
|
try {
|
|
await _lock.lock();
|
|
locked = true; // LINE_B
|
|
} on FileSystemException {
|
|
if (!printed) {
|
|
print('Print path: ${_lock.path}');
|
|
print('Just another line...');
|
|
printed = true;
|
|
}
|
|
await Future<void>.delayed(const Duration(milliseconds: 50));
|
|
}
|
|
}
|
|
}
|
|
|
|
final tests = <IsolateTest>[
|
|
hasPausedAtStart,
|
|
markDartColonLibrariesDebuggable,
|
|
setBreakpointAtLine(LINE_A),
|
|
resumeIsolate,
|
|
hasStoppedAtBreakpoint,
|
|
setBreakpointAtLine(LINE_B),
|
|
resumeIsolate,
|
|
hasStoppedAtBreakpoint,
|
|
stepInto,
|
|
stepInto,
|
|
stepInto,
|
|
resumeIsolate,
|
|
];
|
|
|
|
void main([args = const <String>[]]) => runIsolateTests(
|
|
args,
|
|
tests,
|
|
'regress_28980_test.dart',
|
|
testeeConcurrent: testCode,
|
|
pauseOnStart: true,
|
|
pauseOnExit: false,
|
|
);
|