From 39c4b31decb933c837d0c4d67e6e787ef0ca01ea Mon Sep 17 00:00:00 2001 From: Liam Appelbe Date: Wed, 7 May 2025 10:09:29 +1000 Subject: [PATCH 1/8] Set a debug name for test isolates --- pkgs/test_core/lib/src/runner/vm/platform.dart | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pkgs/test_core/lib/src/runner/vm/platform.dart b/pkgs/test_core/lib/src/runner/vm/platform.dart index 506909db7..da4d1ba2c 100644 --- a/pkgs/test_core/lib/src/runner/vm/platform.dart +++ b/pkgs/test_core/lib/src/runner/vm/platform.dart @@ -247,7 +247,8 @@ stderr: ${processResult.stderr}'''); /// Runs [uri] in an isolate, passing [message]. Future _spawnIsolateWithUri(Uri uri, SendPort message) async { return await Isolate.spawnUri(uri, [], message, - packageConfig: await packageConfigUri, checked: true); + packageConfig: await packageConfigUri, checked: true, + debugName: 'test_main'); } Future _spawnPrecompiledIsolate(String testPath, SendPort message, @@ -285,7 +286,8 @@ stderr: ${processResult.stderr}'''); } } return await Isolate.spawnUri(testUri, [], message, - packageConfig: packageConfig?.uri, checked: true); + packageConfig: packageConfig?.uri, checked: true, + debugName: 'test_main'); } /// Bootstraps the test at [testPath] and writes its contents to a temporary From c9b5b6fa021f6040ab04c88e223eb8f5354f99a0 Mon Sep 17 00:00:00 2001 From: Liam Appelbe Date: Wed, 7 May 2025 10:32:15 +1000 Subject: [PATCH 2/8] fmt --- .../test_core/lib/src/runner/vm/platform.dart | 37 ++++++++++++------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/pkgs/test_core/lib/src/runner/vm/platform.dart b/pkgs/test_core/lib/src/runner/vm/platform.dart index da4d1ba2c..d573f049f 100644 --- a/pkgs/test_core/lib/src/runner/vm/platform.dart +++ b/pkgs/test_core/lib/src/runner/vm/platform.dart @@ -111,7 +111,7 @@ class VMPlatform extends PlatformPlugin { if (platform.compiler == Compiler.exe) { throw UnsupportedError( 'Unable to debug tests compiled to `exe` (tried to debug $path with ' - 'the `exe` compiler).'); + 'the `exe` compiler).'); } var info = await Service.controlWebServer(enable: true, silenceOutput: true); @@ -123,8 +123,7 @@ class VMPlatform extends PlatformPlugin { client = await vmServiceConnectUri(_wsUriFor(serverUri).toString()); var isolateNumber = int.parse(isolateID.split('/').last); isolateRef = (await client.getVM()) - .isolates! - .firstWhere((isolate) => isolate.number == isolateNumber.toString()); + .isolates!.firstWhere((isolate) => isolate.number == isolateNumber.toString()); await client.setName(isolateRef.id!, path); var libraryRef = (await client.getIsolate(isolateRef.id!)) .libraries! @@ -180,8 +179,8 @@ class VMPlatform extends PlatformPlugin { Future _compileToNative(String path, Metadata suiteMetadata) async { var bootstrapPath = await _bootstrapNativeTestFile( path, - suiteMetadata.languageVersionComment ?? - await rootPackageLanguageVersionComment); + suiteMetadata.languageVersionComment ?? + await rootPackageLanguageVersionComment); var output = File(p.setExtension(bootstrapPath, '.exe')); var processResult = await Process.run(Platform.resolvedExecutable, [ 'compile', @@ -221,8 +220,8 @@ stderr: ${processResult.stderr}'''); Compiler.source => _spawnIsolateWithUri( await _bootstrapIsolateTestFile( path, - suiteMetadata.languageVersionComment ?? - await rootPackageLanguageVersionComment), + suiteMetadata.languageVersionComment ?? + await rootPackageLanguageVersionComment), message), _ => throw StateError( 'Unsupported compiler $compiler for the VM platform'), @@ -246,9 +245,14 @@ stderr: ${processResult.stderr}'''); /// Runs [uri] in an isolate, passing [message]. Future _spawnIsolateWithUri(Uri uri, SendPort message) async { - return await Isolate.spawnUri(uri, [], message, - packageConfig: await packageConfigUri, checked: true, - debugName: 'test_main'); + return await Isolate.spawnUri( + uri, + [], + message, + packageConfig: await packageConfigUri, + checked: true, + debugName: 'test_main', + ); } Future _spawnPrecompiledIsolate(String testPath, SendPort message, @@ -285,9 +289,14 @@ stderr: ${processResult.stderr}'''); packageConfig = null; } } - return await Isolate.spawnUri(testUri, [], message, - packageConfig: packageConfig?.uri, checked: true, - debugName: 'test_main'); + return await Isolate.spawnUri( + testUri, + [], + message, + packageConfig: packageConfig?.uri, + checked: true, + debugName: 'test_main', + ); } /// Bootstraps the test at [testPath] and writes its contents to a temporary @@ -346,7 +355,7 @@ Uri _wsUriFor(Uri observatoryUrl) => Uri _observatoryUrlFor(Uri base, String isolateId, String id) => base.replace( fragment: Uri( path: '/inspect', - queryParameters: {'isolateId': isolateId, 'objectId': id}).toString()); + queryParameters: {'isolateId': isolateId, 'objectId': id}).toString()); var _hasRegistered = false; void _setupPauseAfterTests() { From 455483b5fd8cd44200a7df073affa0539017339d Mon Sep 17 00:00:00 2001 From: Liam Appelbe Date: Wed, 7 May 2025 10:51:16 +1000 Subject: [PATCH 3/8] changelog --- .github/workflows/dart.yml | 2 +- pkgs/test_core/CHANGELOG.md | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/dart.yml b/.github/workflows/dart.yml index 8097a4b29..d18e83536 100644 --- a/.github/workflows/dart.yml +++ b/.github/workflows/dart.yml @@ -252,7 +252,7 @@ jobs: if: "always() && steps.checkout.conclusion == 'success'" working-directory: pkgs/test_core - name: "pkgs/test_core; dart format --output=none --set-exit-if-changed ." - run: "dart format --output=none --set-exit-if-changed ." + run: "dart format --output=show --set-exit-if-changed ." if: "always() && steps.pkgs_test_core_pub_upgrade.conclusion == 'success'" working-directory: pkgs/test_core - name: "pkgs/test_core; dart analyze --fatal-infos" diff --git a/pkgs/test_core/CHANGELOG.md b/pkgs/test_core/CHANGELOG.md index c6423f719..15b0f3c4c 100644 --- a/pkgs/test_core/CHANGELOG.md +++ b/pkgs/test_core/CHANGELOG.md @@ -4,6 +4,7 @@ * `test()` and `group()` functions now take an optional `TestLocation` that will be used as the location of the test in JSON reporters instead of being parsed from the call stack. +* Set a debug name for test isolates. ## 0.6.8 From 7800c010596333f508a841d1b384ecc28501cfc3 Mon Sep 17 00:00:00 2001 From: Liam Appelbe Date: Wed, 7 May 2025 10:57:13 +1000 Subject: [PATCH 4/8] fmt --- pkgs/test_core/lib/src/runner/vm/platform.dart | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/pkgs/test_core/lib/src/runner/vm/platform.dart b/pkgs/test_core/lib/src/runner/vm/platform.dart index d573f049f..5ee067839 100644 --- a/pkgs/test_core/lib/src/runner/vm/platform.dart +++ b/pkgs/test_core/lib/src/runner/vm/platform.dart @@ -111,7 +111,7 @@ class VMPlatform extends PlatformPlugin { if (platform.compiler == Compiler.exe) { throw UnsupportedError( 'Unable to debug tests compiled to `exe` (tried to debug $path with ' - 'the `exe` compiler).'); + 'the `exe` compiler).'); } var info = await Service.controlWebServer(enable: true, silenceOutput: true); @@ -123,7 +123,8 @@ class VMPlatform extends PlatformPlugin { client = await vmServiceConnectUri(_wsUriFor(serverUri).toString()); var isolateNumber = int.parse(isolateID.split('/').last); isolateRef = (await client.getVM()) - .isolates!.firstWhere((isolate) => isolate.number == isolateNumber.toString()); + .isolates! + .firstWhere((isolate) => isolate.number == isolateNumber.toString()); await client.setName(isolateRef.id!, path); var libraryRef = (await client.getIsolate(isolateRef.id!)) .libraries! @@ -179,8 +180,8 @@ class VMPlatform extends PlatformPlugin { Future _compileToNative(String path, Metadata suiteMetadata) async { var bootstrapPath = await _bootstrapNativeTestFile( path, - suiteMetadata.languageVersionComment ?? - await rootPackageLanguageVersionComment); + suiteMetadata.languageVersionComment ?? + await rootPackageLanguageVersionComment); var output = File(p.setExtension(bootstrapPath, '.exe')); var processResult = await Process.run(Platform.resolvedExecutable, [ 'compile', @@ -220,8 +221,8 @@ stderr: ${processResult.stderr}'''); Compiler.source => _spawnIsolateWithUri( await _bootstrapIsolateTestFile( path, - suiteMetadata.languageVersionComment ?? - await rootPackageLanguageVersionComment), + suiteMetadata.languageVersionComment ?? + await rootPackageLanguageVersionComment), message), _ => throw StateError( 'Unsupported compiler $compiler for the VM platform'), @@ -355,7 +356,7 @@ Uri _wsUriFor(Uri observatoryUrl) => Uri _observatoryUrlFor(Uri base, String isolateId, String id) => base.replace( fragment: Uri( path: '/inspect', - queryParameters: {'isolateId': isolateId, 'objectId': id}).toString()); + queryParameters: {'isolateId': isolateId, 'objectId': id}).toString()); var _hasRegistered = false; void _setupPauseAfterTests() { From 4097e1be7d97c2cbdc8a6f2ad00dfeb6907abdee Mon Sep 17 00:00:00 2001 From: Liam Appelbe Date: Wed, 7 May 2025 11:06:14 +1000 Subject: [PATCH 5/8] revert workflow debugging --- .github/workflows/dart.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dart.yml b/.github/workflows/dart.yml index d18e83536..8097a4b29 100644 --- a/.github/workflows/dart.yml +++ b/.github/workflows/dart.yml @@ -252,7 +252,7 @@ jobs: if: "always() && steps.checkout.conclusion == 'success'" working-directory: pkgs/test_core - name: "pkgs/test_core; dart format --output=none --set-exit-if-changed ." - run: "dart format --output=show --set-exit-if-changed ." + run: "dart format --output=none --set-exit-if-changed ." if: "always() && steps.pkgs_test_core_pub_upgrade.conclusion == 'success'" working-directory: pkgs/test_core - name: "pkgs/test_core; dart analyze --fatal-infos" From 90e64ec2887ed07e220793ab916d91fca05a6241 Mon Sep 17 00:00:00 2001 From: Nate Bosch Date: Tue, 13 May 2025 00:09:27 +0000 Subject: [PATCH 6/8] Bump version test_core 0.6.9 is already published, bump to a -wip version. --- pkgs/test/CHANGELOG.md | 4 ++++ pkgs/test/pubspec.yaml | 4 ++-- pkgs/test_core/CHANGELOG.md | 5 ++++- pkgs/test_core/pubspec.yaml | 2 +- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/pkgs/test/CHANGELOG.md b/pkgs/test/CHANGELOG.md index 22e0f1b3f..c2acfc7a2 100644 --- a/pkgs/test/CHANGELOG.md +++ b/pkgs/test/CHANGELOG.md @@ -1,3 +1,7 @@ +## 1.26.1-wip + +* Set a debug name for test isolates. + ## 1.26.0 * `test()` and `group()` functions now take an optional `TestLocation` that will diff --git a/pkgs/test/pubspec.yaml b/pkgs/test/pubspec.yaml index d008f3cc2..bf5ca4e2f 100644 --- a/pkgs/test/pubspec.yaml +++ b/pkgs/test/pubspec.yaml @@ -1,5 +1,5 @@ name: test -version: 1.26.0 +version: 1.26.1-wip description: >- A full featured library for writing and running Dart tests across platforms. repository: https://github.com/dart-lang/test/tree/master/pkgs/test @@ -37,7 +37,7 @@ dependencies: # Use an exact version until the test_api and test_core package are stable. test_api: 0.7.5 - test_core: 0.6.9 + test_core: 0.6.10 typed_data: ^1.3.0 web_socket_channel: '>=2.0.0 <4.0.0' diff --git a/pkgs/test_core/CHANGELOG.md b/pkgs/test_core/CHANGELOG.md index d4aa27947..999a58974 100644 --- a/pkgs/test_core/CHANGELOG.md +++ b/pkgs/test_core/CHANGELOG.md @@ -1,10 +1,13 @@ +## 0.6.10-wip + +* Set a debug name for test isolates. + ## 0.6.9 * Add support for native assets for `dart test` in pub workspaces. * `test()` and `group()` functions now take an optional `TestLocation` that will be used as the location of the test in JSON reporters instead of being parsed from the call stack. -* Set a debug name for test isolates. ## 0.6.8 diff --git a/pkgs/test_core/pubspec.yaml b/pkgs/test_core/pubspec.yaml index 7e29a4ad0..c5da5adfc 100644 --- a/pkgs/test_core/pubspec.yaml +++ b/pkgs/test_core/pubspec.yaml @@ -1,5 +1,5 @@ name: test_core -version: 0.6.9 +version: 0.6.10-wip description: A basic library for writing tests and running them on the VM. repository: https://github.com/dart-lang/test/tree/master/pkgs/test_core issue_tracker: https://github.com/dart-lang/test/issues?q=is%3Aissue+is%3Aopen+label%3Apackage%3Atest From 3c3878afe773a4a3d654da0900394e189ee0df55 Mon Sep 17 00:00:00 2001 From: Liam Appelbe Date: Tue, 13 May 2025 10:15:44 +1000 Subject: [PATCH 7/8] Include the test URI in the debug name --- pkgs/test_core/lib/src/runner/vm/platform.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/test_core/lib/src/runner/vm/platform.dart b/pkgs/test_core/lib/src/runner/vm/platform.dart index 5ee067839..f2586abfb 100644 --- a/pkgs/test_core/lib/src/runner/vm/platform.dart +++ b/pkgs/test_core/lib/src/runner/vm/platform.dart @@ -252,7 +252,7 @@ stderr: ${processResult.stderr}'''); message, packageConfig: await packageConfigUri, checked: true, - debugName: 'test_main', + debugName: 'test_suite:$uri', ); } @@ -296,7 +296,7 @@ stderr: ${processResult.stderr}'''); message, packageConfig: packageConfig?.uri, checked: true, - debugName: 'test_main', + debugName: 'test_suite:$testUri', ); } From a1e295b4f657f4e37dc976cf45fd325e992a1bc5 Mon Sep 17 00:00:00 2001 From: Liam Appelbe Date: Tue, 13 May 2025 10:23:10 +1000 Subject: [PATCH 8/8] Fix CI --- pkgs/test/pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/test/pubspec.yaml b/pkgs/test/pubspec.yaml index bf5ca4e2f..e34ab8a0b 100644 --- a/pkgs/test/pubspec.yaml +++ b/pkgs/test/pubspec.yaml @@ -37,7 +37,7 @@ dependencies: # Use an exact version until the test_api and test_core package are stable. test_api: 0.7.5 - test_core: 0.6.10 + test_core: 0.6.10-wip typed_data: ^1.3.0 web_socket_channel: '>=2.0.0 <4.0.0'