[CLI] Fix handling of --timeline-streams when it is supplied after dart run
--timeline-streams has been listed in the "options implied by --observe" section of the dart run help messages, but it has been getting ignored. This CL fixes that problem. TEST=manual testing, CI Change-Id: Ib6c2425a2681b61375df186673e0f195e3fae580 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/288581 Reviewed-by: Ben Konyi <bkonyi@google.com>
This commit is contained in:
@@ -323,6 +323,31 @@ void main(List<String> args) => print("$b $args");
|
||||
expect(result.exitCode, 0);
|
||||
});
|
||||
|
||||
test('with accepted VM flags related to the timeline', () async {
|
||||
p = project(
|
||||
mainSrc: 'import "dart:developer";'
|
||||
'void main() {'
|
||||
'Timeline.startSync("sync");'
|
||||
'Timeline.finishSync();'
|
||||
'}');
|
||||
|
||||
final result = await p.run([
|
||||
'--timeline-recorder=file',
|
||||
'run',
|
||||
'--timeline-streams=Dart',
|
||||
p.relativeFilePath
|
||||
]);
|
||||
|
||||
expect(result.stderr, isEmpty);
|
||||
expect(result.stdout, isEmpty);
|
||||
expect(result.exitCode, 0);
|
||||
expect(
|
||||
p
|
||||
.findFile(path.join(p.dirPath, 'dart-timeline.json'))!
|
||||
.readAsStringSync(),
|
||||
contains('"name":"sync","cat":"Dart"'));
|
||||
});
|
||||
|
||||
test('fails when provided verbose VM flags', () async {
|
||||
p = project(mainSrc: "void main() { print('Hello World'); }");
|
||||
|
||||
|
||||
@@ -416,6 +416,7 @@ bool Options::ProcessVMDebuggingOptions(const char* arg,
|
||||
V("--no-pause-isolates-on-unhandled-exception", arg) \
|
||||
V("--warn-on-pause-with-no-debugger", arg) \
|
||||
V("--no-warn-on-pause-with-no-debugger", arg) \
|
||||
V("--timeline-streams", arg) \
|
||||
V("--enable-experiment", arg)
|
||||
HANDLE_DARTDEV_VM_DEBUG_OPTIONS(IS_DEBUG_OPTION, arg);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user