Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add package config URI into VM test entrypoints #2245

Merged
merged 8 commits into from
Jun 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
122 changes: 97 additions & 25 deletions .github/workflows/dart.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

43 changes: 12 additions & 31 deletions pkgs/test_core/lib/src/runner/vm/platform.dart
Original file line number Diff line number Diff line change
Expand Up @@ -299,8 +299,12 @@ stderr: ${processResult.stderr}''');
if (!file.existsSync()) {
file
..createSync(recursive: true)
..writeAsStringSync(_bootstrapIsolateTestContents(
await absoluteUri(testPath), languageVersionComment));
..writeAsStringSync(testBootstrapContents(
testUri: await absoluteUri(testPath),
languageVersionComment: languageVersionComment,
packageConfigUri: await packageConfigUri,
testType: VmTestType.isolate,
));
}
return file.uri;
}
Expand All @@ -316,40 +320,17 @@ stderr: ${processResult.stderr}''');
if (!file.existsSync()) {
file
..createSync(recursive: true)
..writeAsStringSync(_bootstrapNativeTestContents(
await absoluteUri(testPath), languageVersionComment));
..writeAsStringSync(testBootstrapContents(
testUri: await absoluteUri(testPath),
languageVersionComment: languageVersionComment,
packageConfigUri: await packageConfigUri,
testType: VmTestType.process,
));
}
return file.path;
}
}

/// Creates bootstrap file contents for running [testUri] in a VM isolate.
String _bootstrapIsolateTestContents(
Uri testUri, String languageVersionComment) =>
'''
$languageVersionComment
import "dart:isolate";
import "package:test_core/src/bootstrap/vm.dart";
import "$testUri" as test;
void main(_, SendPort sendPort) {
internalBootstrapVmTest(() => test.main, sendPort);
}
''';

/// Creates bootstrap file contents for running [testUri] as a native
/// executable.
String _bootstrapNativeTestContents(
Uri testUri, String languageVersionComment) =>
'''
$languageVersionComment
import "dart:isolate";
import "package:test_core/src/bootstrap/vm.dart";
import "$testUri" as test;
void main(List<String> args) {
internalBootstrapNativeTest(() => test.main, args);
}
''';

Future<Map<String, dynamic>> _gatherCoverage(Environment environment) async {
final isolateId = Uri.parse(environment.observatoryUrl!.fragment)
.queryParameters['isolateId'];
Expand Down
Loading
Loading