diff --git a/pkg/dartdev/test/commands/run_test.dart b/pkg/dartdev/test/commands/run_test.dart index 8904fab55bb..e9fc5d234d4 100644 --- a/pkg/dartdev/test/commands/run_test.dart +++ b/pkg/dartdev/test/commands/run_test.dart @@ -323,6 +323,31 @@ void main(List 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'); }"); diff --git a/runtime/bin/main_options.cc b/runtime/bin/main_options.cc index 84df492e74e..00cd3b15ac8 100644 --- a/runtime/bin/main_options.cc +++ b/runtime/bin/main_options.cc @@ -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);