From fa8ea6dfaa9d2b1a70a2de81eeb244b0b82267b0 Mon Sep 17 00:00:00 2001 From: Ben Konyi Date: Fri, 12 Feb 2021 07:12:54 +0000 Subject: [PATCH] [ package:vm_service ] Update tests to be compatible with pub run test Will allow for tests to be enabled in google3 as pub or portions of pub are used to run VM tests. Previously the test harness was configured to look for a URI with a data: scheme to determine if it was being run via pub run test (pub generates its own harness and spawns the test from that). We were parsing the test URI out of this data URI, which wouldn't work correctly in google3. This change assumes that if Platform.script.scheme == 'data', the test is being run via pub from the root directory of the package. In that case, we can assume there is a 'test' directory and simply use 'test/$scriptName'as the path for the testee process. TEST=N/A Change-Id: I589605ebc7001adc9d8595ca8347c0af329b9c28 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/184541 Reviewed-by: Gary Roumanis --- .dart_tool/package_config.json | 16 +++++- .packages | 2 + DEPS | 6 +++ pkg/vm_service/pubspec.yaml | 1 + .../test/async_generator_breakpoint_test.dart | 8 ++- pkg/vm_service/test/async_next_test.dart | 8 ++- pkg/vm_service/test/async_scope_test.dart | 8 ++- .../async_single_step_exception_test.dart | 9 +++- .../test/async_single_step_into_test.dart | 9 +++- .../test/async_single_step_out_test.dart | 9 +++- .../async_star_single_step_into_test.dart | 9 +++- .../test/async_star_step_out_test.dart | 9 +++- pkg/vm_service/test/async_step_out_test.dart | 9 +++- pkg/vm_service/test/common/test_helper.dart | 51 +++++++++++-------- .../test/coverage_leaf_function_test.dart | 8 ++- pkg/vm_service/test/debugging_test.dart | 8 ++- pkg/vm_service/test/eval_test.dart | 8 ++- .../test/evaluate_with_scope_test.dart | 8 ++- pkg/vm_service/test/file_service_test.dart | 7 ++- .../test/get_allocation_profile_rpc_test.dart | 6 ++- .../test/get_cpu_samples_rpc_test.dart | 9 +++- .../test/get_flag_list_rpc_test.dart | 6 ++- .../test/get_isolate_group_memory_usage.dart | 6 ++- pkg/vm_service/test/get_isolate_rpc_test.dart | 6 ++- ..._usage.dart => get_memory_usage_test.dart} | 6 ++- pkg/vm_service/test/get_stack_test.dart | 8 ++- pkg/vm_service/test/get_version_rpc_test.dart | 6 ++- .../test/heap_snapshot_graph_test.dart | 8 ++- ..._enable_timeline_logging_service_test.dart | 8 ++- pkg/vm_service/test/invoke_test.dart | 8 ++- .../test/network_profiling_test.dart | 8 ++- .../test/object_graph_identity_hash_test.dart | 3 +- pkg/vm_service/test/process_service_test.dart | 39 +++++++++----- pkg/vm_service/test/regress_44588_test.dart | 6 ++- pkg/vm_service/test/throws_sentinel_test.dart | 6 ++- 35 files changed, 248 insertions(+), 84 deletions(-) rename pkg/vm_service/test/{get_memory_usage.dart => get_memory_usage_test.dart} (89%) diff --git a/.dart_tool/package_config.json b/.dart_tool/package_config.json index 29268f2b376..57799b3be61 100644 --- a/.dart_tool/package_config.json +++ b/.dart_tool/package_config.json @@ -11,7 +11,7 @@ "constraint, update this by running tools/generate_package_config.dart." ], "configVersion": 2, - "generated": "2021-02-08T17:50:36.420568", + "generated": "2021-02-11T15:59:54.232365", "generator": "tools/generate_package_config.dart", "packages": [ { @@ -505,12 +505,24 @@ "packageUri": "lib/", "languageVersion": "2.12" }, + { + "name": "platform", + "rootUri": "../third_party/pkg/platform", + "packageUri": "lib/", + "languageVersion": "2.12" + }, { "name": "pool", "rootUri": "../third_party/pkg/pool", "packageUri": "lib/", "languageVersion": "2.12" }, + { + "name": "process", + "rootUri": "../third_party/pkg/process", + "packageUri": "lib/", + "languageVersion": "2.12" + }, { "name": "protobuf", "rootUri": "../third_party/pkg/protobuf/protobuf", @@ -782,4 +794,4 @@ "languageVersion": "2.12" } ] -} +} \ No newline at end of file diff --git a/.packages b/.packages index badd4873267..3587c4fbe93 100644 --- a/.packages +++ b/.packages @@ -74,7 +74,9 @@ observatory_test_package:runtime/observatory/tests/service/observatory_test_pack package_config:third_party/pkg_tested/package_config/lib path:third_party/pkg/path/lib pedantic:third_party/pkg/pedantic/lib +platform:third_party/pkg/platform/lib pool:third_party/pkg/pool/lib +process:third_party/pkg/process/lib protobuf:third_party/pkg/protobuf/protobuf/lib pub:third_party/pkg/pub/lib pub_semver:third_party/pkg/pub_semver/lib diff --git a/DEPS b/DEPS index 19a424fc78a..63184638a95 100644 --- a/DEPS +++ b/DEPS @@ -130,8 +130,10 @@ vars = { "package_config_rev": "249af482de9ebabfc781bf10d6152c938e5ce45e", "path_rev": "407ab76187fade41c31e39c745b39661b710106c", "pedantic_rev": "df177f6ae531426aaf7bbf0121c90dc89d9c57bf", + "platform_rev": "c20e6fa315e9f8820e51c0ae721f63aff33b8e17", "ply_rev": "604b32590ffad5cbb82e4afef1d305512d06ae93", "pool_rev": "7abe634002a1ba8a0928eded086062f1307ccfae", + "process_rev": "56ece43b53b64c63ae51ec184b76bd5360c28d0b", "protobuf_rev": "0d03fd588df69e9863e2a2efc0059dee8f18d5b2", "pub_rev": "0e657414a472e74ca5dd76ae0db50cc060251dec", "pub_semver_rev": "f50d80ef10c4b2fa5f4c8878036a4d9342c0cc82", @@ -387,10 +389,14 @@ deps = { Var("dart_git") + "path.git" + "@" + Var("path_rev"), Var("dart_root") + "/third_party/pkg/pedantic": Var("dart_git") + "pedantic.git" + "@" + Var("pedantic_rev"), + Var("dart_root") + "/third_party/pkg/platform": + Var("dart_git") + "platform.dart.git" + "@" + Var("platform_rev"), Var("dart_root") + "/third_party/pkg/pool": Var("dart_git") + "pool.git" + "@" + Var("pool_rev"), Var("dart_root") + "/third_party/pkg/protobuf": Var("dart_git") + "protobuf.git" + "@" + Var("protobuf_rev"), + Var("dart_root") + "/third_party/pkg/process": + Var("dart_git") + "process.dart.git" + "@" + Var("process_rev"), Var("dart_root") + "/third_party/pkg/pub_semver": Var("dart_git") + "pub_semver.git" + "@" + Var("pub_semver_rev"), Var("dart_root") + "/third_party/pkg/pub": diff --git a/pkg/vm_service/pubspec.yaml b/pkg/vm_service/pubspec.yaml index 7760e114bbe..82aae530cc2 100644 --- a/pkg/vm_service/pubspec.yaml +++ b/pkg/vm_service/pubspec.yaml @@ -18,5 +18,6 @@ dev_dependencies: mockito: ^5.0.0-nullsafety.1 path: ^1.8.0 pedantic: ^1.10.0-nullsafety.3 + process: ^4.0.0 pub_semver: ^2.0.0-nullsafety.0 test: ^1.16.0-nullsafety.13 diff --git a/pkg/vm_service/test/async_generator_breakpoint_test.dart b/pkg/vm_service/test/async_generator_breakpoint_test.dart index d4c20a73a8b..fb999fc9baf 100644 --- a/pkg/vm_service/test/async_generator_breakpoint_test.dart +++ b/pkg/vm_service/test/async_generator_breakpoint_test.dart @@ -102,5 +102,9 @@ Future testAsync(VmService service, IsolateRef isolateRef) async { final tests = [testAsync]; -main([args = const []]) => - runIsolateTests(args, tests, testeeConcurrent: testeeDo); +main([args = const []]) => runIsolateTests( + args, + tests, + 'async_generator_breakpoint_test.dart', + testeeConcurrent: testeeDo, + ); diff --git a/pkg/vm_service/test/async_next_test.dart b/pkg/vm_service/test/async_next_test.dart index 1d7387f0a77..fe23bf1993b 100644 --- a/pkg/vm_service/test/async_next_test.dart +++ b/pkg/vm_service/test/async_next_test.dart @@ -42,5 +42,9 @@ var tests = [ resumeIsolate, ]; -main([args = const []]) => - runIsolateTests(args, tests, testeeConcurrent: testMain); +main([args = const []]) => runIsolateTests( + args, + tests, + 'async_next_test.dart', + testeeConcurrent: testMain, + ); diff --git a/pkg/vm_service/test/async_scope_test.dart b/pkg/vm_service/test/async_scope_test.dart index 5b8d2624f73..9451c0a9ee9 100644 --- a/pkg/vm_service/test/async_scope_test.dart +++ b/pkg/vm_service/test/async_scope_test.dart @@ -70,5 +70,9 @@ var tests = [ resumeIsolate, ]; -main([args = const []]) => - runIsolateTests(args, tests, testeeConcurrent: testeeDo); +main([args = const []]) => runIsolateTests( + args, + tests, + 'async_scope_test.dart', + testeeConcurrent: testeeDo, + ); diff --git a/pkg/vm_service/test/async_single_step_exception_test.dart b/pkg/vm_service/test/async_single_step_exception_test.dart index b6163269866..2e06ba76a24 100644 --- a/pkg/vm_service/test/async_single_step_exception_test.dart +++ b/pkg/vm_service/test/async_single_step_exception_test.dart @@ -78,5 +78,10 @@ var tests = [ resumeIsolate ]; -main([args = const []]) => runIsolateTests(args, tests, - testeeConcurrent: testMain, extraArgs: extraDebuggingArgs); +main([args = const []]) => runIsolateTests( + args, + tests, + 'async_single_step_exception_test.dart', + testeeConcurrent: testMain, + extraArgs: extraDebuggingArgs, + ); diff --git a/pkg/vm_service/test/async_single_step_into_test.dart b/pkg/vm_service/test/async_single_step_into_test.dart index 36dd15b842a..604e00b49b5 100644 --- a/pkg/vm_service/test/async_single_step_into_test.dart +++ b/pkg/vm_service/test/async_single_step_into_test.dart @@ -43,5 +43,10 @@ var tests = [ resumeIsolate ]; -main([args = const []]) => runIsolateTestsSynchronous(args, tests, - testeeConcurrent: testMain, extraArgs: extraDebuggingArgs); +main([args = const []]) => runIsolateTestsSynchronous( + args, + tests, + 'async_single_step_into_test.dart', + testeeConcurrent: testMain, + extraArgs: extraDebuggingArgs, + ); diff --git a/pkg/vm_service/test/async_single_step_out_test.dart b/pkg/vm_service/test/async_single_step_out_test.dart index a0a3d8354d8..1db5d6721a9 100644 --- a/pkg/vm_service/test/async_single_step_out_test.dart +++ b/pkg/vm_service/test/async_single_step_out_test.dart @@ -56,5 +56,10 @@ var tests = [ resumeIsolate ]; -main([args = const []]) => runIsolateTests(args, tests, - testeeConcurrent: testMain, extraArgs: extraDebuggingArgs); +main([args = const []]) => runIsolateTests( + args, + tests, + 'async_single_step_out_test.dart', + testeeConcurrent: testMain, + extraArgs: extraDebuggingArgs, + ); diff --git a/pkg/vm_service/test/async_star_single_step_into_test.dart b/pkg/vm_service/test/async_star_single_step_into_test.dart index d2d730e1593..bf5c964ffc1 100644 --- a/pkg/vm_service/test/async_star_single_step_into_test.dart +++ b/pkg/vm_service/test/async_star_single_step_into_test.dart @@ -70,5 +70,10 @@ var tests = [ resumeIsolate, ]; -main([args = const []]) => runIsolateTestsSynchronous(args, tests, - testeeConcurrent: testMain, extraArgs: extraDebuggingArgs); +main([args = const []]) => runIsolateTestsSynchronous( + args, + tests, + 'async_star_single_step_into_test.dart', + testeeConcurrent: testMain, + extraArgs: extraDebuggingArgs, + ); diff --git a/pkg/vm_service/test/async_star_step_out_test.dart b/pkg/vm_service/test/async_star_step_out_test.dart index 5bb8dde3890..14a05f9bebc 100644 --- a/pkg/vm_service/test/async_star_step_out_test.dart +++ b/pkg/vm_service/test/async_star_step_out_test.dart @@ -100,5 +100,10 @@ var tests = [ stoppedAtLine(LINE_I), // return null. ]; -main([args = const []]) => runIsolateTestsSynchronous(args, tests, - testeeConcurrent: testMain, extraArgs: extraDebuggingArgs); +main([args = const []]) => runIsolateTestsSynchronous( + args, + tests, + 'async_star_step_out_test.dart', + testeeConcurrent: testMain, + extraArgs: extraDebuggingArgs, + ); diff --git a/pkg/vm_service/test/async_step_out_test.dart b/pkg/vm_service/test/async_step_out_test.dart index 8e46584952b..e08ae355e5d 100644 --- a/pkg/vm_service/test/async_step_out_test.dart +++ b/pkg/vm_service/test/async_step_out_test.dart @@ -53,5 +53,10 @@ var tests = [ stoppedAtLine(LINE_F), ]; -main([args = const []]) => runIsolateTests(args, tests, - testeeConcurrent: testMain, extraArgs: extraDebuggingArgs); +main([args = const []]) => runIsolateTests( + args, + tests, + 'async_step_out_test.dart', + testeeConcurrent: testMain, + extraArgs: extraDebuggingArgs, + ); diff --git a/pkg/vm_service/test/common/test_helper.dart b/pkg/vm_service/test/common/test_helper.dart index cd6a98352a5..c5891772bf4 100644 --- a/pkg/vm_service/test/common/test_helper.dart +++ b/pkg/vm_service/test/common/test_helper.dart @@ -7,6 +7,7 @@ library test_helper; import 'dart:async'; import 'dart:convert'; import 'dart:io' as io; +import 'package:process/process.dart'; import 'package:vm_service/vm_service_io.dart'; import 'package:vm_service/vm_service.dart'; import 'package:test/test.dart'; @@ -27,19 +28,15 @@ bool _isTestee() { return io.Platform.environment.containsKey(_TESTEE_ENV_KEY); } -Uri _getTestUri() { +Uri _getTestUri(String script) { if (io.Platform.script.scheme == 'data') { - // If we're using pub to run these tests this value isn't a file URI. - // We'll need to parse the actual URI out... - final fileRegExp = RegExp(r'file:\/\/\/.*\.dart'); - final path = - fileRegExp.stringMatch(io.Platform.script.data!.contentAsString()); - if (path == null) { - throw 'Unable to determine file path for script!'; - } - return Uri.parse(path); + // If running from pub we can assume that we're in the root of the package + // directory. + return Uri.parse('test/$script'); } else { - return io.Platform.script; + // Resolve the script to ensure that test will fail if the provided script + // name doesn't match the actual script. + return io.Platform.script.resolve(script); } } @@ -97,7 +94,8 @@ class _ServiceTesteeLauncher { List args; bool killedByTester = false; - _ServiceTesteeLauncher() : args = [_getTestUri().toFilePath()]; + _ServiceTesteeLauncher(String script) + : args = [_getTestUri(script).toFilePath()]; // Spawn the testee process. Future _spawnProcess( @@ -164,7 +162,13 @@ class _ServiceTesteeLauncher { arguments.insert(0, '-D$k=$v'); }); print('** Launching $bashEnvironment$executable ${arguments.join(' ')}'); - return io.Process.start(executable, arguments, environment: environment); + return LocalProcessManager().start( + [ + executable, + ...arguments, + ], + environment: environment, + ); } Future launch( @@ -214,10 +218,10 @@ class _ServiceTesteeLauncher { io.stdout.write('>testee>err> ${line}\n'); }); process!.exitCode.then((exitCode) { - if ((io.exitCode != 0) && !killedByTester) { + if ((exitCode != 0) && !killedByTester) { throw "Testee exited with $exitCode"; } - print("** Process exited"); + print("** Process exited: $exitCode"); }); return completer.future; }); @@ -245,13 +249,14 @@ class _ServiceTesterRunner { List? extraArgs, List? vmTests, List? isolateTests, + required String scriptName, bool pause_on_start = false, bool pause_on_exit = false, bool verbose_vm = false, bool pause_on_unhandled_exceptions = false, bool testeeControlsServer = false, bool useAuthToken = false}) async { - var process = _ServiceTesteeLauncher(); + var process = _ServiceTesteeLauncher(scriptName); late VmService vm; late IsolateRef isolate; setUp(() async { @@ -272,7 +277,7 @@ class _ServiceTesterRunner { }); }); - final name = _getTestUri().pathSegments.last; + final name = _getTestUri(scriptName).pathSegments.last; test( name, @@ -348,7 +353,8 @@ class _ServiceTesterRunner { /// to run tests or testee in this invocation of the script. Future runIsolateTests( List mainArgs, - List tests, { + List tests, + String scriptName, { testeeBefore()?, testeeConcurrent()?, bool pause_on_start = false, @@ -369,6 +375,7 @@ Future runIsolateTests( } else { await _ServiceTesterRunner().run( mainArgs: mainArgs, + scriptName: scriptName, extraArgs: extraArgs, isolateTests: tests, pause_on_start: pause_on_start, @@ -391,7 +398,8 @@ Future runIsolateTests( /// functions). void runIsolateTestsSynchronous( List mainArgs, - List tests, { + List tests, + String scriptName, { void testeeBefore()?, void testeeConcurrent()?, bool pause_on_start = false, @@ -410,6 +418,7 @@ void runIsolateTestsSynchronous( } else { _ServiceTesterRunner().run( mainArgs: mainArgs, + scriptName: scriptName, extraArgs: extraArgs, isolateTests: tests, pause_on_start: pause_on_start, @@ -425,7 +434,8 @@ void runIsolateTestsSynchronous( /// to run tests or testee in this invocation of the script. Future runVMTests( List mainArgs, - List tests, { + List tests, + String scriptName, { testeeBefore()?, testeeConcurrent()?, bool pause_on_start = false, @@ -443,6 +453,7 @@ Future runVMTests( } else { await _ServiceTesterRunner().run( mainArgs: mainArgs, + scriptName: scriptName, extraArgs: extraArgs, vmTests: tests, pause_on_start: pause_on_start, diff --git a/pkg/vm_service/test/coverage_leaf_function_test.dart b/pkg/vm_service/test/coverage_leaf_function_test.dart index 1e5146f892f..fd15551c95b 100644 --- a/pkg/vm_service/test/coverage_leaf_function_test.dart +++ b/pkg/vm_service/test/coverage_leaf_function_test.dart @@ -111,5 +111,9 @@ var tests = [ }, ]; -main([args = const []]) => - runIsolateTests(args, tests, testeeConcurrent: testFunction); +main([args = const []]) => runIsolateTests( + args, + tests, + 'coverage_leaf_function_test.dart', + testeeConcurrent: testFunction, + ); diff --git a/pkg/vm_service/test/debugging_test.dart b/pkg/vm_service/test/debugging_test.dart index 615dfc2dc89..1ddee0255d1 100644 --- a/pkg/vm_service/test/debugging_test.dart +++ b/pkg/vm_service/test/debugging_test.dart @@ -236,5 +236,9 @@ var tests = [ }, ]; -main([args = const []]) => - runIsolateTests(args, tests, testeeBefore: startTimer); +main([args = const []]) => runIsolateTests( + args, + tests, + 'debugging_test.dart', + testeeBefore: startTimer, + ); diff --git a/pkg/vm_service/test/eval_test.dart b/pkg/vm_service/test/eval_test.dart index 5be029f0fdb..a7116979ae3 100644 --- a/pkg/vm_service/test/eval_test.dart +++ b/pkg/vm_service/test/eval_test.dart @@ -109,5 +109,9 @@ expectError(func) async { } } -main([args = const []]) => - runIsolateTests(args, tests, testeeConcurrent: testFunction); +main([args = const []]) => runIsolateTests( + args, + tests, + 'eval_test.dart', + testeeConcurrent: testFunction, + ); diff --git a/pkg/vm_service/test/evaluate_with_scope_test.dart b/pkg/vm_service/test/evaluate_with_scope_test.dart index 54e89794d68..a10aeee942a 100644 --- a/pkg/vm_service/test/evaluate_with_scope_test.dart +++ b/pkg/vm_service/test/evaluate_with_scope_test.dart @@ -62,5 +62,9 @@ final tests = [ } ]; -main([args = const []]) => - runIsolateTests(args, tests, testeeBefore: testeeMain); +main([args = const []]) => runIsolateTests( + args, + tests, + 'evaluate_with_scope_test.dart', + testeeBefore: testeeMain, + ); diff --git a/pkg/vm_service/test/file_service_test.dart b/pkg/vm_service/test/file_service_test.dart index 045ba1e965f..e8b5713fbca 100644 --- a/pkg/vm_service/test/file_service_test.dart +++ b/pkg/vm_service/test/file_service_test.dart @@ -111,4 +111,9 @@ var fileTests = [ }, ]; -main(args) async => runIsolateTests(args, fileTests, testeeBefore: setupFiles); +main([args = const []]) async => runIsolateTests( + args, + fileTests, + 'file_service_test.dart', + testeeBefore: setupFiles, + ); diff --git a/pkg/vm_service/test/get_allocation_profile_rpc_test.dart b/pkg/vm_service/test/get_allocation_profile_rpc_test.dart index 4ce9675381d..30070136d7b 100644 --- a/pkg/vm_service/test/get_allocation_profile_rpc_test.dart +++ b/pkg/vm_service/test/get_allocation_profile_rpc_test.dart @@ -65,4 +65,8 @@ var tests = [ }, ]; -main([args = const []]) async => runIsolateTests(args, tests); +main([args = const []]) async => runIsolateTests( + args, + tests, + 'get_allocation_profile_rpc_test.dart', + ); diff --git a/pkg/vm_service/test/get_cpu_samples_rpc_test.dart b/pkg/vm_service/test/get_cpu_samples_rpc_test.dart index 95d8c85f3c6..d90c2f87dab 100644 --- a/pkg/vm_service/test/get_cpu_samples_rpc_test.dart +++ b/pkg/vm_service/test/get_cpu_samples_rpc_test.dart @@ -56,5 +56,10 @@ var vmArgs = [ '--profile-vm=false', // So this also works with KBC. ]; -main([args = const []]) async => - runIsolateTests(args, tests, testeeBefore: testeeDo, extraArgs: vmArgs); +main([args = const []]) async => runIsolateTests( + args, + tests, + 'get_cpu_samples_rpc_test.dart', + testeeBefore: testeeDo, + extraArgs: vmArgs, + ); diff --git a/pkg/vm_service/test/get_flag_list_rpc_test.dart b/pkg/vm_service/test/get_flag_list_rpc_test.dart index 1fba955a8c1..ef3f5ade666 100644 --- a/pkg/vm_service/test/get_flag_list_rpc_test.dart +++ b/pkg/vm_service/test/get_flag_list_rpc_test.dart @@ -72,4 +72,8 @@ var tests = [ } ]; -main([args = const []]) async => runVMTests(args, tests); +main([args = const []]) async => runVMTests( + args, + tests, + 'get_flag_list_rpc_test.dart', + ); diff --git a/pkg/vm_service/test/get_isolate_group_memory_usage.dart b/pkg/vm_service/test/get_isolate_group_memory_usage.dart index 6ab44e5ec1c..dcef7b43fc0 100644 --- a/pkg/vm_service/test/get_isolate_group_memory_usage.dart +++ b/pkg/vm_service/test/get_isolate_group_memory_usage.dart @@ -32,4 +32,8 @@ var tests = [ }, ]; -main(args) async => runVMTests(args, tests); +main(args) async => runVMTests( + args, + tests, + 'get_isolate_group_memory_usage.dart', + ); diff --git a/pkg/vm_service/test/get_isolate_rpc_test.dart b/pkg/vm_service/test/get_isolate_rpc_test.dart index 29e3d7a52c8..af7232de91a 100644 --- a/pkg/vm_service/test/get_isolate_rpc_test.dart +++ b/pkg/vm_service/test/get_isolate_rpc_test.dart @@ -55,4 +55,8 @@ var tests = [ }, ]; -main(args) async => runVMTests(args, tests); +main([args = const []]) async => runVMTests( + args, + tests, + 'get_isolate_rpc_test.dart', + ); diff --git a/pkg/vm_service/test/get_memory_usage.dart b/pkg/vm_service/test/get_memory_usage_test.dart similarity index 89% rename from pkg/vm_service/test/get_memory_usage.dart rename to pkg/vm_service/test/get_memory_usage_test.dart index 9325f591421..ccaea5cdd33 100644 --- a/pkg/vm_service/test/get_memory_usage.dart +++ b/pkg/vm_service/test/get_memory_usage_test.dart @@ -29,4 +29,8 @@ var tests = [ }, ]; -main(args) async => runVMTests(args, tests); +main([args = const []]) async => runVMTests( + args, + tests, + 'get_memory_usage_test.dart', + ); diff --git a/pkg/vm_service/test/get_stack_test.dart b/pkg/vm_service/test/get_stack_test.dart index 28c50010f44..77c35956ffe 100644 --- a/pkg/vm_service/test/get_stack_test.dart +++ b/pkg/vm_service/test/get_stack_test.dart @@ -144,5 +144,9 @@ final tests = [ }, ]; -main([args = const []]) => - runIsolateTests(args, tests, testeeConcurrent: testMain); +main([args = const []]) => runIsolateTests( + args, + tests, + 'get_stack_test.dart', + testeeConcurrent: testMain, + ); diff --git a/pkg/vm_service/test/get_version_rpc_test.dart b/pkg/vm_service/test/get_version_rpc_test.dart index 3cfeddabe6e..57be153c848 100644 --- a/pkg/vm_service/test/get_version_rpc_test.dart +++ b/pkg/vm_service/test/get_version_rpc_test.dart @@ -15,4 +15,8 @@ var tests = [ }, ]; -main([args = const []]) async => await runVMTests(args, tests); +main([args = const []]) async => await runVMTests( + args, + tests, + 'get_version_rpc_test.dart', + ); diff --git a/pkg/vm_service/test/heap_snapshot_graph_test.dart b/pkg/vm_service/test/heap_snapshot_graph_test.dart index 51490ecf8a5..f04961ae2f9 100644 --- a/pkg/vm_service/test/heap_snapshot_graph_test.dart +++ b/pkg/vm_service/test/heap_snapshot_graph_test.dart @@ -105,5 +105,9 @@ var tests = [ }, ]; -main([args = const []]) async => - runIsolateTests(args, tests, testeeBefore: script); +main([args = const []]) async => runIsolateTests( + args, + tests, + 'heap_snapshot_graph_test.dart', + testeeBefore: script, + ); diff --git a/pkg/vm_service/test/http_enable_timeline_logging_service_test.dart b/pkg/vm_service/test/http_enable_timeline_logging_service_test.dart index 2bbc90220f1..1341f1aef3b 100644 --- a/pkg/vm_service/test/http_enable_timeline_logging_service_test.dart +++ b/pkg/vm_service/test/http_enable_timeline_logging_service_test.dart @@ -87,5 +87,9 @@ var tests = [ }, ]; -main([args = const []]) async => - runIsolateTests(args, tests, testeeBefore: setup); +main([args = const []]) async => runIsolateTests( + args, + tests, + 'http_enable_timeline_logging_service_test.dart', + testeeBefore: setup, + ); diff --git a/pkg/vm_service/test/invoke_test.dart b/pkg/vm_service/test/invoke_test.dart index 6458f97d108..e4c7f1fc24c 100644 --- a/pkg/vm_service/test/invoke_test.dart +++ b/pkg/vm_service/test/invoke_test.dart @@ -75,5 +75,9 @@ expectError(func) async { expect(result.type == 'Error' || result.type == '@Error', isTrue); } -main([args = const []]) => - runIsolateTests(args, tests, testeeConcurrent: testFunction); +main([args = const []]) => runIsolateTests( + args, + tests, + 'invoke_test.dart', + testeeConcurrent: testFunction, + ); diff --git a/pkg/vm_service/test/network_profiling_test.dart b/pkg/vm_service/test/network_profiling_test.dart index b993389baaa..21757adae2c 100644 --- a/pkg/vm_service/test/network_profiling_test.dart +++ b/pkg/vm_service/test/network_profiling_test.dart @@ -130,5 +130,9 @@ var tests = [ // TODO(bkonyi): fully port observatory test for socket profiling. ]; -main([args = const []]) async => - runIsolateTests(args, tests, testeeBefore: setup); +main([args = const []]) async => runIsolateTests( + args, + tests, + 'network_profiling_test.dart', + testeeBefore: setup, + ); diff --git a/pkg/vm_service/test/object_graph_identity_hash_test.dart b/pkg/vm_service/test/object_graph_identity_hash_test.dart index da61a9d6f3b..15d59eed626 100644 --- a/pkg/vm_service/test/object_graph_identity_hash_test.dart +++ b/pkg/vm_service/test/object_graph_identity_hash_test.dart @@ -151,9 +151,10 @@ final tests = [ }, ]; -main(args) => runIsolateTests( +main([args = const []]) => runIsolateTests( args, tests, + 'object_graph_identity_hash_test.dart', testeeBefore: script, pause_on_exit: true, ); diff --git a/pkg/vm_service/test/process_service_test.dart b/pkg/vm_service/test/process_service_test.dart index b1c269a26ac..7fa9aba3d51 100644 --- a/pkg/vm_service/test/process_service_test.dart +++ b/pkg/vm_service/test/process_service_test.dart @@ -7,15 +7,12 @@ import 'dart:convert'; import 'dart:developer'; import 'dart:io' as io; -import 'package:path/path.dart' as path; +import 'package:process/process.dart'; import 'package:test/test.dart'; import 'package:vm_service/vm_service.dart'; import 'common/test_helper.dart'; -final dartJITBinary = path.join(path.dirname(io.Platform.resolvedExecutable), - 'dart' + path.extension(io.Platform.resolvedExecutable)); - Future setupProcesses() async { final dir = await io.Directory.systemTemp.createTemp('file_service'); @@ -48,10 +45,15 @@ Future setupProcesses() async { } Future setup(ignored_a, ignored_b) async { + final processManager = LocalProcessManager(); try { - process1 = await io.Process.start(io.Platform.executable, args); - process2 = - await io.Process.start(io.Platform.executable, args..add('foobar')); + process1 = await processManager.start( + [io.Platform.resolvedExecutable, ...args], + ); + process2 = await processManager.start([ + io.Platform.resolvedExecutable, + ...(args..add('foobar')), + ]); final codeFilePath = dir.path + io.Platform.pathSeparator + "other_file"; final codeFile = io.File(codeFilePath); await codeFile.writeAsString(''' @@ -61,8 +63,13 @@ Future setupProcesses() async { await stdin.drain(); } '''); - process3 = await io.Process.start( - dartJITBinary, [...io.Platform.executableArguments, codeFilePath]); + process3 = await processManager.start( + [ + io.Platform.resolvedExecutable, + ...io.Platform.executableArguments, + codeFilePath + ], + ); } catch (_) { closeDown(); rethrow; @@ -105,7 +112,7 @@ final processTests = [ all.processes[0].id, ); - expect(first.name, io.Platform.executable); + expect(io.Platform.resolvedExecutable, contains(first.name.trim())); expect(first.pid, equals(setup.json!['pids']![0])); expect(first.arguments.contains('foobar'), isFalse); expect(first.startedAt, greaterThan(0)); @@ -115,7 +122,7 @@ final processTests = [ all.processes[1].id, ); - expect(second.name, io.Platform.executable); + expect(io.Platform.resolvedExecutable, contains(second.name.trim())); expect(second.pid, equals(setup.json!['pids']![1])); expect(second.arguments.contains('foobar'), isTrue); expect(second.pid != first.pid, isTrue); @@ -127,7 +134,7 @@ final processTests = [ all.processes[2].id, ); - expect(third.name, dartJITBinary); + expect(io.Platform.resolvedExecutable, contains(third.name.trim())); expect(third.pid, equals(setup.json!['pids']![2])); expect(third.pid != first.pid, isTrue); expect(third.pid != second.pid, isTrue); @@ -148,5 +155,9 @@ final processTests = [ }, ]; -main(args) async => - runIsolateTests(args, processTests, testeeBefore: setupProcesses); +main([args = const []]) async => runIsolateTests( + args, + processTests, + 'process_service_test.dart', + testeeBefore: setupProcesses, + ); diff --git a/pkg/vm_service/test/regress_44588_test.dart b/pkg/vm_service/test/regress_44588_test.dart index 34693058cf8..3f0564fa240 100644 --- a/pkg/vm_service/test/regress_44588_test.dart +++ b/pkg/vm_service/test/regress_44588_test.dart @@ -24,4 +24,8 @@ var tests = [ } ]; -main([args = const []]) => runIsolateTests(args, tests); +main([args = const []]) => runIsolateTests( + args, + tests, + 'regress_44588_test.dart', + ); diff --git a/pkg/vm_service/test/throws_sentinel_test.dart b/pkg/vm_service/test/throws_sentinel_test.dart index 623ab024490..3b377c5d2ac 100644 --- a/pkg/vm_service/test/throws_sentinel_test.dart +++ b/pkg/vm_service/test/throws_sentinel_test.dart @@ -20,4 +20,8 @@ var tests = [ }, ]; -main([args = const []]) async => await runVMTests(args, tests); +main([args = const []]) async => await runVMTests( + args, + tests, + 'throws_sentinel_test.dart', + );